HTML5 HTML5 Multiplayer

B

BobFish

Guest
Hello everyone (its great to be back on the GMC :)

I have been planning on making a smallish web multiplayer game in order to get a project completed as Its been a while since I last did that. I have some experience with multiplayer using windows but not with HTML5.

I made a thread on Reddit a while ago but apparently you can't 'do multiplayer' with HTML5 (the response I recieved). Is this true? Is there some workaround?

thank you.
 
B

BobFish

Guest
Of course, you can create multiplayer HTML5 games with GM:S.
This was what I thought. I thought it would be kind of silly if you couldn't. Is it simply the same as windows?
 
A

Aura

Guest
You'll want to write some Javascript for this. Client-side it's pretty easy, using websockets you can easily connect to a server by setting up a listen handle for a specific port and server URL. Websockets give you various events to work with such as on connect (when you connect succesfully to a server) or on message (when a server broadcasts a message to you).

Serve-side it's a bit trickier as you'll need to handle all players and transfer incoming data to other players depending on your game design. But here you also have a lot of functions to work with. You can write a server in any language you want really, but Javascript servers have become very easy using NodeJS. Either ws or socket.io are great to use with NodeJS, and it's not too difficult to write your own server that way. You'll then need hosting, which isn't as simple as regular webhosting, but it's available and you can of course run your own NodeJS server.
You'll then need to build a few JS extensions to call (and callback) the multiplayer JS-functionality from GM and you'll need to do some callbacks as well. This is probably the easiest part, though. The big part is writing the Javascript, in particular server-side.
 

snabel

Member
Of course, you can create multiplayer HTML5 games with GM:S.
This was what I thought. I thought it would be kind of silly if you couldn't. Is it simply the same as windows?
In your reddit post you asked for support for multiplayer through networking and networking is NOT available in HTML5. You can make a split screen game of course.

Citing the docs (https://docs.yoyogames.com/)
NOTE: These functions are not currently available for the HTML5 target module.
 
A

Aura

Guest
@snabel: HTML5 is essentially just HTML, JS and CSS (sort of, you can argue the semantics). You're absolutely free to write your own Javascript that communicates with e.g. a NodeJS server, wrap that into an extension and call those functions in GM and return data from them. Particularly for simple games where near instant-speed is not a problem (e.g. a multiplayer board/card game) it's very doable.

If it is not possible natively, it does not mean that you can't create multiplayer HTML5 games with GM:S.

@BobFish: Check out GMS.IO by GameGeisha:

http://gmc.yoyogames.com/index.php?showtopic=606290

GMS.IO is a small Node.js relay server template designed to bridge the gap between TCP and Socket.IO connections under a unified interface. With its GMS bindings, any GMS game can easily access GMS.IO-based servers with minimal switching between native- and HTML5-specific calls.
 
Top