There’s some progress! Since I first started coding this thing it went through a lot of changes:
I ditched Redux and redux-like states on server-side. That was probably already mentioned in the last post. Generally I need to focus on mutations, not replacing the whole state with every tiny change (immutability).
I ditched React for client-side rendering. I wanted to have some nice animations which would move the cards from one place to another. That worked quite well until I then needed to position everything around the circle + around each player in a game screen, where you don’t know the exact number of players upfront.
But let me take a few steps back and remind myself about the last time I wrote anything on this blog.
Structure, and how to send it to browser
On server most of the objects have a reference to its
parent element. This will help me decide ownership of each object and position in the game. Some cards may be held in hand, others may stay in deck of cards, and each of those containers may belong to a Player. The root object in my structure is still some imaginary “root”, because some object may just be lying on the table. Neutral and not belonging to anyone yet.
The problem appeared the first time I tried to send that data to the client. Server shuts down with stack overflow error.