r/gamedev • • 5d ago

Question online multiplayer

hey folks, very new amateur game dev here. ive made a few things on game maker studio, some following tutorials and some on my own, but nothing too big. for a next project i really want to make something i can play online with friends. i tried implimenting online multiplayer in a previous game but really struggled. this new project wouldnt have to be low latency, im thinking some sort of turn based strategy game. any suggestions on a platform that has a simple path to making an online multiplayer game? any tips are greatly appreciated. thanks!

4 Upvotes

13 comments sorted by

4

u/Yanomry 5d ago

Adding Multiplayer to a game is very difficult, there is no easy turn on the multiplayer button, you have to engineer the game very specifically for multiplayer or it will not work at all, working on even simple multiplayer is an very advanced topic, I recommend following a tutorial of some active game (not turn based because that's a lot harder than you might imagine) maybe a friendslop game? Also AI is very good at breaking down verbose documentation into understandable concepts even if you don't use it for coding I highly recommend it for this purpose, just be aware of potential haluncinations and be sure to fact check it and you'll be fine.

1

u/No-Pollution7797 5d ago

For turn-based with friends I'd skip netcode entirely and treat it like a small website. The game state lives on a server, each player sends their move as a normal web request, and the client just asks every few seconds whether anything changed. No sockets, no port forwarding, and nobody has to host.

The nice side effect is that your friends don't have to be online at the same time, which matters a lot once everyone's schedules drift apart. One thing I'd do from the start is have the server check that a move is legal and that it's actually that player's turn, because even among friends a double click or an old tab left open will send strange things. GameMaker can make HTTP requests, so you wouldn't even need to switch engines.

1

u/MythpipGames 5d ago

Before the strategy game, I'd make two clients take turns adding one to a shared counter. Then close one client, reconnect, and check that it gets the current number and whose turn it is. That gives you a small networking project you can actually finish without debugging game rules at the same time.

1

u/LividChef1165 5d ago

Since you already know GameMaker, I'd make the tiniest version there: two friends, one shared board, one legal move each. Then close the game and see if you can come back to the right board and the right person's turn. That's a pretty good first milestone.

1

u/NoWayHereWeDoh 5d ago

I've been using Unity and Fusion for my last few games and at first it was incredibly overwhelming. I'd still recommend it as it is a good starting place. There are many online tutorials and you can get a starter asset for it so you just get going. Implementing something you are wanting wouldnt be incredibly complex.

1

u/aaronsuns 5d ago

For turn-based games, sending the full game state after each move is usually simpler than syncing individual changes, and a turn counter or version number on that state lets each client quickly tell whether its copy is stale. If your strategy game has randomness like dice rolls or card draws, generate those results on the server and send them out, because if each client rolls its own, the boards will drift apart. Keeping the rules check in one function that both the sender and the receiver call also helps catch bugs early.

1

u/AncientAdamo 5d ago

Check out colyseus and don't be afraid to use AI for you research and understanding how to implement.

1

u/08148694 5d ago

You need to build multiplayer from the start, it’s extremely difficult to add later

Split your game into 2 separate programs. A server (holds all game state, handles all state changes, serves game state to players - but only the state each player should see). Runs on a cloud server or player machine, but player-ran servers might need some home networking config (port forwarding etc), but steam can help with this if you use their libraries

And a client - sends user interactions to the server, receives state from the server, renders the game from the state. For real time games you’d also need a local prediction model in the client so it guesses what the next frame state is in between server state updates, but not needed for turn based

1

u/RustRoadsIO 5d ago

Best advice I ever received from a fellow developer: start with deterministic multiplayer. It makes things much easier to reason about, especially for turn-based games. Instead of constantly syncing the entire game state, both players run the same simulation based on the same inputs, keeping everything in sync.

2

u/dota2nub 5d ago

Just add rollback! EZ!

lol

1

u/mrz33d 4d ago

For a turn based game you can try cloudflare workers.
They have very generous free tier, and with the amount of docs they are producing it's really easy to vibe code a solid starting point.

0

u/Zealousideal-Bat4809 5d ago

Turn based makes it easier, you only send the move instead of syncing everything. For a small Godot project I posted each move to a tiny server and replayed the list of moves on the other side, held up fine with a second of lag. Godot's high level multiplayer is worth a look but the replay approach was simpler.

2

u/yortflops 5d ago

I've started using this as a basis, and it's absolutely incredible. The guy did a full youtube explanation of how it works, really great stuff.: https://github.com/bearlikelion/cooties