melonJS icon indicating copy to clipboard operation
melonJS copied to clipboard

Make the entire engine modular

Open L1lith opened this issue 3 years ago • 2 comments

I recently published the library Melon Solid. Unfortunately, there is no way to instantiate each game/canvas to a specific component on the page (which is bad if the a game component is put on the page, taken off again, and put back again, like in the side of client side routing, or simply if there 2 games on the same page). Basically what I need to make everything work properly would be a way to instantiate every part of the engine (the pool, video object, etc) so that I can have one instance for each game (this prevents games from overlapping in memory).

I talked to the author in discord so I'm pretty sure they're already aware, but I'm just opening an issue so we can track this issue and others can comment.

L1lith avatar Apr 01 '22 10:04 L1lith

@L1lith making some progress here, with now game being an instance of Application (a new class).

Unfortunately this not yet though possible to create a different Application instance, as references to the "default" game are hardcoded a bit everywhere and need more rework for instances to work independently. This is the last bit though as all other required elements can also now or already be dynamically instantiated.

obiot avatar Jul 09 '22 08:07 obiot

I feel like this one kinda fits here too https://github.com/melonjs/melonJS/issues/1139

L1lith avatar Sep 29 '22 00:09 L1lith