Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Component-based entity systems with Ashley


Making games is an art and as such, it has a high degree of creative freedom, which means that there is no one single way to reach your goal.

On one hand, traditional hierarchy-based games development is quite intuitive as you can see in the next diagram:

However, as the game grows, the class hierarchies become more annoying and hardly reusable.

On the other hand, a viable alternative to destroy that pyramid from hell is component-based development. In this way, we would have, for instance, our T-Rex class working as a container for a series of behaviors called components. The advantage of this is that those components are highly reusable for the rest of the entities in that game or any other one.

Ashley is a tiny high-performance entity framework integrated into the Libgdx family with a clear and easy-to-use API. You can learn more about it by visiting https://github.com/libgdx/ashley.

Understanding this new approach will take some time and you will...