Game-neutral level sequencing and carry-over state. A campaign adapter supplies the actual level runner and decides what a level result means; MWG only preserves order, transitions, reminders and serialisable state.
import { Campaign } from '@datamoc/mw_games/simulation';const campaign = new Campaign({ levels: [{ id: 'intro', run: (state) => ({ outcome: 'completed', state, next: null }) }], start: 'intro', state: { gold: 0 },});campaign.completeCurrent({ outcome: 'completed', state: { gold: 10 }, next: null }); Copy
import { Campaign } from '@datamoc/mw_games/simulation';const campaign = new Campaign({ levels: [{ id: 'intro', run: (state) => ({ outcome: 'completed', state, next: null }) }], start: 'intro', state: { gold: 0 },});campaign.completeCurrent({ outcome: 'completed', state: { gold: 10 }, next: null });
Runs the current level and applies its carry-over state and transition.
Static
Game-neutral level sequencing and carry-over state. A campaign adapter supplies the actual level runner and decides what a level result means; MWG only preserves order, transitions, reminders and serialisable state.
Example