This workflow upgrades WynIsBuff2’s level/progression architecture to match the ULTRA‑COMPREHENSIVE LEVEL & PHYSICS DESIGN BIBLE, while strengthening modularity, scalability, and futureproofing.
Current code uses hardcoded JS objects for level data, and separate classes for platform/collectible instantiation and progression. To "buff" the system:
- All levels/zones will move to data-driven YAML (validated by schema)
- Level objects will be spawned through a unified prefab registry
- Difficulty/variation will rely on a scalable API
- Zone/stage/progression logic will become explicit
- The system will allow easy future extension (UX triggers, effects, RX stages, etc)
- Create
assets/levels/directory. Store all levels here as YAML files:- Naming:
Z2_MomentumMountains/stage-1.yaml, etc.
- Naming:
- Write level schema to
schemas/levels.schema.json— based on the Bible doc. - Implement YAML loader in
LevelLoader(or a new module):- On load, YAML is parsed → JS object
- Schema is AJV-validated; errors must halt build
- Migrate/proxy any legacy
LevelDatacontent into the new data flow, at least for one test stage.
- Create a
PrefabRegistrymapping type string (e.g."ledge","pit","mover") to a factory method/class.- E.g.
"ledge"→PlatformFactory,"mover"→MovingPlatformController, etc.
- E.g.
- Extend
LevelLoaderto, for each object in the YAML'sobjectsarray:- Look up prefab by
type - Pass difficulty/scaler props (see below)
- Factory adds entity/physics/collision as needed
- Look up prefab by
- Allow easy registration: New prefab types can be added without changing LevelLoader, just by updating the registry.
- Write/extend a
makeScaler(zoneIndex)API:- Outputs param set: gap, platformW, moverSpeed, etc.
- At level load time, injects scaler props according to zone/stage (can be read from YAML meta).
- Factories use these props to tune platform gaps, spring power, enemy rate, hazard frequency, etc.
- Implement explicit support for zones and stages:
- Levels get IDs like
{ zone, stage }, not justlevel1
- Levels get IDs like
- Progression/next-level logic uses the matrix, not a flat list.
- Support for remix (RX) stages, and staged difficulty.
- Read object quotas/mix (e.g. how many platforms, turrets) from the matrix as the source of truth.
- Level objects include support for triggers/events (e.g., checkpoints, gates, tutorials, sensors).
- Factories emit to the in-game Event System (analytics/debug ready).
- Future‑proof: Effects/polish layers and boss-escape system can be layered on without touching other code.
- Centralize physics units/scaling (e.g.,
PX_PER_M, masks) in a constants file, imported by all modules. - All prefab/entity factories must respect these units.
- Begin with a test YAML level and migrate over time. Proxy old data via the loader when bootstrapping.
- Document new workflows in
docs/andAIProjectDocs/. Update readme and onboarding docs. - Ensure all progression/hardness is testable with debug toggles + interfaces (step through progression, force scaler, etc).
- Validate by implementing a remix/RX stage and at least two non-trivial object types from the prefab bible.
- Easy expansion: Designers add levels/zones/objects in YAML and registry, not code.
- Strict validation & reliability via schema and modular prefab enforcement.
- Cleaner codebase: No more growing monoliths or duplicative switch-cases.
- Ready for future features: Boss systems, VFX, triggers fit cleanly into the event and prefab layers.
- Buff-level architecture: Highly composable, designer/developer friendly, futureproof.