0
\$\begingroup\$


I use in Java Artemis(entity system library) and Slick2D(graphics library) for a game.
Now I wonder me, how I should handle graphics(sprites, textures...).
In the demos of the page from Artemis it was made so:

The method from the examples from the artmis page SourceCode

I hope the diagram is good enough. So someone asks now "Whats the problem ?": The Problem is, that this method is not very efficient and it feels not very good, because:

  • The spatial forms are created and initialized at run time
  • The spatial forms are created individually for every entity(Load textures or create a shape...)

I think there a better ways, so I hope someone have a better idea.
And if someone have the idea to make simply a sprite or a texture component, that's not a solution, because some entities have for example more textures than one.

And a supplementary question, how I should handle animated graphics ?

Thanks for reading :) and sorry for my bad English :(

\$\endgroup\$
1
  • \$\begingroup\$ Also this, this, and this... just on the first page of search results. Please search before asking. \$\endgroup\$ – user1430 Dec 9 '13 at 16:23
0
\$\begingroup\$

I would add a cache system for all resources. In my game project (in C++, but very similar system) I would call ResourceCache::instance()->Get("test.obj"); and then it would automatically load the resource if not cached, or instance the resource if it is. The added benefit to this is that it is dead simple to reload resources when they are lost.

\$\endgroup\$

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