Sign in to follow this  
macmoy

2d rendering structure - how to make it fast?

Recommended Posts

i made a mario-like game. in my PC, i can say that it has some speed problem. its not that bad/too slow,but you can recognize/feel it. BUT why is that other 2d games i play in my PC does have that problem(mario,diablo1,diablo2,trickster,etc.) i would like to learn the right way(the best way) or the best structure of rendering for games. i searched the net but got no luck. first is I dont know the keywords to search on. any help would be much appreciated.thanks!

Share this post


Link to post
Share on other sites
You aren't going to get much, if any real help, because you didn't specify anything that we can help you with. What language?, Which rendering library?, code snippets. You've gotta supply details if you want help.

Share this post


Link to post
Share on other sites
Use "instancing" for your sprites and you will gain a big boost because you wont be storing multiple copies of the same stuff in your video memory.

plus "culling" will give you performance based on the amount of stuff you cull off because you wont be drawing what isnt on the screen.

Share this post


Link to post
Share on other sites
sorry..
im using C++ / directx9
(using D3DXSPRITE)

what is instancing? culling??

any structure how to make my game faster? pseudo code will do.

Share this post


Link to post
Share on other sites
Instancing: Is using the same object in multiple places as different objects. A good example is textures, if you had a tree texture and you wanted 100 trees, you wouldnt want to load the texture 100 times. You load it 1 time and point the 100 tree objects to the texture.



Culling: In a broad sence culling is, not drawing what you cannot see. In your case if you are using a tile based system or not you should have some basic information about what your drawing with directX ie: the position of your sprites compaired to the position of your viewing screen. If you do a collision check between the sprite and your viewing rectangle (your screen) and only call draw on what is colliding you will increase performance unless everything is on screen at once.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this