Jump to content
  • Advertisement
Sign in to follow this  
MeltingIcecream

Design considerations for a 2D multiplayer game.

This topic is 757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm about to start writing a 2d sidescrolling game. Are there any design considerations I should take when creating the game to support networked-multiplayer? For example, If I have a TileMap type, which "glues" together the physics and everything else, I would need an MPTileMap type which wouldn't run physics, just use data from the host. But then I'm implementing a tilemap twice. There's gotta be a better way, right?

 

Note: I doubt this matters for this question, but I'm going to be writing this game in c# with MonoGame.

Share this post


Link to post
Share on other sites
Advertisement
If you use object oriented design (which it sounds like you do) then your current TileMap sounds like it doesn't follow the "single responsibility principle."
A more factored design would be to have a TileMap that maps 2D coordinates to environment info (to use for rendering and simulation.)
Separately, you have a Renderer that uses the TileMap to figure out what to render, and you have a Simulator that uses the TileMap as a source of what the physics environment is.
You'd probably have a separate World which contains the Actors (players, projectiles, monsters, etc.) The Renderer and Simulator would know how to talk to both the World and the TileMap.

So, on your client, you would have a Renderer, a World, and a TileMap. The World is populated/driven by the incoming network packets.
On your server, you would have a Simulator, a World, and a TileMap. The World is populated by scripts and logged-in players, and updated through Simulation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!