o3de / o3de-multiplayersample

Multiplayer sample project for the Open 3D Engine
https://o3de.org
Other
79 stars 56 forks source link

Chaining RPC calls don't function as expected in response to player health event #178

Open allisaurus opened 2 years ago

allisaurus commented 2 years ago

Describe the bug During the course of trying to implement https://github.com/o3de/o3de-multiplayersample/issues/148 , could not get player position/armor/coin updates to take effect via call to Server-->Authority RPC on NetworkMatchComponent. However, the same logic does work when the corresponding controller directly implements PlayerMatchLifecycleBus::Handler

Steps to reproduce Steps to reproduce the behavior:

  1. pull down https://github.com/allisaurus/o3de-multiplayersample/commits/respawn-rpc
  2. build server& game launcher, then run editor
  3. hit ctrl + g to play game, stand in front of energy cannon to deplete armor.
  4. when armor reaches 0, observe NetworkMatchComponent::OnPlayerArmorZero(...) fires and calls RPC_PlayerArmorZero(playerEntity)
  5. no changes to player position or resources are observed.

Expected behavior Player would respawn with full health and diminished coins on call to HandleRPC_PlayerArmorZero()

screenshot of log of handle method firing on server image

Actual behavior Player doesn't respawn and to effects to player resources are observed.

Assets required Code that repros problem here: https://github.com/allisaurus/o3de-multiplayersample/commits/respawn-rpc

Found in Branch built off of https://github.com/aws-lumberyard-dev/o3de-multiplayersample/tree/GameJam_2022_07

Desktop/Device (please complete the following information):

Additional context A similar call pattern is made in response to PlayerActivate in this component and seems to work. Unclear if there's a substantive difference in event origin or anything else that'd make this call path different in some way.

lmbr-pip commented 1 year ago

Functionality has been fixed. @allisaurus is this still worth keeping open?

allisaurus commented 1 year ago

Not sure whether the current implementation is still using the "workaround" (directly implementing PlayerMatchLifecycleBus::Handler vs. calling RPC), I'd say worth keeping open until the correct approach is validated