Turn one of the engine's rules off
Leave an engine rule out by name (withoutSystems, withoutHooks, withoutCommands, withoutOrders), or change its numbers in settings. What you leave out runs nowhere: not in the page, the server or tests.
// in src/rules.ts
import { defineIds, type Rules, heroesPack } from '@v12-engine/engine'
export const UNIT = defineIds('scout')
export const rules: Rules = {
id: 'my-game',
name: 'My game',
units: [{ id: UNIT.scout, name: 'Scout', kind: 'unit', radius: 0.4, sight: 10, stats: { health: 100, moveSpeed: 5 } }],
// no supply cap, and no fog: everyone sees everything
withoutSystems: ['supply', 'fog'],
// the engine's own hooks by id (`coreHooks`): what a dead unit drops, and life stolen by a hit
withoutHooks: ['loot', 'bounty'],
// knobs: units see as far by night as by day, no corpses, creeps that never sleep
settings: { fog: { nightSight: 1 }, combat: { corpseTime: 0 }, camps: { sleep: false } },
// heroes and camps, and no selling at a shop (the pack's `sell` command)
packs: [heroesPack()],
withoutCommands: ['sell'],
victory: null
}Done: no supply cap, no fog, no loot or bounty, no corpses, and shops that don't buy back.
Start with the map black, or explored
Melee maps start explored (settings: { fog: { startExplored: true } }): ground and neutral buildings dim, units hidden until seen. Leave it out for black maps. One map can override it with explored in its file, or Map › Starts explored in the editor.
Turn off heroes, camps and shops
They're not on unless you add heroesPack() to packs. See Give my game heroes.
Reference
| What to leave out | Names |
|---|---|
| Systems | abilities, combat, construction, fog, life, movement, orders, production, supply, victory… (Add a system has them all) |
| Hooks | coreHooks: bounty, experience, loot, onCast, onHit, onKill, undying, mapPathsClear |
| Victory | victory: null for a game nobody wins |
| Knobs | Where |
|---|---|
Rules' numbers (RuleSettings) | mitigation, critDamage, missChance, giveUpChase, sellPrice, supply, talk, pings… |
| Camps | settings.camps: leash, chaseTime, resetAfter, helpAtOnce, sleep, respawn (Creeps) |
| Heroes | HeroSettings, passed to heroesPack |
A mod turns the same things off with game.withoutSystem, game.withoutHook, game.withoutCommand, game.withoutOrder, game.rules and game.packs. To change a rule instead of dropping it, use a hook.