Skip to content

Architecture Overview

Avetis edited this page Nov 9, 2015 · 1 revision

Our libGDX runtime is a lot more complicated then the ones used by other frameworks. So it's borderline to engine, rather then just a runtime. Good news is - it will pack tons of stuff in it for your convenience. Bad news - you'll have to learn things. And of course there is always a way to keep it simple.

Current state of libGDX

If you used libGDX before, chances are you were either basing your game on Scene2D that is perfect for UI, and has things like Actors, Images, layouts and so on. Or you were using combination of that, and providing your own classes that work with sprite batch directly to render things.

Here are the major ways people are using libGDX

Scene2D

Scene2D is awesome for making UI, it has widgets, tables so you can make scroll views and things like that, but you also have Group and Actors, and if you imagine your scene in "nested" way, then you may want to use scene2d for your game part as well. Downside is, it's going to be bulky and heavy, because Scene2D is not made to be overused. With big amount of Transformation Matrix overuse on every group things will get heavy soon.

Just using SpriteBatch

But if you avoid using Scene2D, you are left with libGDX bare minimum, you can't have groups and transformations anymore, you can't have Actions.moveTo tweens anymore, and so that while choosing optimization, you have to re-invent the wheel a lot.

Ashley

And then there is also Ashley, that you might have seen. It's an ECS (Entity Component System) That is made for libGDX. But Ashley is just a bare minimum ECS framework, it does not give you ways to render things or do anything like that. So you have to make your own systems and such.

Overlap2D runtime

Overlap2D runtime, not only does the obvious of loading overlap2d exported data, but also combines best parts of all three worlds described above. Here is how:

  • Factory methods to create Ashley engine, entities, components and systems that will do all the heavy work
  • Nested Groups while using Ashley with transforms where necessary
  • Tween Actions System+Components to give you ability to do things like moveTo, FadeOut
  • Separate Scene2D based part that will do same, but with use of atom Scene2D classes. In case you need it for UI.

So to wrap up, Overlap2D provides functionality to automatically create Ashley Engine, and based on o2d exported data, make list of entities and components and systems that will render all your scene without any use of actors. It also provides additional systems and components to do all the common stuff like tweens, physics, and more. And it also has separate part that works only with Scene2D and provides you with Group with actors inside to render an o2d scene in your Stage class, if you are more into UI.

Depending on your needs you may use one approach or the other.