WardMaes / hive

The Hive Pocket game
https://hive.wardmaes.vercel.app/
2 stars 0 forks source link

Disable movement when no queen on board (+ rework related syncing) #21

Closed WardMaes closed 3 years ago

bestrandomnameever commented 3 years ago

Problem arises from the fact that each syncing action does not advance the opponents machine. It simply updates the context. The opponent is only blocked from doing anything in 'selecting' because it entered that state with a 'currentPlayer' switch. So the UI prevents him from making a move (playerToMove(Cell.tsx:30)). This changes when sync sends an update with an updates 'currentPlayer'. But the machine has of course never left the 'selecting' state so it doesnt reload with 'setCellsAllowedToMove' and its most current cells are the "cleaned" ones send by the opponents last move.

I would like it best if the current player would send every generated event through p2p to the opponent so that it's machine can follow the process (I think this would be the cleanest).

Other, MUCH SIMPLER solution is:

bestrandomnameever commented 3 years ago

Opted for second solution

WardMaes commented 3 years ago

@bestrandomnameever fixed?

bestrandomnameever commented 3 years ago

@WardMaes actual movement bug is fixed with second approach. Also want to further rework syncing but will move that to clearly seperate issue.