State-based Systems

#1

Is it possible to add systems to specific states?

Currently in the game I’m writing, systems are added to the GameDataBuilder via the “with” function.

These systems are then run on every frame, checking through their components and calculating various logic.

However my game also has multiple states, some of these states will never have use for some of these systems.

So instead of having all systems run on every frame, regardless of what state is the current state, is it possible to register or add systems to specific states so that they will only run when the state they were registered under/added to is the current state?

Sorry if this has been asked before, I did try searching through the forum and have read through all of the Amethyst master book.

Any help/suggestions would be very appreciated.

Cheers.

0 Likes

(Joël Lupien) #2

Have a read through this: http://www.amethyst.rs/book/master/game-data.html

There is also the custom game data example which shows state-specific dispatchers.

1 Like

#3

Awesome, damn I feel like an idiot for missing that - it’s exactly what I need.

Thanks for your help jojo.

0 Likes

(Azriel Hoh) #4

@el_cerdo if you’ve got time, please could you check if these guides make sense?

2 Likes

#5

@azriel91 looks good to me.

I was using the CustomGameData example for updating systems that are specific to the current state.

However after reading through your guides for internal and external dispatchers I think I’m going to adopt this method instead.

Thanks for the help guys.

0 Likes