Live data from Hacker News

MelonJS – a fresh and lightweight JavaScript game engine

github.com

21–30 of 70 posts

Re: MelonJS – a fresh and lightweight JavaScript game engine

#21
post #6

An example of what can be done with it - https://melongaming.com/games/melonjump/ (hold the left mouse button down and move your mouse to play). More here https://www.melongaming.com/en/Games

Reminds me of the classic Orsinial Winterbells: https://www.crazygames.com/game/winterbells

Maybe you can also integrate the accelerometer on phones for a compact and more fun example?

Re: MelonJS – a fresh and lightweight JavaScript game engine

#22
post #7

Nice! Is this yours? I've tried building a few real-time games with different implementations of these HTML5/JS game engines, but I always hit a wall when trying to add multiplayer capabilities. The main issues I've found is there's never a way to get a "universal" X/Y/Z position for an object that can be accurately stored in a server that syncs with the position for players. It always tends to be ever so slightly of…

phaser and fluid js for microsoft have worked well for me for small multiplayers scenarios

Phaser is the one I liked the most and I got it _nearly_ close enough to being acceptable, but the rubber banding was enough to make it Not Fun^tm. I think the issues could have arisen from using Elixir as a backend rather than JS, leading to some of the math/floating point errors (particularly around sqrt) that others have mentioned here.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#23
post #17
post #7

Nice! Is this yours? I've tried building a few real-time games with different implementations of these HTML5/JS game engines, but I always hit a wall when trying to add multiplayer capabilities. The main issues I've found is there's never a way to get a "universal" X/Y/Z position for an object that can be accurately stored in a server that syncs with the position for players. It always tends to be ever so slightly of…

I'm assuming you're talking about lockstep/rollback network model, since it should not be an issue for client-server with proper client prediction/interpolation. The biggest source of these inconsistencies is Math.sqrt(). You need to implement deterministic version of sqrt() and that should fix 99% of your issues. Hit me up if you need some additional pointers.

This sounds extremely relevant to my issues, as floating point issues between different clients and the server was something I noticed. I would really appreciate any links you might have to share.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#24
post #18
post #7

Nice! Is this yours? I've tried building a few real-time games with different implementations of these HTML5/JS game engines, but I always hit a wall when trying to add multiplayer capabilities. The main issues I've found is there's never a way to get a "universal" X/Y/Z position for an object that can be accurately stored in a server that syncs with the position for players. It always tends to be ever so slightly of…

TL;DR unless you're super passionate about networking, don't waste time reinventing the wheel. These problems have all been solved already. I've been building a MOBA, using Photon Engine for the networking. It's a framework that handles everything you just described, using different paradigms depending on your preference. The one I'm using, called "Photon Fusion", runs the entire game on the server to replicate all t…

Can second Photon Engine. Great team with a lot of experience on this

Re: MelonJS – a fresh and lightweight JavaScript game engine

#25
post #7

Nice! Is this yours? I've tried building a few real-time games with different implementations of these HTML5/JS game engines, but I always hit a wall when trying to add multiplayer capabilities. The main issues I've found is there's never a way to get a "universal" X/Y/Z position for an object that can be accurately stored in a server that syncs with the position for players. It always tends to be ever so slightly of…

Sounds like your issues are non-determinism and client prediction. This book is a great resource.

https://www.amazon.com/Multiplayer-Game-Programming-Architec...

Re: MelonJS – a fresh and lightweight JavaScript game engine

#26
post #7

Nice! Is this yours? I've tried building a few real-time games with different implementations of these HTML5/JS game engines, but I always hit a wall when trying to add multiplayer capabilities. The main issues I've found is there's never a way to get a "universal" X/Y/Z position for an object that can be accurately stored in a server that syncs with the position for players. It always tends to be ever so slightly of…

I use phaser on client side, then matter.js for physics + nengi.js for networking (https://github.com/timetocode/nengi).

I only have experience with 2d (so it might not be useful to you, but perhaps will others), where typically it's a worse experience for the player to have CSP (client side prediction) at-least in a fast paced game, as for example a player behind a wall can more clearly see something missed them, yet they still got hit.

The way I do things (and I've seen is common across other "io" games), is "CSP" only for particular actions (such as your own rotation, or swinging your own weapon), but otherwise just let the client move in step with the server in terms of any physics entities etc.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#27
Tree shaking, ES6 imports, yes to all of the above.

I tried a game engine some time ago (sadly I forget what it was called) but it bundled the entire library as soon as you tried to do the basic thing. If I recall it was over 1MB. These days JS transpires have incredible functionality for slimming down payload sizes and it's awesome to see more and more libraries making use of it.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#28
post #6

An example of what can be done with it - https://melongaming.com/games/melonjump/ (hold the left mouse button down and move your mouse to play). More here https://www.melongaming.com/en/Games

The thing I noticed with most JS game libraries is their inability to display text without being slightly blurry. Is there a fix to the issue?

I noticed this in the game you linked as well.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#29
post #6

An example of what can be done with it - https://melongaming.com/games/melonjump/ (hold the left mouse button down and move your mouse to play). More here https://www.melongaming.com/en/Games

The thing I noticed with most JS game libraries is their inability to display text without being slightly blurry. Is there a fix to the issue? I noticed this in the game you linked as well.

My guess is that this would be caused by rendering text into a canvas and then scaling the canvas to fit the window. That example is rendering at 640x960 regardless of the screen size.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#30
post #29

Earlier quoted context omitted.

The thing I noticed with most JS game libraries is their inability to display text without being slightly blurry. Is there a fix to the issue? I noticed this in the game you linked as well.

My guess is that this would be caused by rendering text into a canvas and then scaling the canvas to fit the window. That example is rendering at 640x960 regardless of the screen size.

Text rendering, manipulation, and searching, is one of the key issues holding back canvas adoption as a whole. The DOM is still king here.
Post reply on HN