You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some thoughts on where this project could go next.
I think the priority should be to make the game playable. We are so close, I think there is just a few move states/events to hook up and then it is technically playable. From there where you go is up to you, but if I had time I would look at:
some CSS animations between states to add some polish
Of course the client will still need to send events to the server, this won't really change.
In case of reconnection the client will also need to obtain the state but this could be handled easily in a DOMContentLoaded listener.
I think this would drastically reduce the complexity of the app and stop us having to think about the socket server so much.
Use Socket.IO to handle the lobby
Socket.IO knows how many users are connected, it knows their name. We can add whatever we want to the socket.data property so I think we could use it to handle all the player joining/leaving functionality. This would make the Lobby model and machine redundant which would simplify things quite a lot. I think this could take inspiration from the socket.io private messaging guide
Rip it up and start again
When we started this project we didn't know much about Bun, Websockets or state machines/X State. We muddled our way through to get where we are and I think it's a commendable achievement. Now we know a thing or two how would it look if we redesigned the app from the ground up? Maybe you could start a new game.
The text was updated successfully, but these errors were encountered:
Some thoughts on where this project could go next.
I think the priority should be to make the game playable. We are so close, I think there is just a few move states/events to hook up and then it is technically playable. From there where you go is up to you, but if I had time I would look at:
socketServer.ts
Detailed below.Reducing the amount of events sent over the socket
I think we should be able to just send state changes to the UI with the context and have the UI decided what to do. EG: -
In the server:
And then in the model's constructors:
You could add another parameter to say which machine the state change is coming from.
Then in client can just be:
Of course the client will still need to send events to the server, this won't really change.
In case of reconnection the client will also need to obtain the state but this could be handled easily in a
DOMContentLoaded
listener.I think this would drastically reduce the complexity of the app and stop us having to think about the socket server so much.
Use Socket.IO to handle the lobby
Socket.IO knows how many users are connected, it knows their name. We can add whatever we want to the
socket.data
property so I think we could use it to handle all the player joining/leaving functionality. This would make the Lobby model and machine redundant which would simplify things quite a lot. I think this could take inspiration from the socket.io private messaging guideRip it up and start again
When we started this project we didn't know much about Bun, Websockets or state machines/X State. We muddled our way through to get where we are and I think it's a commendable achievement. Now we know a thing or two how would it look if we redesigned the app from the ground up? Maybe you could start a new game.
The text was updated successfully, but these errors were encountered: