-
Notifications
You must be signed in to change notification settings - Fork 6
Flambe core
Flambe mostly uses composition over inheritance. Flambe uses an entity/component system rather than sprawling inheritance hierarchies. The composition pattern also comes up repeatedly in other parts of Flambe's design.
An entity is an object in a game. Entities don't do anything on their own, Components are attached to them to add data and logic. Entities are also hierarchical -- they can have other entities as children. This hierarchy when combined with the Sprite component, delivers the familiar Flash-like scene graph, but with the flexibility of being able to add other types of components.
Some components override each other if they have a common parent class. Adding a FillSprite to an entity for example will replace its ImageSprite. That's because they both extend Sprite. Since Sprite extends Component, anything that subclasses Sprite will share the "Sprite" namespace. Under the hood, this is implemented by giving a unique ID to each class that directly extends Component.
Working with Entities and components can be confusing if you are used to OOP. There are better (non-Flambe) articles written by skilled developers about this workflow with entities and components. Some article describe slightly other implementations of the whole system; some even in other programming languages. It could give a bit more understanding about this interesting concept, but also about code organization and how to get familiar with it.
Wikipedia: Entity component system
Game Programming Patterns: Component
Evolve Your Hierarchy
T-Machine Entity Systems
Case study: Bomberman mechanics
Component-based engine design
What is an entity framework
Documentation guide for Flambe - Targeted to version 4.0+
Flambe | Installation | Demo projects | Showcase | API Reference | Forum
Flambe is MIT licensed and available for free. Feel free to contribute!
- Home / Installation
- Entity / Components
- Core
- Assets
- Publish your game
- Other
- Editors
- Plugins, tools, extensions
- Help
- More Flambe