m-byte918 / MultiOgarII

A continued version of the original MultiOgar, an open source Ogar server implementation written with Node.js.
Apache License 2.0
126 stars 131 forks source link

Make player cells always visible for their owner (possibly fixes #1550) #1551

Closed uWynell closed 3 years ago

uWynell commented 3 years ago

The possible fix for #1550

Borys64 commented 3 years ago

Hey, thank you for your contribution. However, it seems that your solution would result in a heavy performance drop (when there are more than the standard, 16, cells involved). I will keep this open in case you update your pull request.

Tombez commented 3 years ago

Thanks @uWynell! I think I found a faster way to accomplish the same thing. You can see it 5716c506ddc5bf03df9ffda657f004f51f166d81 in this commit. Please tell me if you think it's acceptable.

For an English explanation: When we check cells that are no longer in the viewbox but still are on the client, we check whether that player is the owner of the cell, and if so, we put it in the updNodes array instead of the eatNodes or delNodes arrays. And we also need to add that cell to the viewNodes array because that array becomes the clientNodes array at the end of the function. If we didn't add it to the viewNodes array, then next tick the server would forget that the client still knows about that cell.

uWynell commented 3 years ago

closing in favor of 5716c50