Jump to content
  • Advertisement
Sign in to follow this  

Slow down: Artemis C++ Port & SDL 2

This topic is 1282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there!


I currently have an issue with the Artemis C++ port (https://github.com/vinova/Artemis-Cpp) with SDL 2.0.

After having created an amount of effects the game starts to slow down and the frame-rate goes high.


In my current projects there is an effect system that creates lots of particles for explosions etc.

These particles have a defined age, so they "die" after a short time. I have set the following:

if (age < 0.0f) { e.remove; }

so that the created particle (= entity) with all components and systems is automatically removed.


This seems to work. But why does it slow down after a while? I don't see any leak. Maybe somebody experienced the same thing?


Thank you in advance.


Edited by WizEric

Share this post

Link to post
Share on other sites



I'm using artemis-cpp as well. In my case, if the number of entities passes a certain threshold the app starts slowing down. This is on a 4th gen i5 with gtx 860m. I suspect its due to the fact this implementation does not have a proper struct of array approach. Check the addcomponent function in entitymanager.cpp file, in that you can clearly see they use a Bag<component *>. A bag itself defines its array like E *data, where E can be any type. Effectively, you get

Bag<component *> components;
 // which, inside entitymanager, translates to
component **data;

See? Its an array of pointers (EDIT: Its not a technically an array of pointers but a pointer to a pointer. I said array because later its allocated and used as a normal array). Now I may be completely off here but it looks to me that this causes the code to jump around when accessing these pointers, which is what the AoS approach aims to solve. I'm at work so can't try it, but IMO using an array of plain data instead of array of pointers might help.


EDIT2: A bit offtopic, but you can get rid of that if statement by using a delayedEntityProcessingSystem to get rid of branches

Edited by SpaceRoach

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!