libgdx/ashley

Make it easier to extend ashleys classes

Closed this issue · 6 comments

Currently the classes mostly have private variables, which makes it difficult to extend them ,because some of them can not be accessed using this or super and also don't have a getter.

This is essential for the game I'm currently developing. I separated the game logic and the render logic, which means that I have a render() and an update() method that are required in my entitysystems. It wouldn't be difficult to have a plain method or interface to do that, but I can not use my version of the engine class to call it. To do so I would need access to the updating boolean (at least in theory)...

Changing the access modifier from private to protected would solve all my issues.

Exposing this kind of information makes breaking changes unavoidable as the project moves forward - Ashley is already pretty bad in this sense.

You should use different systems for updating and rendering - then it's simply a matter of running rendering system after all logic systems have been executed.

I think @antag99 pretty much gave you the solution to your problem. The state you want us to expose is meant to be abstracted away, this would cause more problems than it would solve.

I though about using a system for that, but, as I mentioned, I have those two methods. update() runs 60 times per second while render() is not bound to a fixed rate. I decided to use that design to separate my game logic from the rendering (and to have a fixed timestep for box2d).

Thank you for making me think about that :) My plan is now to just keep a reference to my render system and and execute it's custom render() when needed.

You can use IntervalSystem for that.

@saltares That's even better! Thanks

Closing this for now then :-).