Performance: How to manage System priorities?

(Adrien Turiot) #1

Hi everyone :slight_smile: While I was learning Amethyst, I wondered about this issue:

Since games are soft real-time systems, then if the CPU is overloaded, we may accept to skip some loop iterations of some less important ECS systems.
For example, we may want to execute the system in charge of particle effects less often than core ones.

I think it’s related with the specs crate. do you have any suggestion of how manage system priorities ?
Thanks

(Kel) #2

Welcome to the forum!

Currently the dispatchers in specs have no concept of system priorities used to postpone some systems to the next dispatching. What you could do is create a Dispatcher with less important systems, and either use some criteria to choose whether to run that dispatcher each frame or you could instead manually create a thread for long-running tasks and communicate the changes to be synchronized back to your world via a channel.

2 Likes
(Adrien Turiot) #3

Thanks for your reply :slight_smile: your suggestion look like having several pool of systems to manage.
We could have some some kind of orchestrator that enable or disable dispatchers depending of CPU load. It can even be a system itself :slight_smile:

I do not see any major cons other than just being less convenient to integrate to the app.

By the way, specs seems to had a way to manage priority in former versions, but I guess they change to a better unified way.