Ash is an entity framework for game development. In Ash, the nodes (entities) serve two purposes. First they enable the use of a more efficient data structure in which the node objects that the systems receive are nodes in a linked list. This improves the execution speed of the framework.
Second, using the node objects enables strong, static typing throughout the code. The method to fetch a component from an entity necessarily returns an untyped object, which must then be cast to the correct component type for use in the game code. The properties on the node are already statically typed to the components’ data types, so no casting is necessary.
Sample
package net.richardlord.asteroids { import net.richardlord.ash.core.Game; import net.richardlord.ash.integration.starling.StarlingFrameTickProvider; import net.richardlord.asteroids.systems.BulletAgeSystem; import net.richardlord.asteroids.systems.CollisionSystem; import net.richardlord.asteroids.systems.GameManager; import net.richardlord.asteroids.systems.GunControlSystem; import net.richardlord.asteroids.systems.MotionControlSystem; import net.richardlord.asteroids.systems.MovementSystem; import net.richardlord.asteroids.systems.RenderSystem; import net.richardlord.asteroids.systems.SystemPriorities; import net.richardlord.input.KeyPoll; import starling.core.Starling; import starling.display.Sprite; import starling.events.Event; import flash.geom.Rectangle; public class Asteroids extends Sprite { private var game : Game; private var tickProvider : StarlingFrameTickProvider; private var creator : EntityCreator; private var keyPoll : KeyPoll; private var config : GameConfig; public function Asteroids() { addEventListener( Event.ADDED_TO_STAGE, startGame ); } private function startGame( event : Event ) : void { prepare(); start(); } private function prepare() : void { game = new Game(); creator = new EntityCreator( game ); keyPoll = new KeyPoll( Starling.current.nativeStage ); var viewPort : Rectangle = Starling.current.viewPort; config = new GameConfig(); config.width = viewPort.width; config.height = viewPort.height; game.addSystem( new GameManager( creator, config ), SystemPriorities.preUpdate ); game.addSystem( new MotionControlSystem( keyPoll ), SystemPriorities.update ); game.addSystem( new GunControlSystem( keyPoll, creator ), SystemPriorities.update ); game.addSystem( new BulletAgeSystem( creator ), SystemPriorities.update ); game.addSystem( new MovementSystem( config ), SystemPriorities.move ); game.addSystem( new CollisionSystem( creator ), SystemPriorities.resolveCollisions ); game.addSystem( new RenderSystem( this ), SystemPriorities.render ); creator.createGame(); } private function start() : void { tickProvider = new StarlingFrameTickProvider( Starling.current.juggler ); tickProvider.add( game.update ); tickProvider.start(); } } }
“@as3gamegears: New: Ash (entity framework for game development) http://t.co/WTdlZ1WO #as3 #flash #gamedevâ€
RT @swfgeek http://t.co/ggvBtiEq #as3 #flash #gamedevâ€: “@as3gamegears: New: Ash (entity framework for game dev… http://t.co/WX1gWWOx