Virtual machine for Firedancer, a Haxe based language for defining 2D shmup bullet-hell patterns.
haxelib install firedancer-vmPrepare any firedancer.vm.ProgramPackage instance created with Firedancer library.
If you have a serialized program (which is a JSON string), parse it by ProgramPackage.fromString().
Extend the classes below and override their methods:
firedancer.vm.Emitterfiredancer.vm.EventHandler
Assuming you set the compiler flag -D firedancer_use_actor_class, create your actors by doing the below for each actor:
- Create a
firedancer.vm.ThreadListinstance. - Create a
firedancer.vm.PositionRefinstance that provides read access to the position of the actor at the end of the last frame. - Create a
firedancer.vm.Actorinstance passing the two above.
Without the compiler flag -D firedancer_use_actor_class, the Actor class is not available and you have to prepare any SoA or AoSoA style structures using the type banker.vector.WritableVector for each property (see library banker).
Prepare another PositionRef instance that indicates the position of the target to be aimed.
This may be either common in actors or specific to each actor.
At the beginning, at least one actor should be active and have any firedancer.vm.Program instance.
Set any Program instance (that you get from your ProgramPackage instance) by ThreadList.set() or Actor.setProgram().
Run firedancer.vm.Vm.run() every frame for each actor, passing the below:
- The
programTablethat you get from yourProgramPackageinstance. - Instances of your classes extended from
EventHandlerandEmitter. - The memory capacity in bytes, which you used when creating
ThreadListinstances. Typically it's common in all actors. - Your actor data (
#if firedancer_use_actor_class, theActorinstance). - The
PositionRefinstance for the target position.
Then render the actors using any game framework or some kind of that.
Emits verbose log.
Specifies the underlying type of PositionRef.
Example: -D firedancer_positionref_type=broker_BatchSprite
Valid values:
broker_BatchSpritefor usingbroker.draw.BatchSpriteheaps_BatchElementfor usingh2d.SpriteBatch.BatchElement- Otherwise uses an anonymous structure
{ x: Float, y: Float }
Enables to use Actor class instead of the default SoA (Structure of Arrays) style.
(Not yet tested)
Throws error if:
- infinite loop is detected in the
Vm - unknown
Opcodeis detected in aProgram
Automatically set #if debug.
- sinker v0.5.0 or compatible
- sneaker v0.11.0 or compatible
- banker v0.7.1 or compatible
- reckoner v0.2.0 or compatible
See also: FAL Haxe libraries