Basic question making a singleplayer game multiplayer

Started by
3 comments, last by zfvesoljc 11 years, 7 months ago
Hi!

Well I just started studying some programming languages and I have some projects in mind, I don't want to start with a big thing, just something simple and fun, but in the future I would like to make some multi player projects.

So, I want to know if it is possible to make a single player game, and then turning it to online multi player once I have experience programming. If so, which are the recommended programming languages for doing it (I want to make a 2d online game, something like Don't Starve but kind of a mmorpg)

Also, I would like to know is it is possible to make a hack&slash game like old 2d Zeldas but multiplayer, I know almost everything is possible knowing how to do it, but I haven't seen a lot of quality online games like that, so I wonder if it is just not possible or too difficult.

Thanks! Sorry for my English smile.png
Advertisement
You can make most single player games multiplayer, however you have to be really careful how you approach your single player game structure. It is far easier to turn a multiplayer game into a single player game that vice-versa (think Left 4 Dead, that kind of stuff).

For example, how would you approach a player picking up something in the world, in the context of a multiplayer game. After all, you could have two players wanting to pick it up.

You can start with a server-client approach, which is by far the safest (versus peer-to-peer, where each player does whatever it wants). The server manages every objects (creation, destruction, updates, interactions), clients are basically just remote terminals that send requests to the server (request_pickup(health_pickup), request_pickpocket(jim_bob), ...). Think of it as a M.U.D., but not using console inputs ("walk_left", "walk_right", "pickup health", "eat rope"), but the game itself and player controls. It however requires you to structure your game accordingly.

Objects communicate with each other via messages (jim_bob->send_message(health_pickup, REQUEST_PICKUP), health_pickup->send_message(jim_bob, GIVE_HEALTH, 25)). That makes it easier to interact in a multiplayer environment.

Secondly, it gives you an opportunity to abstract the network layer (bascially 'simulate' how a real network would behave like). You can introduce random latency in your message delivery (put messages in a holding queue). You wouldn't want to do such a messaging system with out of order delivery, or considering packet loss though, so you can start with the assumption that messages will only get delayed arbitrarily, which is what TCP will give you.

The rest would be fighting problems inherent to networked games. In a gameplay perspective, it's mostly latency. You may want to look into lag compensation, client-side prediciton to reduce the impact of variable latency on the player interactivity. But packet loss, packets out of order, packet duplications, connectivity, all that jazz can be dealt with at the lower layer, outside the domain of the game management layer.

Everything is better with Metal.

Ok, got it thanks for your answer !
You can make any game multiplayer given enough time and talent. I dreaded dragging my 6 year old 150k line codebase (3rd game in the series) multiplayer as it was littered with rands, physics in the drawing code, and some other big no nos, but in the end it only took about 6 weeks to do it and was easier than I had anticipated.

Since it sounds like you are starting out I would do the most simple single player game that will meet your desire.

  • treat a singleplayer game as a multiplayer game with only 1 player.
  • if going with client/server approach, imagine server and client object running from two different processes/machines
  • as mentioned above, turning a single playergame can be done, but it's a PITA... I wouldn't do it again...

This topic is closed to new replies.

Advertisement