Live data from Hacker News

MelonJS – a fresh and lightweight JavaScript game engine

github.com

41–50 of 70 posts

Re: MelonJS – a fresh and lightweight JavaScript game engine

#41
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.

I think in the past I've fixed this by doubling the resolution. More precisely - detecting device pixel density and setting the canvas size based on that.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#42
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…

[deleted]

Re: MelonJS – a fresh and lightweight JavaScript game engine

#43
post #33

For someone going from web dev to game dev, would it be better to learn MelonJS or another JS Engine or something like Unity?

If you're seriously making that transition, then you should learn one of the two dominant general gaming engines - Unity or Unreal. Both of them have exceptional documentation and can be deployed in a wide variety of platforms.

If you're going from web dev to game devs as a hobby or just fun side thing, then a JS engine like Melon is a good way to dive in and start creating something people can enjoy without serious investment.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#44
post #31

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.

Tbh when making a web game you'd be better served using standard web UI in tandem with your game even if canvas text wasn't blurry. Web libraries (react, etc) are very advanced and it'd be incredibly hard for a js game engine to match them for UI

I think you underestimate the performance difference of canvas! Also, WebGL

Re: MelonJS – a fresh and lightweight JavaScript game engine

#45
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.

Are you playing on a phone or using a high DPI monitor? By default HTMLcanvas (which most game engines use to handle text) does not take into account high DPI scaling (I would guess due to performance).

This isn't inherit to JS game engines, but I will say text quality is not usually something that game devs focus on unless text is important to their particular game.

Here's an example of a workaround to render more crisp text https://github.com/danman113/gfx-utils/blob/main/src/canvas/...

Re: MelonJS – a fresh and lightweight JavaScript game engine

#46
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,…

Do you have a demo/link to one of your games? I am interested in learning more about multiplayer experience for web games and would love to see an example with these tools mentioned.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#47
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…

Check out https://heroiclabs.com/opensource/

Re: MelonJS – a fresh and lightweight JavaScript game engine

#48
post #33

For someone going from web dev to game dev, would it be better to learn MelonJS or another JS Engine or something like Unity?

If you're just getting started, I'd recommend trying out a few engines to see what clicks (I find it usually takes at least an afternoon to get a feel for an engine). JS engines tend to be easier to get started with as a web developer, but you'll often run into limitations when you start building more complex games.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#49
post #23
post #17

Earlier quoted context omitted.

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.

https://mariani.life/flash-notes.html

I'm using this sqrt implementation (found it long time ago on some old action script blog, this link is not the original source). It's plenty fast, accurate and fully deterministic. I successfully implemented it in my multiplayer gta2 clone in javascript.

Re: MelonJS – a fresh and lightweight JavaScript game engine

#50
post #46

Earlier quoted context omitted.

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,…

Do you have a demo/link to one of your games? I am interested in learning more about multiplayer experience for web games and would love to see an example with these tools mentioned.

I only have this old demo I open sourced - https://github.com/TomYeoman/2d-zombie-survival-io-demo right now (trying to crunch to finish full version)

It's using phaser on the server in this instance (which I recently ripped out, and moved to just using matter)

It's pretty ugly code, but the foundations are there, maybe it's a starting point or of some use!

Post reply on HN