0
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ 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. \$\endgroup\$
    – momboco
    Jun 12, 2011 at 22:43
  • \$\begingroup\$ 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. \$\endgroup\$ Jun 12, 2011 at 22:54
  • \$\begingroup\$ "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? \$\endgroup\$
    – Tetrad
    Jun 12, 2011 at 23:02
  • \$\begingroup\$ @eBusiness Polygons? That's not my concern, it's texture binding that is the concern. \$\endgroup\$
    – jmasterx
    Jun 13, 2011 at 0:04
  • \$\begingroup\$ Then put everything in one or two textures and bind it only once or twice. \$\endgroup\$
    – TravisG
    Jun 13, 2011 at 0:16

2 Answers 2

3
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .