-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor(player): factor out LocalPlayerControlSystem #4586
refactor(player): factor out LocalPlayerControlSystem #4586
Conversation
LocalPlayerControlSystem now handles input events, LocalPlayerSystem still handles sending character movement events. Introduces a tag component for the local player, along with a DoNotPersist annotation to ensure the component only lasts for the current session. Both LocalPlayerSystem and LocalPlayerControlSystem use the tag component to find the local player.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As someone who just started familiarizing themselves with how movement inputs work the other day, this Sounds Good To Me.
But I have neither the experience with the ECS system nor the familiarity with how far-reaching changes to the LocalPlayerSystem would be to able to give much more intelligent feedback than that.
There are some points with regards to this draft that needs to be considered,
If the answer to these are yes, then the general idea in this draft is good. However these are three different things that would really have to be done in separare pull requests, and the implementation of the DoNotPersist annotation as well as the adding of the tag component for the local player would need a bit of cleanup. |
…yer-control-system # Conflicts: # engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java # engine/src/main/java/org/terasology/engine/persistence/serializers/ComponentSerializeCheck.java chore: update engine package paths for MovingBlocks#4560
@antag99
Components can have any life time. (one tick, or infinity via persistance) I updated code, a bit choring annotations and some idea issues. And then detects that player cannot moves in multiplayer. |
Thanks for taking a look!
No, I have not tested the patch on multiplayer if i remember correctly. I do not have the time to work on this for the time being, so I will close this PR and open a new one if I get back to working on it. I remember the most tricky part was to get the tag component added whenever the local player appeared, and I think there may be a lot of work (and testing) to get this done properly. |
Contains
LocalPlayerControlSystem now handles input events, LocalPlayerSystem still handles sending character movement events. Current motion control state is stored in a component (LocalPlayerControlComponent).
Introduces a tag component (LocalPlayerComponent) for the local player, along with a DoNotPersist annotation to ensure the component only lasts for the current session.
Both LocalPlayerSystem and LocalPlayerControlSystem use the tag component to find the local player. I think this is easier and less error-prone than having a LocalPlayer object that may or may not be in the correct state. The tag component can also be used for filtering events.
Draft, input needed before further work is done.
Tested locally but not with local multiplayer server.
How to test
Not yet.