• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Single to Multiplayer

L

Linkx357

Guest
I've made a shooter game and have started watching networking tutorials for the multiplayer portion. So I'm wondering how difficult it would be to transform my current single player game into a networking multiplayer game using TCP? Will I have to recode most of the game, or is building a client into my existing project and coding a server file for it easier than I'm thinking? Just wanting some professional advice/opinions about it before I take the dive in a wrong direction. Thanks.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Sorry to say that this is an impossible question for anyone to answer really... it depends on a great many things, like what data you want to send, how your game (especially movement) is coded, how skilled you are personally... I mean, @YellowAfterlife added networking to an early version of my game in about half an hour, but if it had been me doing it I'd have taken weeks. :)
 

Fabseven

Member
If you didnt code your game for multiplayer from the start it may be impossible.
You better polish your game and when you are done restart a new project with multiplayer from start.
 

Jabbers

Member
The rule of thumb is that converting a game from single player to multiplayer will usually require a major rewrite if you are already deep into the development, and it is easier to start from scratch. This is probably true in your case, given you created a shooter game (which require clever coding, because even mild latency can upset the accuracy of fast paced combat games)

This question gets asked quite frequently, and this is what I wrote in a similar topic:

It isn't until you understand how a multiplayer game is designed at code level that you can see why retrofitting multiplayer into a single player game is impossible in most cases, or will require so much work that it is better to start from scratch.

For example, in a single player game movement code is fairly easy. Press a key, move the character. In a multiplayer game you want the server to calculate the movement (a standard technique is to send start / stop triggers to the server, NOT spam X / Y co-ordinates) and you need to account for latency, for having all clients see the player move, for having new players see the character at the right place when they join the game, for accuracy of movement (using prediction techniques) which is very important in fast paced combat games, server-side collisions to make sure a person isn't cheating, and factoring in delta time to reduce the rubber banding effect. You basically have to write the player movement from scratch. This doesn't even cover things like swapping inventory, opening doors, and all the small things in single player games that require more attention in multiplayer games.

Although you might choose not to rebuild your current game, you should definitely consider it for your next project.
 

Xer0botXer0

Senpai
Ive had to rewrite my project from scratch because of the confusion caused by trying to convert it.

Im sure if I was adept at gml I would have been able to do it, but it felt tedious.
 
L

Linkx357

Guest
Thanks for the advice everyone. That gives me a better feel of what lies ahead.

Have you all checked out SlasherXGAMES network tutorial on youtube? His looks like the best fit for learning what I want to do with networking. Or can you all recommend some better videos for networking a topdown shooter for multiplayer?
 

Jabbers

Member
I'd recommend finding a tutorial that teaches you how networking works in GameMaker, instead of looking for a video or tutorial that will give you code and tell you how to create X type of multiplayer game. If you understand how networking works in GameMaker, you can create any type of multiplayer game you want.
 
D

dj_midknight

Guest
I'd recommend finding a tutorial that teaches you how networking works in GameMaker, instead of looking for a video or tutorial that will give you code and tell you how to create X type of multiplayer game. If you understand how networking works in GameMaker, you can create any type of multiplayer game you want.
This is probably the best advice. My partner has been making a custom server software for about a month, and coming up with parallel ways to mimic whats going on it the GMS room in Java. However, now we have a standardized design for our packets, per user encryption and digital signatures, and a clear design for how to setup command packets in any game we decide to design. We did a bunch of research on reliability of UDP, and have opted that for our communication as it tends to be faster, and in general a single game packet getting lost likely wont change the outcome of the game too much, but have built in methods for requesting resends for any thing that does require confirmation. We even went so far as to make a cross platform secure random number generator so any games that we do random spawning or anything that we also need to run a simulation on the server to ensure integrity we can perfectly mimic that behavior.
 

The-any-Key

Member
Most finished single-player games can add multiplayer afterwards. But you will always have to change some stuff. Topdown game is easier than a platformer (moving platforms is all network coders nightmare). Ex the YoYo RPG engine nor Rupecks platformer engine was designed for network play. But you can add network multiplayer too them. This is because both engines got clean code and got an easy-to-add system. Ex if you want a new health potion in YoYo RGP you can just duplicate a script, change it a little and you got a new health potion.
Why do this system benefit network? You could code items into your player object or create a big chunk that handle everything. But that would make things very hard. Because everything is handled differently in multiplayer games. The player objects need to be synced and handled in a specific way. Your items need to be handled i a different way. Your enemies is handled in the third way .... and so on.

So make everything in the game easy to add more off.

Another tips is to add a player 2 controlled character early in the game (local co-op). This will force you to code the game itself to handle more players. This would help you later if you decide to add network.
 
Last edited:

dphsw

Member
You can start by making your game work with a bit of a server-client mindset even while it's running in single-player mode. As a simple example, if you have a object for your player, it shouldn't contain the controls - a separate object can check the controls, and your player object can ask that object what the controls are when it needs to know. That way when a player is running over the network, the player won't really need to change - the only thing that will change is, instead of asking for controller data for an object that was checking the keyboard/joystick, it will ask for that same data from an object that got controller data over the network from another player somewhere. The player object can be running the same code either way. If your whole program is written in this fashion, then adding network capability at least won't require you to go digging through your program rewriting stuff.

Of course, it will still be awkward. Networking is always awkward. It's awkward just getting my two home computers to share files - we usually end up using Dropbox, ironically using a worldwide internet connection to send files to a computer that's on my LAN. But it will be about as simple as you can make networking be.
 
Top