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

Review how States pass messages to one another #153

Open
NathanLovato opened this issue Aug 8, 2019 · 2 comments
Open

Review how States pass messages to one another #153

NathanLovato opened this issue Aug 8, 2019 · 2 comments

Comments

@NathanLovato
Copy link
Contributor

I've been thinking about these transition problems a bit and the way we pass values around from state to state to preserve state can be improved. At the moment we use the msg Dictionary with arbitrary variables and rely on each state to know what to do with it.

I think we're at a point where we could introduce a player/hook state Dictionary that's internally kept in each state we create and it's passed around when transitioning form one state to the other. This way it would be less of a hassle to correctly set say velocity after hook is used when hitting the ground. Not only that, but it would make save/load simpler too.

We could also have partial state updates from state to state, for example if the death state doesn't affect velocity (which shouldn't) then we just pass relevant Dictionary parts to it and not the entire variable.

This internal state that represents all variables affecting the player/hook at any one point, like velocity, etc could be thought of like the "contract" that the states use and it possibly simplifies keeping track of changes made (from dev. point of view)

Originally posted by @razcore-art in #150 (comment)

@NathanLovato
Copy link
Contributor Author

I'll still start the player char controller course with what we have, as we already have some pretty solid code. But it makes sense.

@NathanLovato
Copy link
Contributor Author

@razcore-art is this still relevant? Have you had the opportunity to give this more thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant