Jump to content

Client and server disagree on oceantree growth stage


chaosmonkey
  • Fixed

When growing from an oceantreenut to oceantree_short, the client jumps to oceantree_tall meanwhile the server correctly has oceantree_short.

I believe this is due to the server check (it not TheWorld.ismastersim) returning too early in the oceantree constructor before growth stages are properly configured.

 

Edit: solution in comments below.


Steps to Reproduce

Drop an oceantreenut

Wait

Game will erroneously show an oceantree_tall, but a remote print(c_select():GetDebugString()) has oceantree_short as expected.

Alternatively, spawn any kind of oceantree_short, _normal, or _tall and they all appear _tall on the client.




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

After some experimenting, the problem seems more that the client defaults to the tall animation regardless of the actual growth stage of the tree.

Share this comment


Link to comment
Share on other sites

Alright I think I have a pretty good understanding of the issue now. TLDR, I think this can be fixed by moving the random stage selection to the server instead of the client and by having short/normal/tall oceantree share an animation build/bank.

Now for an explanation.

When we c_spawn("oceantree_short"), the server actually runs the constructor for oceantree_short. However, the client runs the constructor for generic oceantree. The client then selects a random stage, meanwhile the server selects stage 1. With other tree types, the server is doing the random stage selection for a generic tree, and the client gets told by (i believe) the growable component, and the issue doesn't occur there. oceantree constructor does a roll on the *client* in order to set the animations since each growth stage has an independent file.

Back to the oceantree_nut. When the nut grows, this is effectively doing a SpawnPrefab("oceantree_short") on the server, but then this issue happens on the client.

  • Like 2

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...