Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Efficient ZOrdering

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
sdw Posted - Jan 18 2004 : 11:25:52 AM
I basically need a link to a turorial or good explanation on how to achieve efficient ZOrdering. I have some ideas, but I thought it wise to make sure there is no simple method of doing it before I go and butcher my code.

Btw, yes I've searched over the net but havn't found any good tutorials.
4   L A T E S T    R E P L I E S    (Newest First)
Krazex Posted - Feb 09 2004 : 2:42:37 PM
You should only add refrence numbers in the array to make the sorting as fast as possible.
Usually a app runns at about 60 fps which means you would have to have more then 30 characters to really notice that you only sort one each frame, and sorting one each frame is the absolute fastest way. And if there should be more characters on each frame add a if for it and sort 2 characters each frame.
sdw Posted - Feb 09 2004 : 09:26:53 AM
Ok, I see what you're saying. Could the array be a UDT with info on how to draw the character? Then the bouble sorting sorts the array from least Y value to greatest Y value then blits them in that order? But I don't really understand why to sort only one character each frame. Could maybe an example be supplied?
Krazex Posted - Feb 09 2004 : 03:08:47 AM
Make a draw array of units visible on screen, then boubble sort one character each frame.
Fast and effective.
sdw Posted - Feb 03 2004 : 7:23:46 PM
Was this a stupid question or what?

My original idea was to make a collection that stores data for drawing to the screen. So instead of drawing each sprite after all the calculations are made and new positions are updated, it just adds some data to this new collection about how to draw the sprite. Then before DD flips I call some sub which arranges the data from least to greatest according to the Y value for each chunk of data. After all of the sorting is done, it then blits everything from the top to bottom, making sprites with higher Y values drawn over top other sprites with a lesser Y value, thus making a zordering effect.

I have not tried this yet because I think it will take to much time to do and cut down on my fps. Would this be alright to try or are there more efficient methods of going about this?

VBGamer © Go To Top Of Page
This page was generated in 0.06 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.