Open alessiodam opened 3 months ago
Hey @tkbstudios, I definitely plan to add multiplayer. I don't know much about setting up a game server like this though, would you mind sharing some tips on how you would do it so I can look into it more? Thanks!
Set up a TCP socket and echo data. You can use Go. Then you'll do it on your own, once you understand TCP, multiplayer will come on its own.
I've given this some thought. I'd like to implement a mode similar to Tetris99 but with 5 players. You will be able to see the opponents' game information on either side of your own game. When you clear a line "waste" minos will be sent to the bottom of a random players' matrix. This is obviously not set in stone and will likely change as the game mode evolves.
I am still considering which approach to use:
I am leaning towards the SSH approach as this game is unlikely to become popular enough for people to want to play remotely. It will take a lot less work from me than setting up and maintaining a long-running game server.
Multiplayer will be such a good thing!
I think, P2P is best way to implement it. Something like libp2p can be used to do this, it also has implementation in Go.
Thanks @zabojeb. I haven't done any work with P2P networks before. I'll spend some time experimenting with the Go libp2p library.
Use P2P but use a server to make the lobbies. This will expose player IPs, I propose rather making a websocket server in Go to handle all of that. This will not expose the player IP and will not allow for modding/hacks by the client.
Another approach is making the lobbies on the server and just repeating received information to all the client without checks. This will allow mods/hacks by the client in case you want that. Honestly, use websockets and validate the data to prevent cheats. I'd also suggest using JSON for the websocket and user accounts on the server to store stats (username&password, no email, anonymous) please don't use UUIDs as a primary key, I beg you.
Making a websocket server in Go has never been so easy. I use gorilla/websocket with gorilla/mux and all I can say is that it works flawlessly for me.
Please allow easy self hosting and server address change in the client. Add a menu to select what server to play on. For example:
{
"servers": {
"0": {
"name": "local server",
"protocol": "ws://",
"host": "localhost",
"port": 8000,
"password": null,
"credential_id": 0
}
}
"credentials": {
"0": {
"username": "testuser",
"session": "sessionstr",
"valid_until": 1724831714
}
}
}
sessionstr please a-Z 0-9 128 characters. I hope this comment helped you out ;)
Updates 😢?
Hey @alessiodam unfortunately I've been busy with work so development has slowed down. Before stopping I had a chance to play around with SSH, P2P, and WebSockets.
I've decided that I definitely don't want to worry about TCP NetCode, and SSH seems to be the simplest UDP approach thanks to the Wish package from Charm.
When I have time to continue development I will update this thread with any news :)
Alright :) I guess you could use SSH. I never did, I'll definitely get a look at the Charm Wish package!
So nice! Please add multiplayer. You know like Tetris 99 online? You play with 99 other players with the exact same game. A simple server is possible to be made and shouldn't be that difficult ;)