pwmarcz / autotable

An online mahjong table

Home Page:https://pwmarcz.pl/autotable/about.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bugged wall (trying to flip doras and things got weird)

joshk0 opened this issue · comments

Hello! We love your project and have been using it to play "potluck mahjong" (riichi mahjong except everyone gets to make up a rule before play begins.) It's something hilarious and it's only possible IRL or on autotable (forget tabletop simulator, I am so beyond that now... yours is better)

BUT, we hit an interesting bug. It is hard to describe but you should just watch here. Twitch recording. After some frantic dragging and highlighting and dragging some more, somehow the bug went away.

It occurred while trying to flip dora, about 22:xx UTC-4 on October 5th, table Y7E4T - if you do have historical telemetry of the games.

Hope this bug report is useful, sadly I'm not sure we'd be able to help reproduce for you, but if there is any more information you might need to diagnose the problem, just let me know!

What's the timestamp on the twitch recording for the bug?

Hi @joshk0! I did notice the streams linked from Discord. It's great to people enjoying the game, and I'm happy the engine has been so flexible to enable games like that.

I do see the problem (for the record, it's around 6:38:00 in the video). No idea about the details yet (I don't have any detailed logs server-side), but it looks like it's enough for a single player to trigger it (as opposed to some conflict between players?) Just thinking aloud here; anyway, I'll be trying to reproduce it.

@riichinomics I see you've spent some time with the code, maybe you have some idea? Your fork is impressive, BTW, hope you had a good tournament.

It looks like the unmoving tile is still considered "held" by one of the players...

This looks like part of a series of bugs related to the fact that the client waits for the server to send it updates about whether it is holding something or not. This is a benign version, where the kamicha has clicked on a tile and it has become 'selected'. They fixed it by making another selection.

We found some issues after starting our own server, such as tiles in your hand flickering when you rearrange them, or tiles becoming 'locked' where your client thinks it is no longer holding the tile, but the other clients think that you are, so you can no longer let go of the tile and no one else can pick it up. One simple consequence of this is that if you click a tile in the original client it will become 'selected' and only once you select something else will it become free. This is emergent behaviour and not an explicit feature.

I solved these issues by preventing the server from sending updates back to a client that is sending them, and immediately updating local world state when you send updates to the server.

This is not the ideal server architecture because the server should be a source of truth in some regard, but there's no real logic on the server so whatever order the client applies the events from the server is what the view of the client becomes.

Related commits:
riichinomics@060ec25
riichinomics@8cd5577
riichinomics@c91e6b6
riichinomics@2a998d8

They're a bit messy and there's probably a bit missing, but you get the idea.