• Register
Post news Report RSS {Devtips} How I organize my scene?

Well, I now have my engine, but as I mentioned before... the LibGdx actor system doesn't suit me perfectly. It's up to me to make the one of my dreams =)

Posted by on

Well, I now have my engine, but as I mentioned before... the LibGdx actor system doesn't suit me perfectly. It's up to me to make the one of my dreams =)

As for object-oriented programming, I like to work in layers. So I had to establish the different layers and steps of what I consider to be "the father of all my next games".

It is rather obvious but what goes without saying always goes better by saying it: the first layer must obviously be "The Game" itself.

In this layer, it's simple, we define only the basic parameters of the application and we go directly to the "Screen" sub-layer.


Here, a little more work. This layer will contain the camera, the viewport and the event processor. It will be in charge of reframing the game in case of resizing the window, dispatching the received events and containing and changing the scene if needed.

Precisely, it is the following underlay: "The scene"!


Ahh! This is really where it gets interesting. The scene really represents what happens in a painting or a stage. For that, I split it in 4 sub layers:

- The background elements, which will always be below

- the dynamic elements, in the middle

- the elements that will always be in front

- the UI elements which will always be in front of all the others


It is also in this layer that I created a marker system. Basically, it's a graph with landmarks in our scene. This can be used, among other things, to place our elements at strategic points or to move our characters following a defined path.


Finally, the scene offers a catalog of characters and a system of selection of the current character (the hero ^^).


Concretely, this layer is intended to be overloaded in order to add the elements necessary for our scene.

After adding the elements in the desired order and layers and connecting the events dedicated to them... The scene is ready to be used !

First the elements of the back


Then the dynamic elements


And finally the elements always above


So, it's the end! I hope you enjoyed this article! If you liked it and would like us to make more, please let us know! Subscribe, comment it, share it, show us that you are there, it will encourage us a lot!

You can also make a donation on our ko-fi page, to support us and finance the development of our next game: 'Les Nains du Nord"!

Thank you! ♥

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: