Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(more persistent) states (state machines) for active ships #10042

Open
petervdmeer opened this issue May 4, 2024 · 1 comment
Open

(more persistent) states (state machines) for active ships #10042

petervdmeer opened this issue May 4, 2024 · 1 comment
Labels
enhancement A suggestion for new content or functionality that requires code changes mechanics Things dealing with the mechanics & code of how the game works

Comments

@petervdmeer
Copy link
Member

petervdmeer commented May 4, 2024

Problem Description

Ships are currently governed by a large set of booleans and target-pointers to determine what a ship is doing and that get evaluated each frame. I feel that moving to state-machines will help improve readability and will allow new features more easily.

Related Issue Links

Some examples of where I expect that the use of state-machines will help:

  • real-time boarding (ships are in boarding state while the game is running, we can also have multiple boarding states more easily)
  • speeding up formation flying (ships are either in a "Flying in a formation state" or in another state being out of the formation, making the formations code more easier to deal with)
  • cleaning up of orders / commands (ships just switch to the right states relevant to the given command(s))

Desired Solution

Using a state machine will likely improve the readability and clarity of the code, and might also help to add some newer features. The different states would typically be implemented as an enum.

Alternative Approaches

Continuing with booleans as we do now is an alternative.

There was also discussion some time in the past to not only have state machines for individual ships, but to also have state-machines for governments. (Affecting government behavior and allowing governments to influence their ships.)

I feel that state machines on ships would be a good starting point, before deploying such a feature at other places.

Additional Context

No response

@petervdmeer petervdmeer added enhancement A suggestion for new content or functionality that requires code changes mechanics Things dealing with the mechanics & code of how the game works labels May 4, 2024
@Zireael07
Copy link

State machines is what my own space game uses, +100 to this and the reasoning behind it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion for new content or functionality that requires code changes mechanics Things dealing with the mechanics & code of how the game works
Projects
None yet
Development

No branches or pull requests

2 participants