Jump to content

Handling local multiplayer for a networked multiplayer game


Conway Hu
 Share

Recommended Posts

Hello,
 
I'm currently trying to make a networked (client/server) multiplayer game with an option for local multiplayer, where the game is hosted directly by the client so that people can play against each other on the same screen. In my original GameMaker prototype, I did this by maintaining two separate copies of the game logic for each mode (local multiplayer in GML and networked multiplayer in javascript/nodejs). This seemed redundant, so for my current html5 version, I figured a better approach might be to place the game logic in a "shared" folder on the server, and then have that be served to the client using express-js. That way, both the local mode and the networked, server-side mode derive their game logic from the same source.
 
Is this the right approach? And if so, are there specific tools other than express-js that I should be using to achieve this?
Link to comment
Share on other sites

On 1/2/2018 at 1:05 PM, kurhlaa said:

How does it look like? :) 1 monitor and 3 people on the same keyboard and moving the same mouse? 

Hahaha. My game's turn-based so nothing awkward like that.:P

Anyways, I did some more research and I ended up answering my own question. This article (http://buildnewgames.com/real-time-multiplayer/), which I initially discounted because my game is turn-based rather than real-time, turned out to be the reference I needed because it shows an example where both the client and the server require a copy of the gameplay code. I'm glad to see it really is as simple as serving a shared file via express!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...