User's Corner: The Cadet EngineRobert Silverton on June 24, 2013
Today, we’d like to reactivate our “User’s Corner” series of blog articles. In this series we give the word to developers who have used our frameworks to create interesting games or libraries, giving them a chance to share their experiences with our readers.
The topic of today’s post is a brand-new Starling based engine that even comes with an amazing visual editor: the Cadet Engine. Special thanks to Robert Silverton for giving us an introduction!
The story of Cadet begins with a single question: What if you could write one editor for everything?
At Unwrong, we’ve been making games and rich experiences for the web since 2004. Over the years we’ve been lucky enough to work with some leading production companies on some great projects. Production values were always very high and the teams were always keen to push the browser as far as it could go. Most of the time, this meant using Flash.
Timelines were always tight and projects always went the same way, designers and developers would iterate their prototypes for the first two thirds of the project, then the final third would be a race to integrate, iterate and polish. The final third would always be the least efficient; designers would lean over developers’ shoulders saying “a little to the right, a little to the left, can that be slightly lighter?” A programmer is generally a blunt instrument for design tweaks, but Flash projects are often heavily reliant on code, so there was little choice but to face the bottleneck and push through it.
In light of this, we wondered: can we build an editor into this project? Could we allow the designer to do what they need to do without needing the developer? So we starting building editors. Once editors became an expected feature of a project, their requirements became more and more sophisticated. After building several editors, we began to spot patterns between all editors and all projects, which lead us to our original question: “What if you could write one editor for everything?”. And hence, Cadet was born.
Several years passed as we chipped away at the problem of a single “super editor” in our spare time. If we had any idea how difficult it would be when we started, we may have thought better of it..! We’re glad we persevered though, as hopefully we’ve made something now that can start to be of use to others.
CadetEngine is at the heart of the Cadet project. The engine is organised into Components, everything within the CadetScene (itself a component) must be a Component. Components tasked with displaying things are called Skins, Components tasked with executing custom code are named Behaviours or Processes, depending on whether they’re local to an entity or scene-wide.
The engine is not inherently 2D or 3D, though supports both render modes in the Cadet2D and Cadet3D engine extensions using the GPU-accelerated Starling and Away3D libraries.
CadetEngine provides a single layer of abstraction between CadetEditor and all other libraries. This was the insight that allowed us to make all other libraries editable and interoperable without needing to change anything about those libraries. It also made sense to us not to limit a scene engine to being inherently 2D or 3D, or even to tie it to a particular 2D or 3D engine, so renderer libraries were treated as just that: a means of rendering, rather than a scene graph to handle game logic. The same goes for physics engines, Box2D and AwayPhysics are currently implemented, though in principle any mix of rendering and physics engines could be supported.
CadetEditor only knows about CadetEngine, and everything in the engine is inherently serializable, so this means any game built with the engine gets serialization for free, and consequently can be loaded, edited and saved from the editor. We think that’s pretty neat.
Now that the engine is open source, you can build your own games with it and benefit from editors that almost write themselves. Please check the website for video tutorials, github for open source game demos and the CadetEngine wiki for a step-by-step guide on creating components. We hope you have as much fun playing with the system as we have, and we look forward to your feedback.