Modules

Extra parts of the engine for whole kinds of games: racing on a road, card games, weather, dice, and fire, with leaderboards and playing with friends on pages of their own.

Try each example, then copy the words under it and paste them to your AI. You can also send your AI the link to an example.

What a module is

Most games need only the engine. A few kinds of game have a module of their own.

A module for a whole kind of game

A module is an extra part of the engine that the agent loads only when a game needs it.

A module does the hard, repetitive work of one kind of game, such as drawing a road into the distance or dragging cards between piles, so the agent spends its effort on your rules and your art. You never install anything: ask for the game by name and the agent loads the module itself. Naming the module in your request makes sure it does.

Ask your AI

Use the MinimoJS module made for this kind of game, if there is one.

Racing

The racing module draws a road that curves and climbs into the distance, like classic arcade racers.

A road into the distance

The road is built from straights and curves, with hills on top. The car stays at the bottom of the screen and the world moves around it.

Hold the left or right side to steer.

Ask your AI

Make an arcade racing game on a road that winds left and right over rolling hills, with slower cars to overtake.

View code
const racer = new ArcadeRacerEngine(game, { laneCount: 3 });
racer.straight(900, { elevationDelta: 300 });
racer.arcLeft(1400, 70);
racer.arcRight(1400, 140);
game.add(racer.build());
racer.addTraffic({ type: "image", key: "blue-car" }, { distance: 600, lane: -0.6 });

Rivals, traffic, and a minimap

A road is the start. The racing module also runs whole races.

It can fill the road with traffic that keeps its lanes, run a race against opponents and tell the player their position, show a minimap of the track, line the road with trees, signs, and bridges, and put landmarks on the horizon. The cars and everything along the road are the game's own pictures.

Ask your AI

Make it a race against five opponent cars, show my position and a minimap, and put palm trees and signs along the road.

Cards

The cards module deals, flips, and lets players drag cards between piles, with every move animated. The game only says what the rules allow.

Deal, flip, and drag

Piles can be stacks, fanned columns, or a hand. A card dropped where the rules allow slides into place; anywhere else, it slides back.

Drag the face-up cards and tap the deck, or tap two cards in the memory grid.

Ask your AI

Make a card game with the cards dealt into solitaire columns, dragging cards from one column to another, and smooth card movements.

View code
const table = new CardTable(game, { cardWidth: 96, cardHeight: 134, back: "card-back", face, moveMs: 260 });
const columns = [0, 1, 2, 3].map((i) => table.addPile(200 + i * 130, 130, { offsetY: 34, faceDownOffsetY: 12, drag: "tail" }));

Your own cards

A card game need not use a standard deck. Every card can have a picture of its own: numbers and colors, creatures, or anything the game invents.

Ask your AI

Make a card game with a standard 52-card deck, drawn in my own art style.

View code
const table = new CardTable(game, { cardWidth: 104, cardHeight: 146, back: "card-back", face: { blank: "card-front", suits: { spades: "spade", hearts: "heart", diamonds: "diamond", clubs: "club" }, font: '"Lilita One"' } });

Weather and atmosphere

The ambient module covers a game in rain, snow, wind, fog, or a storm, and changes the light from day to night, blending smoothly from one to the next.

Rain, snow, storms, and night

One weather blends into the next. Rain splashes on the ground and stays out from under the roof, snow settles, and the wind pushes the ball.

Ask your AI

Add rain during the day, keep it dry under the roof, and let the wind push the player.

View code
const ambient = new Ambient(game, { surfaces: [ground, roof], shelters: [hut], snowSettles: true });
ambient.preset("rain", 2000);
ambient.to({ darkness: 0, stars: 0 }, 2000);
ball.vx += ambient.windX * 0.3 * dt;

Leaves, petals, fireflies, and bubbles

Small things that drift through the scene. Fireflies and embers need no pictures; leaves, petals, and bubbles are the game's own.

Ask your AI

Add some autumn leaves falling and tumbling in the wind.

View code
ambient.addDrift({ images: ["leaf-red", "leaf-gold"], motion: "fall", amount: 0.5 });

Dice

The dice module draws dice as solid shapes that tumble and land, from a four-sided die to a twenty-sided one, for board games, dice games, and role-playing games.

Roll the dice

Each die turns as a solid, slows down, and lands on its face. The game draws the number first and the die lands on it, so every player of an online game sees the same roll.

Tap to roll again.

Ask your AI

Roll two six-sided dice in ivory with black marks whenever the player taps, and show the total.

View code
const dice = new Dice(game, { color: "#f4f1ea", markColor: "#1b1f1d", font: '"Lilita One"' });
dice.create(6, { x: 260, y: 270, size: 130 });
dice.create(6, { x: 460, y: 270, size: 130 });
game.onUpdate = (dt) => dice.update(dt);

// On a tap, the game draws each number and the die lands on it.
for (const die of dice.dice) {
  die.roll(1 + Math.floor(game.random() * die.sides), { spin: { x: 600, y: -400, z: 120 }, ms: 1000 });
}

Fire

The fire module draws torches, campfires, fireballs, explosions, and fire left where something was blown up, as soft glowing flames or in pixel art.

Light a fire

Each fire flickers, glows, and burns out into smoke. A fire can follow an object, so a fireball leaves a trail of flames behind it. The game decides what catches fire; the module only draws it.

Tap to light it again.

Ask your AI

Add two torches burning on the wall, with soft, glowing flames, in ordinary orange.

View code
const fire = new Fire(game, { style: "soft", palette: "fire" });
game.onUpdate = (dt) => fire.update(dt);

fire.attach(leftStick, { kind: "torch", size: 60 });
fire.attach(rightStick, { kind: "torch", size: 60 });

With pages of their own

Two modules do enough to need a page each.

Leaderboards

Tables of best scores that players compete in, for all time or every day, week, month, or year.

The leaderboard module keeps each player's best score and shows the table over the game. It is part of Minimo Games Pro.

See Leaderboards

Playing with friends

Games friends play together online, each on their own phone.

The multiplayer module brings rooms that friends join with a code or a link, turns, competitions, and challenges. It is part of Minimo Games Pro.

See Playing with friends