imalooney / t3tr0s

30th anniversary tetris in ClojureScript

Home Page:t3tr0s.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dashboard should update board if it's not displaying

oakmac opened this issue · comments

If Player A is playing during battle mode and switches his browser tab off of the game, the dashboard no longer updates his board.

bumping this; would really help with the new dashboard

Writing my thoughts here.

  • go-go-gravity! is updating the game based on a timeout (always running)
  • go-go-draw! is redrawing on requestAnimFrame (only running when seen)
  • board updates are only sent to server inside go-go-draw!

Need to just send board updates to server in go-go-gravity!

Sounds right. Basically we need to separate the game state logic from the rendering logic.

Ideally the entire application only has one state at any given time (boards, scores, chat, players, etc).

This gets continuously updated from one client to server, then from server to all clients via one method of transport.

Then it's up to the client to intelligently render the game state as appropriate (ie: based on what page you're on, requestAnimationFrame, etc)

Board updates can be emitted to the server as often as 60 times per second. Any change in the board will trigger an emit in the next frame. This works like requestAnimFrame, except it continues when the window is minimized.