Swash: An ECS framework for Swift

Swash is an entity systems component framework. The name “Swash” is a portmanteau of “Swift” and “Ash”. Swash is a work-in-progress.

ECS Warning… There be dragons here!

If you’ve not tried to implement anything with an ECS before, you might be in for a surprise. It is a different paradigm for solving problems. In an OOP world you’re think of objects, but in an ECS you’ll find it at times crazy fun and other times maddening because you’re forced to solve a problem in an alien manner. It may be like your first time object-oriented programming if you were mostly experienced with procedural programming.

Process Overview

In Swash you will create entities. An Entity is an aggregate of components. A Component is like a object. Neither of these make the decisions, that’s done in a System that acts on the components by way of nodes. Nodes hold references to components. You will define each Node, that describe the components from an entity that the system acts on. When you add an object to an Engine, the engine will see what nodes can be made from the entity based on its components.

Example

Swashteroids

History

Ash is an ActionScript 3 (AS3) framework that Swash was derived from. It was created by Richard Lord to facilitate game development on the (now defunct) Flash platform.

AS3 is much more weakly typed than Swift, porting Ash to Swash was a technical challenge. I had at least one false start. Some aspects of the framework had to change (for example how you create a Node). I do not think any of my changes are unduly burdensome. At the very least, I think if you check out the code, you may see some interesting things done with Swift.

Developer

Thank You

License

  • This project is licensed under the MIT License – see the LICENSE.md file for details

GitHub

View Github