Search the web
Sign In
New User? Sign Up
delphigames · Discussion of game programming in the Delphi development environment.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Help on 2d sprite z-order sorting   Message List  
Reply | Forward Message #7592 of 7611 |
RE: Help on 2d sprite z-order sorting

A qsort is very fast and is therefore ideal to be run every frame. In our
console games, we use a qsort on a list of hundreds of 3D objects every frame
and it doesn't rate anywhere near the top of our most-expensive-functions list.

Steve 'Sly' Williams
Lead Programmer
Krome Studios

-----Original Message-----
From: delphigames@yahoogroups.com [mailto:delphigames@yahoogroups.com] On Behalf
Of Ian Munro
Sent: Tuesday, 7 October 2008 7:41 PM
To: delphigames@yahoogroups.com
Subject: [DelphiGames] RE: Help on 2d sprite z-order sorting



That sounds reasonable. My next problem would be when to resort the
list. As I'm not showing many sprites I guess I could sort the list
every frame but its not very efficient. I'd like to only sort the list
when required. Anyone any ideas or am I approaching this in the wrong
way ?


From: xiaorang@... [mailto:xiaorang@...]

the Y-coord plus the height of the sprite make the z-order.


----- Original Message -----
From: "Ian" < ian.munro@... >

Subject: [DelphiGames] Help on 2d sprite z-order sorting I'm developing
a 2d game that requires the sprites to be z-order sorted but am not sure
how to go about doing this. Basically the sprites move around a
rectangular space at angles of 45 degrees. The sprite that the user
controls can move in the normal four directions and also diagonally. As
they overlap each other the sprites higher up the screen need to be
drawn first. Should I base the sort on the Y-axis or have a separate
variable ? I also don't want to sort the sprites every frame so how
should I be checking to know when to resort the list ? I have put
together a short video that shows the game running so you can see the
sprite movement. I don't expect there to be more than 6 moving sprites
on screen at anyone time. http://uk.youtube.com/watch?v=tl9ls02onj0




This message and its attachments may contain legally privileged or confidential
information. This message is intended for the use of the individual or entity to
which it is addressed. If you are not the addressee indicated in this message,
or the employee or agent responsible for delivering the message to the intended
recipient, you may not copy or deliver this message or its attachments to
anyone. Rather, you should permanently delete this message and its attachments
and kindly notify the sender by reply e-mail. Any content of this message and
its attachments, which does not relate to the official business of the sending
company must be taken not to have been sent or endorsed by the sending company
or any of its related entities. No warranty is made that the e-mail or
attachment(s) are free from computer virus or other defect.



Tue Oct 7, 2008 10:18 pm

slygamer
Offline Offline
Send Email Send Email

Forward
Message #7592 of 7611 |
Expand Messages Author Sort by Date

I'm developing a 2d game that requires the sprites to be z-order sorted but am not sure how to go about doing this. Basically the sprites move around a...
Ian
ianathome12345
Offline Send Email
Oct 7, 2008
8:44 am

That sounds reasonable. My next problem would be when to resort the list. As I'm not showing many sprites I guess I could sort the list every frame but its not...
Ian Munro
ianathome12345
Offline Send Email
Oct 7, 2008
9:40 am

A qsort is very fast and is therefore ideal to be run every frame. In our console games, we use a qsort on a list of hundreds of 3D objects every frame and it...
Steve Williams
slygamer
Offline Send Email
Oct 7, 2008
10:18 pm

Thanks for your input Steve. I've now implemented a sort on my sprite batch based on the y pos and height of the sprite (ie the z-order is based on the feet...
Ian Munro
ianathome12345
Offline Send Email
Oct 9, 2008
10:28 am

Hello, This group has been a bit quiet this year so I hope 2009 will see some renewed activity. I have a few questions to ask which I hope will get some...
Ian Munro
ianathome12345
Offline Send Email
Dec 24, 2008
10:50 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help