korlibs-archive / korge-next

Moved to https://github.com/korlibs/korge
75 stars 37 forks source link

Deprecate global injection object for korge fleks for world local injections. #715

Closed Kietyo closed 2 years ago

Kietyo commented 2 years ago

The idea is that each world should have their own injection space. Currently, every world that's created overwrites the previous world's injections. So you can't have 2 worlds with different injections.

This is useful for simulation/multiplayer type games where each player has their own world.

A real life example of this is that for my game, I am replicating a starcraft 2 arcade map called "Entropy TD" where each player is competing against each other with their own mazes. Each player has their own world with their own instances of injectables.

https://sc2arcade.com/map/2/148730/

jobe-m commented 2 years ago

Many thanks for your contribution! I think it makes sense to limit the injectable objects to a world. I want to test this and discuss with Quillraven if we would upstream this change to the home repo of Fleks. Because I would like to have the korge-fleks (copy) in sync with its upstream project.

Kietyo commented 2 years ago

Thanks, my recommendation would be to remove the korge fleks version and update the korge fleks sample to instead import the MPP version of fleks from Quillraven's repo. This way, there won't be 2 versions to maintain.

I'll probably update my own project to use Quillraven's version rather than Korge's.

jobe-m commented 2 years ago

Yes, I agree that would be the best. Unfortunately I failed to use Fleks from the kmp branch of Quillravens repo. I don't have enough gradle experience to know how to setup the external Fleks project so that it can be used by a Korge project. If you could help here I would be more than happy :)

Kietyo commented 2 years ago

Thanks, I'll try it out tomorrow.