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

Simplified movement logic in the GSP #145

Merged
merged 4 commits into from
Jul 7, 2020
Merged

Simplified movement logic in the GSP #145

merged 4 commits into from
Jul 7, 2020

Conversation

domob1812
Copy link
Collaborator

This implements the changes to movement logic suggested in #135. Instead of doing path finding in the GSP, waypoints set in moves must be in one of the six hex principal directions of each other, and then the GSP just moves along that straight line.

Related to this, the character gamestate JSON object no longer holds the steps, as they are not needed anymore. The findpath RPC method has no wpdist argument anymore, and instead outputs waypoints such that they are in principal directions rather than with a certain spacing.

This change should have only a minor impact on gameplay, but it shifts path finding entirely to the client (one of the effects is that paths will not be planned around other characters, while they previously were to some extend; only when the blocking characters were stationary, though). It improves movement performance by about 4x according to the benchmarks, which should greatly help wtih syncing performance (the new bottleneck of movement code is now the database update for moved characters).

domob1812 added 4 commits July 6, 2020 14:12
The new function checks whether or not it is just a principal direction
(although perhaps multiple unit steps) from one coord to another.  This
will be used in a simplified movement code.
Instead of spacing the waypoints by their distance (using the wpdist
argument), space them such that there is a principal direction between
each pair of waypoints.

This is what the GSP will need after the next change, which will simplify
the consensus-relevant movement code to not use path finding itself.
This adds a new helper method to the Character class in the integration
tests, which does a findpath call to obtain the path towards a given
target and then sets it as waypoints.

This decouples test logic that just needs to do some movement (without
caring about the real specifics) from how the waypoints need to be
specified (e.g. in principal directions).
This revamps how the consensus-layer movement logic works in the GSP:
Instead of doing path finding in a local range, we expect the waypoints to
be set in principal directions from each other (but with arbitrary distance).
Then we simply try to step along that path.

This implements the idea described in
#135 and will make movement
processing (which has been the main bottleneck in the past two competitions)
much faster in the consensus code.  (Path-finding still needs to be done,
but only client side to come up with the waypoints to send in a move.)
@domob1812 domob1812 added game Something related to the game logic performance Something related to improving performance interface Something related to the RPC (or other) interface cleanup Code cleanups / refactorings labels Jul 7, 2020
@domob1812 domob1812 added this to the 0.3 milestone Jul 7, 2020
@domob1812 domob1812 linked an issue Jul 7, 2020 that may be closed by this pull request
@domob1812 domob1812 merged commit 3cdf59f into master Jul 7, 2020
domob1812 added a commit that referenced this pull request Jul 7, 2020
Simplified movement logic in the GSP
@domob1812 domob1812 deleted the new-movement branch July 7, 2020 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code cleanups / refactorings game Something related to the game logic interface Something related to the RPC (or other) interface performance Something related to improving performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: Move only along principal straight lines in the GSP
1 participant