Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Client-side actors exhibit bizarre behavior after force states #71

Closed
floralvikings opened this issue Oct 25, 2013 · 13 comments
Closed
Assignees
Milestone

Comments

@floralvikings
Copy link
Owner

Client A

Client A walks toward edge of earth, is corrected to prevent invalid locations.

Client B

Client B perceives A walking to edge, and forcing. Afterward, A's apparent position is wildly different from the correct position while moving. This is likely caused by an incorrect reset of state when Client A is forced.

@ghost ghost assigned floralvikings Oct 25, 2013
@floralvikings
Copy link
Owner Author

Going to have to test the Tankolution demo again to double check this; will get on it asap.

@floralvikings
Copy link
Owner Author

This bug is definitely still an issue. Basically, other clients see a moving client's position as far over-corrected while the client is moving, but it quickly corrects to the proper position when an idle state occurs. I'm thinking that this is an issue on the clients that aren't moving, not properly setting steps taken when an actor is forced.

@floralvikings
Copy link
Owner Author

This currently appears to happen when a client actor is moving diagonally and is forced to stop. What's strange is that it doesn't seem to occur when the actor is moving in a cardinal direction and is forced to stop.

@floralvikings
Copy link
Owner Author

Even stranger, this only appears to be occurring if the forced state is caused by moving to the "west" edge of the world, and moving diagonally. Testing to see if this is true of the "east" edge as well.

@floralvikings
Copy link
Owner Author

Yup. Also occurs on "east" edge. And the longer the client attempts to force against the edge, the more the correction is offset.

@floralvikings
Copy link
Owner Author

Well now it seems to be happening no matter what edge is forced...

@floralvikings
Copy link
Owner Author

Moving out of and back into visible area seems to reset the corrections

@floralvikings
Copy link
Owner Author

Also seems to only happen if the state was already forced when the client tried moving to another invalid location. I think this is the key to the issue, I'm just not sure exactly how.

@floralvikings
Copy link
Owner Author

  1. Client Moving toward wall
  2. Client Forced to stop, server state changed to "idle".
  3. Client Stops trying to force, sends "idle" state change request.
  4. Server State is changed to "idle" even though it was already idle
    • Could this be causing the problem?
  5. Client tries to force against wall again, sends state change request.
  6. Server gets state change request, changes actor state on next update.
  7. Server actor is immediately forced, state changed to idle
    • Maybe there's an error in the timing of forcing the state, or counting of forced steps? I'm thinking that maybe the forced steps aren't being counted properly.
  8. Other clients see client forced to stop
  9. Client moves away from wall, sends state change request
  10. Server changes client state, broadcasts state change messages
  11. Clients see massive jumps while player is moving, but immediate jumps to correct position on idle

@floralvikings
Copy link
Owner Author

Think I found the problem. Steps taken aren't being incremented when correcting the state fails.

@floralvikings
Copy link
Owner Author

Going to overhaul the step function.

needStateChange = overStepped > 0
isMaxCorrect = overStepped >= MAX_CORRECT
if needStateChange
    successfulCorrect = correctOverSteps(overStepped);
    if not successfulCorrect
        forceIdle
    resetState
successfulStep = stepForward
if not successfulStep
    forceIdle
    resetState
stepsTaken++;

@floralvikings
Copy link
Owner Author

It's looking more and more like this is being caused by extra steps being added to the server-side actor when states are forced

@floralvikings
Copy link
Owner Author

Well. This particular issue appears to be resolved now. There is still a slight...issue...with the client position being properly reflected in the client. It's an extremely small discrepancy, and it only seems to occur when contacting a force at an indirect angle. Client actors representing server-side forced actors tend to lose a few units (in most cases less than 0.02). I'll try and get this patched right away but it's not being cause by the same problem as far as I can tell.

[EDIT]
As expected, this was caused by inaccurate rounding. Fixed by changing one line =D

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant