jespertheend / splix

MIT License
21 stars 6 forks source link

fix(gs): Send player info immediately #133

Closed splixcord closed 10 months ago

splixcord commented 10 months ago

Fixes seeing yourself as a red unnamed player for a short moment when spawning

jespertheend commented 10 months ago

I don't think the issue is fixed? When I add a console.log message inside the sendPlayerState and sendPlayerSkin it still logs the player state before it sends the player skin.

splixcord commented 10 months ago

It does still send position before skin/name but it's in the same tick so a player can very rarely be seen as red unnamed for maybe one frame, though it is a different issue about websocket messages having a tiny delay. This PR solves the issue of own player staying a red unnamed until you pass the first whole block or do a movement, which lasts longer due to not being in your own viewport.

jespertheend commented 10 months ago

This PR solves the issue of own player staying a red unnamed until you pass the first whole block or do a movement

Ah I see, that makes sense. I noticed that before this change it was also sending two messages. So it's definitely an improvement either way. I wasn't able to reproduce the missing skin locally, but I think this LGTM for now.

Ideally it should send the messages in the reverse order, but that can be added later. I think the the client should be able to handle it because it doesn't render players until their position has been received it seems.