Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

My game will be made up of objects. Essentially the level editor will give me a bunch of objects to choose from and I can drag them in and thus a level is made. The objects could have animation in which case they are responsible for knowing which frame and layer they are on.

So then I can have these:

Animated non-movable objects
Unanimated non-movable objects
Animated movable objects
Unanimated movable objects

So first I was thinking of, when the level starts, build a quadtree for all non-movable objects.

This way I can easily avoid rendering ones which are not in view.

Then from there I can do bounding box check on dynamic objects (or maybe if I add something like Box2D it can do it).

But then comes the rendering.

At first I was thinking of each object rendering itself, but then I cannot do atlasing.

I'd like to do atlasing. I was thinking that animated objects can just use their own frame sheet. But objects which are not animated should use atlasing.

I know this can be categorized as premature optimization, but I don't want to eventually find out that it is horribly slow.

Any design suggestions / comments would be welcome. Does it seem like a good idea to try to atlas in the sort of game I'm making, which is a platformer that is not tile based.

share|improve this question
    
You can do stress testing once you have the possibility to draw basic primitives. With the results you can decide if is needed to do optimizations. –  momboco Jun 12 '11 at 22:43
    
Didn't you get a pretty unanimous answer in your other question? Stop asking and start coding. You will have maybe 100 polygons on screen? A modern GPU can do ~1 million. So it will take something far worse than not using an atlas where appropriate to sink the performance. –  eBusiness Jun 12 '11 at 22:54
    
"At first I was thinking of each object rendering itself, but then I cannot do atlasing." That's not true. Why would that limitation exist? –  Tetrad Jun 12 '11 at 23:02
    
@eBusiness Polygons? That's not my concern, it's texture binding that is the concern. –  Milo Jun 13 '11 at 0:04
    
Then put everything in one or two textures and bind it only once or twice. –  TravisG Jun 13 '11 at 0:16
show 1 more comment

2 Answers

up vote 3 down vote accepted

Make a rough guess on how many objects you will need in your game. Put 10 times that amount in the engine.

If it doesn't run slow you are fine. If it runs slow, you might need to optomize, or you might still be fine.

I would be more concerned with the logic having to iterate through a lot of objects than the a 2d render being slow.

The only kind of culling that will be worth rendering is culling anything that is outside of the screen.

share|improve this answer
add comment

For a modern 2d game I would really look at Aquaria. http://www.bit-blot.com/aquaria/

They have some pretty modern principles they apply to a fairly normal 2d engine. Their basic idea is just massive stacking of objects on different layers. Take a look at this video by the guys from Wolfire analyzing technical details.

http://www.youtube.com/watch?v=1BpRsjF7QTM&feature=channel_video_title

I'd assume that when in non-editing mode static objects are combined into larger objects which are stored in a single surface but that is just a guess by me.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.