Jump to content

New User - Is melonJS right for this Game?


Recommended Posts

This post is from a first time melonJS user. I would love guidance and advice from strong members of the community. 

Let me know if this is sounds like a good/interesting idea. Is this something melonJS will do well? 


Game Summary

Massive Multiplayer Team Contra (looking exactly like NES contra) 


Its a neverending multiplayer Game session. As a player joins the session they are auto-teamed up with 1 random new player . These teams compete to get to top of leaderboard (so kinda similar to slither.io in many respects) 


Exactly like contra...1 bullet takes a life. Each player starts with three lives. 

As a team is killed off, the team is removed from the game and leaderboard. New teams are always being added to the game. 

If your teammate is killed off...you are alone, but will have opportunity to join another player


Why Im Posting This

Ive never made a game for browser, after looking around Im almost settled on using melonJs.

Im a very experienced server side developer and will also be building a multiplayer micro-server specifically for the game. This server will be responsible for coordination between players (lobby and in-game). It will also do some of the heavy in-game calculation lifting. It will service the clients via websockets and REST. 

The browser is where Im unsure. Ive done Javascript when I needed it, but Im no expert.


Here is what I need melonJS to do for me.

Render the game (of course). 

Do physics / collision detection for the player. (not all players .... just the main player for that browser instance) 

As new players are added the map will possibly grow. With some upper limit. 

Take instruction from the server on the game state (other entities and they're actions) 

Use RX-JS for this interaction with the server (I specifically want to learn RX-JS). So this will require Observable streams to be processed alongside the game loops. 


Thanks for any feedback!


Link to comment
Share on other sites

Hi there.

I can't speak from experience on building multiplayer experiences, but I know others have leveraged socket.io to do multiplayer with MelonJS. For rendering other players, you can setup the RxJS observables to update the position of a given entity in the scene, and ensure that when doing so, the update() method for those entities return true.

MelonJS is also really customizable, and is pretty flexible as an engine. I've written a fair bit of custom code to do the rendering style I wanted for my most recent game. So it shouldn't be an issue to hook it up the way you want to.

It's worth noting that physics/collision is corrective. The idea is that you move an object, it overlaps with another object. The collision system realizes this, and subtracts the overlapping rectangle from the position of the moving object (or which ever is governed the target). So basically, if the physics system/coordinates of entities in melonjs is out of date with the positions on the server, it's not difficult to correct the scene by updating all the coordinates.

Link to comment
Share on other sites

Hi Chris,

Have you built a multiplayer game before (any platform, not just HTML5)? I ask because it's the one component in your proposed architecture that has the highest risk. If you do have experience in this area, then you know exactly what you're getting into. On the other hand if you haven't worked directly with realtime massive multiplayer gaming, then you're in for a wild ride!

As far as the browser goes, you will see excellent results out of any browser released within the last year. If your users will be on old crap like IE11, you should be concerned. We'll be dropping support for ES5 browsers in one of the next major melonJS releases for similar reasons.

Finally, I created a very simple plugin a long time ago that adds multiplayer support to the platformer example. You can find the code here (needs some updates, so copy-pasta won't work): https://github.com/parasyte/melonJS-pubnub/commit/87b595f4563da76592c83efb4035e354924ac307 If nothing else, this might provide you some examples to get started. (Caveat emptor: This is the bare minimum that could be done for multiplayer support. The rest is a really long rabbit hole.)

Outside of the multiplayer stuff, melonJS can take care of each item you listed in the needs section. Dynamic mapping is the only one that will need any kind of "significant" work.

Cheers and best of luck!

Link to comment
Share on other sites

Thanks for the feedback Jay....the collection of links in the "rabbit hole" are pretty tremendous. And nope, Ive never made a multiplayer game at all.

As for melonJS...the framework is really tremendous so far....Ive got a contra map from tiles I cut off old images on the web, plus sprites. Then coded up my entities , and already have a pretty decent looking and working Contra game.  So Big High5 to the melonJS devs.

Now im wading into the multiplayer....Ive got websocket messaging flowing between client and a server. So easy part done. I suppose from what I read .... the correct approach includes...

1. Server acts as master system of record

2. Clients see the other users as they were in the very slight past and interpolate the gaps. 

3. Implement lag compensation on server calculations which kinda reverses that interpolation from step 2. 


But it seems to me the implementation of that will be a bit bizarre in a game like Contra....because the bullets are moving so slow! But maybe it makes easier, who knows? Its an interesting problem area for sure. 

Thanks again!




Link to comment
Share on other sites

Slow bullets just means you have shorter distances to interpolate.;) It sounds like a pretty cool game idea. I grew up on Contra, myself. It holds a lot of nostalgia for me. I'd love to see how it turns out!

We developed melonJS because we saw an opportunity with the browser platforms maturing. The features and design come direct from our own needs as game developers. It is awesome to hear that you have enjoyed using it, so far. Thanks and a big high-five back at you!

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.

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.


  • Recently Browsing   0 members

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