What it does
A mover is anything with x, y, vx and vy, and optionally a rotation. Every chip takes the mover, its target,
its numbers and the frame's dt, and moves it one step. seek accelerates towards a point and flee away from one;
orbit circles a point by steering, so a released orbiter keeps its momentum; home flies at a constant speed with a
limited turn rate, which is what makes a missile dodgeable; approach walks straight at a target and says when it has
arrived; patrol loops through waypoints; wander nudges a heading at random. Because each chip is just a step, an
enemy can seek the player while evading bullets, or patrol until the player comes in range.
Around the chips sit the pieces every arcade game ends up writing. integrate applies velocity with drag per second,
gravity and a speed cap, so the feel stays the same at any frame rate. splitInto breaks one thing into several at
its position, each keeping the parent's momentum plus an outward fan, so a rock breaks rather than two new rocks
appearing. A Timer fires on the step it runs out, and its use spends a ready timer once and re-arms it, which is a
reload in one line. hyperspace jumps a mover to a random spot clear of everything you list, with a chance of a bad
landing if you want one.
Features
- Pursuit and escape —
seek,flee,evadethe nearest threat in range, andapproachwith no momentum. - Missiles and orbits —
homewith a turn-rate limit,orbitby steering,convergeon a centre at a fixed rate. - Routines —
patrolwaypoints in a loop,wanderat random,driftat constant velocity with spin. - Aim-aware enemies —
avoidAimadvances only while the player is not aiming at it. - Carrying —
carryplaces cargo on its carrier at an offset, for thieves that steal and run. - Motion —
integratewith per-second drag, gravity and a speed cap;speedOfandfaceVelocity. - Splitting —
splitIntobreaks a parent into children that inherit its momentum, with count, speed and spread. - Timers —
createTimerwith repeat, a ready start, a consume-onceuse, progress and reset. - Hyperspace — a random jump a set distance clear of listed objects, with an optional danger rate.
Good for
- Fixed-screen arcade shooters, where mines seek, bombs home and saucers patrol, in the style of Asteroids.
- Arena shooters with crowds of chasers, each a chip or two, in the style of Robotron.
- Rock-blasting games that need splitting with momentum and a hyperspace button.
- Closing-in attacks, where enemies tighten on a point at a fixed rate with
converge. - Raiders that carry things away, using
carryandfleetogether. - Weapon reloads and spawn timers anywhere, using the timer's reload gate.
Make it yours
Every chip takes its own numbers, so tuning an enemy is changing a handful of values: acceleration, drag and top speed for a seeker, speed and turn rate for a missile, radius and rate for an orbiter, speed and waypoints for a patrol. Chips combine per enemy and change by state, and the random chips take your own seeded random function.
Two materially different uses: a space shooter where mines seek the ship with light drag, bombs home at 140 units a
second turning two radians a second, and rocks drift and splitInto two on a hit; and a maze shooter where robots
approach the player in straight lines, a thief carrys a pickup while it flees, and a Timer paces each wave's
spawns.
A quick look
Seeking mines, homing bombs, a reload gate and a rock that splits:
import { chips, splitInto, createTimer } from '@phaser-ae/actors';
const reload = createTimer(0.25, { ready: true });
game.step('enemies', dt => {
for (const m of mines) chips.seek(m, ship, { accel: 120, drag: 0.4, maxSpeed: 160 }, dt);
for (const b of bombs) chips.home(b, ship, { speed: 140, turn: 2 }, dt);
if (fire && reload.use()) shoot();
reload.update(dt);
});
const pieces = splitInto(rock, { count: 2, speed: 50, rng: () => game.rng.next() });
Works with
maths— required, for angles.steering— for flocks and crowds that avoid each other.control-feels— for the player's own control profiles.interaction-rules— for what happens when one kind of thing meets another.asteroid-field— when you want a complete rock-blasting game's rules rather than the parts.
Good to know
- Chips move the mover themselves, so do not also let physics move the same object in the same step.
- They steer one agent at a time, with no flocking, separation or crowd avoidance;
steeringhas those. hyperspacegives up after its number of tries, 20 by default, and lands where the last try fell.- The pack draws nothing and holds no list of actors; your game owns its objects and calls the chips.






