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

Don't send CharacterMoveInputEvent if I don't input anything #4993

Open
jdrueckert opened this issue Jan 25, 2022 · 5 comments
Open

Don't send CharacterMoveInputEvent if I don't input anything #4993

jdrueckert opened this issue Jan 25, 2022 · 5 comments
Labels
Category: Performance Requests, Issues and Changes targeting performance Status: Needs Discussion Requires help discussing a reported issue or provided PR Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Improvement Request for or addition/enhancement of a feature

Comments

@jdrueckert
Copy link
Member

Motivation

During a debugging session I noticed, that the LocalPlayerSystem sends a CharacterMoveInputEvent every tick, even if I'm not pressing any key and not moving the mouse at all.

See https://github.com/MovingBlocks/Terasology/blob/develop/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java#L175-L176

This does IMO not only create a lot of unnecessary events that might negatively impact, but it also creates a lot of "noise" and makes it harder to debug.

Proposal

Exit early from LocalPlayerSystem#processInput if there is no input, e.g. no keyboard input creating movement and no mouse or VR input creating view rotation.

My hope would be that this improves performance and reduces unnecessary noise.

@jdrueckert jdrueckert added Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Status: Needs Discussion Requires help discussing a reported issue or provided PR Category: Performance Requests, Issues and Changes targeting performance Type: Improvement Request for or addition/enhancement of a feature Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness labels Jan 25, 2022
@jdrueckert
Copy link
Member Author

@pollend @keturn @DarkWeird I have no clue whether or not this is a low-hanging fruit - might be. If I missed any other inputs this might try to process, I'd be interested to learn which.

@keturn
Copy link
Member

keturn commented Jan 25, 2022

This does seem worth looking in to. Good catch.

#4586 may have some other ideas to keep in mind while working on this.

@DarkWeird
Copy link
Contributor

Irc, CharacterPredictionSystem send this event too. Noticed for mob, while working with FlexableMovement

@skaldarnar
Copy link
Member

A wild guess on this: gravity on characters seems to come from apply downwards pull on every (affected) movement event. Therefore, might it be necessary to send "dummy no-change events" just to have the gravity be applied to characters each tick?

And since we only do this repeatedly for the player characters, NPCs are affected by gravitiy as soon as they move (e.g., walk or jump), but are not affected by gravity if just standing around... 🤔

@jdrueckert
Copy link
Member Author

That actually makes sense 🙈 I would argue that this should ideally be done separate from actual movements, but guess it's quite entangled at the moment and hard to "unfiddle"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Performance Requests, Issues and Changes targeting performance Status: Needs Discussion Requires help discussing a reported issue or provided PR Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

No branches or pull requests

4 participants