6

Hey ya'll back with another college boi question.

I want to develop a web server akin to that of jackbox/among us. Where each session has like an 'ABCXYZ' style code, and i assume are using TCP sockets on the back end.

I'll be writing in Go cause I <3 Go and its a chad language. Anywho, am i supposed to spin up a new websocket server each time someone wants to make a room? Or do i have one websocket server and some sort of map of rooms.

gameRooms := map['id_string']clients

Anyone have any suggestions for this?

Comments
  • 2
    I'd do one server with a key mapping a game instance and put hosting the game instance on a player in that room, like the party leader. Make the server agnostic so you can drop it out for a different style if you want to experiment.
  • 2
    The best advice I could give is to do some experimentation with something simpler like a tic tac toe client and server.

    That way you can focus on thing that are required for playing a game online

    Such as
    - game lobby
    - matching
    - Eli system
    - communication protocol

    In the past I've had an assignment to make Othello/reverse Client + server and our code was easily extendable for other turn bases games like chess, checkers, tic tac toe.

    At the end of the semester we even hosted a AI tournament with a server hosting the matches and all teams joining with their own client which had the option to use the ai

    Point is start simple and extend on it
  • 1
    As for your your question, you have a socket for every client that is connected to the server

    The client is usually takes the initiative for the connection therefore your server needs to be live.

    It's smart to have a single server with sockets for communication between server and a client

    The client needs to maintain a state specific to that client, while the server needs to keep a state of basically everything.
  • 1
    I probably still have the diagrams and repository of this old project. Let me know if you want them
  • 1
    @wiwe2210

    Wow thanks for the awesome reply! I think it might help me to check out the diagrams and repo, so if it's not too much to send over i'd love to take a look. I definitely want to make it highly extensible cause i have a few board games i've been wanting to make web versions of to play in quarantine.
  • 2
    @vomitmachine

    okay that's what I was leaning towards but wasn't sure hence the post haha. Thanks for the reply, gonna try to crack out this project now :D
  • 1
    @energy-vampire Maybe also make a master server for showing active lobbies. And in case if game has web version, make room invitation links?
Add Comment