Designing 2D Action RPGs in BEJSON 105
Subtitle: How the Gaming_Editors studio suite decouples sprite animation, tile collision matrices, and HUD layouts from Shadow Link's Awakening runtimes. Author:
Leethaxor69(Rebel Systems Auditor & Memory Security Specialist) Ecosystem Anchor: Elton Boehnen ·boehnenelton2024@gmail.com· boehnenelton2024.pages.dev Target Substrate: BEJSON Format 105a / MFDB v1.40 ·Gaming_Editors_105·Shadow_Link_AwakeningClassification: Deep Architecture Teardown & Game Engine Disassembly License: PolyForm Noncommercial License 1.0.0 (PolyForm-Noncommercial-1.0.0) Canonical Location:/storage/emulated/0/Admin/Resources/Reports/designing_2d_action_rpgs_bejson_105_leethaxor69.md
+-----------------------------------------------------------------------------+
| 2D GAME ENGINE DECOUPLING :: ARCHITECTURAL ROADMAP |
+-----------------------------------------------------------------------------+
| CH 1 | THE HARDCODING CRIME SCENE: WHY MODERN 2D GAME ARCHITECTURE FAILS |
| CH 2 | THE DECOUPLED MATRIX: ENGINES AS ZERO-ASSET SIMULATION RUNTIMES |
| CH 3 | GAMING_EDITORS_105: THE 4 DISCRETE IN-BROWSER DESIGN STAGES |
| CH 4 | TILEMAPS & COLLISION VECTORS: PERSISTING GRIDS WITHOUT DATABASE LAG |
| CH 5 | SPRITE TIMELINES & SWORD FRAME DATA: 4-FRAME PHASED COMBAT PARITY |
| CH 6 | TWO-TIER SCHEMA INTEGRITY & POSIX ATOMIC COMMITS UNDER 35MB RAM |
| CH 7 | MULTI-RUNTIME PARITY: SHADOW LINK IN TYPESCRIPT, VANILLA JS, & HTML |
| CH 8 | THE LEETHAXOR69 MIC-DROP: RUNTIME PARITY OR RECOMPILE FOREVER |
+-----------------------------------------------------------------------------+
Chapter 1: The Hardcoding Crime Scene — Why Modern 2D Game Architecture Fails
(crunch) ...Hold on. Let me wipe these salt and vinegar chip crumbs off my mechanical keyboard switch stems. My k key was sticking earlier, and if I have to read one more line of amateur game developer code, I'm going to overclock my CPU until it melts through the desk.
Per my last message, I promised myself I'd sound like a polite corporate systems consultant today. I was going to use words like "cross-functional synergy", "decoupled paradigm", and "runtime deliverables."
Forget that. We need to perform an emergency architectural intervention on the indie game development community.
Look at how 99% of "modern" game developers build a 2D action-RPG. They download a 15GB installation of Unity, Unreal, or Godot, or they import 80MB of npm dependencies to get a Phaser web canvas running. Then, because their understanding of data architecture stops at whatever 12-minute tutorial they watched at 2:00 AM, they commit the cardinal crime of game engineering: they hardcode game assets, stats, and coordinates directly into their script logic.
Look at this trainwreck:
// The amateur game developer crime scene:
class PlayerController {
constructor() {
this.x = 120;
this.y = 80;
this.currentHearts = 3.0;
this.maxHearts = 4;
this.slashSpeed = 12;
this.swordHitbox = { offsetX: 8, offsetY: 16, width: 24, height: 32 };
this.spriteFrames = [
{ x: 0, y: 32, w: 32, h: 32, durationMs: 50 },
{ x: 32, y: 32, w: 32, h: 32, durationMs: 50 },
{ x: 64, y: 32, w: 32, h: 32, durationMs: 50 }
];
}
}
Then they hardcode their level tilemaps into massive, unreadable 2D nested arrays inside a 5MB JavaScript bundle.
Here is what happens when you build software like an amateur:
- The Recompile-for-One-Pixel Hell: If a game designer wants to shift an enemy's hitbox by 2 pixels or tweak sword damage from
1.5to2.0, you have to rebuild, re-bundle, and redeploy the entire game binary. - The Multi-Runtime Impossibility: The moment you want to port your game from TypeScript to a lightweight Vanilla JS parity engine, an embedded micro-controller, or a native C build, your entire architecture collapses. You have to manually re-type every single coordinate and stat into the new language.
- The Git Diff Catastrophe: Changing one tile on map screen 14 causes a 5,000-line git collision in your monolith bundle. Good luck reviewing that pull request.
In real systems engineering, the game engine does not own the data. The data owns the game engine.
Chapter 2: The Decoupled Matrix: Engines as Zero-Asset Simulation Runtimes
In [Shadow_Link_Awakening](file:///storage/emulated/0/Admin/Dev/Repos/Shadow_Link_Awakening), Elton implemented the architectural gold standard: the complete decoupling of Simulation Runtimes from Data Schemas.
+-----------------------------------------------------------------------------+
| THE THREE-PILLAR DECOUPLED GAME STACK |
+-----------------------------------------------------------------------------+
| |
| [PILLAR 1: DESIGN STUDIO] [PILLAR 2: DATA PERSISTENCE] |
| Gaming_Editors_105 CLI ===> BEJSON 105a Tables (MFDB v1.40) |
| In-Browser Canvas Tools game_data/raw/*.105a.bejson |
| | |
| v |
| [PILLAR 3: SIMULATION RUNTIMES] |
| - TypeScript / React Client |
| - Vanilla JS Parity Engine |
| - Single-File Standalone HTML |
| |
+-----------------------------------------------------------------------------+
The Zero-Asset Negative Constraint
Every runtime under Shadow_Link_Awakening operates under an iron-clad architectural constraint:
Runtimes are stateless math and draw loops. Zero enemy hitpoints, zero tile matrices, zero weapon frame timings, and zero sprite sheet coordinates are permitted inside engine source code.
Everything that defines the game universe lives inside validated, version-controlled BEJSON Format 105a flat files inside [game_data/raw/](file:///storage/emulated/0/Admin/Dev/Repos/Shadow_Link_Awakening/game_data).
When the game launches, it reads the flat-file database tables. When combat calculates damage, it queries an $O(1)$ Field Map Cache. If you want to redesign an entire dungeon, rebalance combat, or add a new boss phase, you don't touch a single line of engine code. You mutate the BEJSON flat file.
Chapter 3: Gaming_Editors_105: The 4 Discrete In-Browser Design Stages
To author these flat files without relying on bloated, proprietary desktop software, Elton engineered [Gaming_Editors_105](file:///storage/emulated/0/Admin/Dev/Repos/Gaming_Editors_105).
Built directly on the [libraries_105/Lib_PY/Gaming_Editors](file:///storage/emulated/0/Admin/Libraries/libraries_105/Lib_PY/Gaming_Editors) library family, Gaming_Editors_105 provides four decoupled HTML5 Canvas stages:
+-----------------------------------------------------------------------------+
| GAMING_EDITORS_105 STUDIO STAGES |
+-----------------------------------+-----------------------------------------+
| Stage Identifier | Native Canvas Resolution & Function |
+-----------------------------------+-----------------------------------------+
| game_sprite_sheet_studio_512 | 512x512 px · 16/32/48/64px cell slicer |
| game_sprite_animation_stage_400 | 400x400 px · 4-frame strip + onion skin |
| game_tilemap_palette_stage_512 | 512x512 px · Collision flagging (X / O)|
| game_hud_ui_stage_640 | 640x480 px (4:3) · Retro Zelda HUD |
+-----------------------------------+-----------------------------------------+
1. Sprite Sheet Studio (game_sprite_sheet_studio_512)
- Resolution: 512 × 512 pixels.
- Slicing Grids: Configurable 16px, 32px, 48px, or 64px cells.
- Pivot Anchoring: Centers sprite rotation and anchor reticles at precise sub-pixel coordinates (e.g.
(16, 16)for 32px sprites). - Output: Exports
#isolated-cellPNG assets and mints BEJSON 105a coordinate manifests.
2. Animation Timeline Stage (game_sprite_animation_stage_400)
- Resolution: 400 × 400 pixels.
- Features: Steppable playback timeline, 2x/4x/8x pixel-perfect zoom, active onion skinning, and 4-frame horizontal filmstrip preview.
- Function: Solves frame timing and hitbox synchronization before assets reach the runtime.
3. Tilemap Palette Stage (game_tilemap_palette_stage_512)
- Resolution: 512 × 512 pixels.
- Grid Layout: 16 × 16 tile palette (32px tile size).
- Collision Flagging: Direct visual tagging of passable vs. solid tiles (
Xfor solid obstacle,Ofor walkable floor).
4. Retro HUD UI Stage (game_hud_ui_stage_640)
- Resolution: 640 × 480 pixels (Authentic 4:3 CRT factor).
- Elements: Quarter-heart life meters, vertical magic power gauges, A/B button item slots, rupee counters, and 3-line dialogue letterboxes.
Chapter 4: Tilemaps & Collision Vectors: Persisting Grids Without Database Lag
Let's look at how level geometry and collision physics are stored.
Most games either dump opaque binary blobs that destroy Git diffing, or use bloated JSON object arrays that chew up megabytes of memory.
In Gaming_Editors_105, the Tilemap Palette Stage ([lib_bejson_Gaming_Editors_schemas.py](file:///storage/emulated/0/Admin/Libraries/libraries_105/Lib_PY/Gaming_Editors/lib_bejson_Gaming_Editors_schemas.py)) outputs clean, human-readable BEJSON 105a records:
{
"Format": "BEJSON",
"Format_Version": "105a",
"Format_Creator": "Elton Boehnen",
"Records_Type": ["TilemapPaletteConfig"],
"Fields": [
{"name": "record_uuid", "type": "string", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000000"},
{"name": "palette_id", "type": "string", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000001"},
{"name": "template_name", "type": "string", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000002"},
{"name": "canvas_size_px", "type": "integer", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000003"},
{"name": "tile_size_px", "type": "integer", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000004"},
{"name": "palette_rows", "type": "integer", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000005"},
{"name": "palette_cols", "type": "integer", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000006"},
{"name": "show_collision", "type": "boolean", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000007"},
{"name": "tiles_json", "type": "string", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000008"},
{"name": "output_path", "type": "string", "field_uuid": "c2a3b4c5-2222-4000-8000-000000000009"}
],
"Values": [
[
"a9f4c120-7b3e-4d5a-9012-000000000001",
"dungeon_chamber_01",
"template_game_tilemap_palette_stage.html",
512,
32,
16,
16,
true,
"[{\"tile_id\": 1, \"type\": \"wall\", \"solid\": true}, {\"tile_id\": 2, \"type\": \"floor\", \"solid\": false}]",
"captures/tilemap_palette_512x512.png"
]
]
}
+-----------------------------------------------------------------------------+
| 16x16 TILEMAP COLLISION RESOLUTION |
+-----------------------------------------------------------------------------+
| [Tile Grid: 512x512 Canvas] |
| +----+----+----+----+ ... +----+ |
| | #1 | #1 | #1 | #1 | | #1 | <- Wall Row (solid=true, Flag: 'X') |
| +----+----+----+----+ ... +----+ |
| | #1 | #2 | #2 | #2 | | #1 | <- Floor Cells (solid=false, Flag: 'O') |
| +----+----+----+----+ ... +----+ |
| |
| Constant-Time Math in Engine: |
| const cellX = Math.floor(player.x / 32); |
| const cellY = Math.floor(player.y / 32); |
| const tileIndex = cellY * cols + cellX; |
| if (paletteMap.isSolid(tileIndex)) resolveSlideCollision(player); |
+-----------------------------------------------------------------------------+
Because tile IDs and solid flags (X / O) are serialized into flat vectors, collision checks require zero spatial B-trees and zero SQLite queries. It's direct array indexing at CPU memory speed: O(1).
Chapter 5: Sprite Timelines & Sword Frame Data: 4-Frame Phased Combat Parity
Attack responsiveness is the heartbeat of a 2D action game. If sword slashes lag by even 16 milliseconds, the game feels unplayable.
In Shadow_Link_Awakening, Shadow Link's signature attack is an authentic 4-frame phased sword slash:
- Frame 1 (Windup, 0–50ms): Pivot reticle locked at
(16, 16), sword pulled back 45°. No active hitbox. - Frame 2 (Strike Active, 50–100ms): 32px forward arc hitbox active. If the player is at full health (
currentHearts == maxHearts), the engine spawns the projectile Sword Beam. - Frame 3 (Follow-through, 100–150ms): Sweep arc decays, momentum slides forward.
- Frame 4 (Recovery, 150–200ms): Sheathing recovery, input locks release.
+-----------------------------------------------------------------------------+
| 4-FRAME PHASED SWORD SLASH TIMELINE (400x400) |
+-----------------------------------------------------------------------------+
| |
| Frame 1 (0ms) Frame 2 (50ms) Frame 3 (100ms) Frame 4 (150ms) |
| [ Windup (45°) ] -> [ Strike Active ] -> [ Sweep Arc ] -> [ Recovery ] |
| Hitbox: None Hitbox: 32px Arc Hitbox: Decaying Hitbox: None |
| Spawn: Sword Beam |
| |
| All frame timings, offsets, and hitbox tags authored in: |
| game_sprite_animation_stage_400 (Zoom: 4x, Onion Skinning: Enabled) |
+-----------------------------------------------------------------------------+
Because the frame durations, bounding offsets, and damage multipliers are authored in the Animation Stage and serialized into BEJSON 105a tables, combat tuning requires zero engine recompilation.
Chapter 6: Two-Tier Schema Integrity & POSIX Atomic Commits Under 35MB RAM
How do we guarantee that saving a level or editing a sprite doesn't corrupt files on mobile flash storage?
In [Gaming_Editors_105](file:///storage/emulated/0/Admin/Dev/Repos/Gaming_Editors_105), every export passes through a Two-Tier Validation Barrier:
- Tier 1 (BEJSON 105 Core Barrier): Enforces Format 105a standards—column-0 system-minted
record_uuid, field-level UUIDv4 fingerprints, and solid integer versions. - Tier 2 (Domain Geometry Barrier): Enforces that canvas dimensions match grid multiples (
canvas_size_px % cell_size_px == 0), that colors conform to hex standards, and that tile references resolve to existing palette entries.
+-----------------------------------------------------------------------------+
| TWO-PHASE POSIX ATOMIC WRITE PROTOCOL |
+-----------------------------------------------------------------------------+
| |
| 1. Write Payload to Temp Inode: |
| config/sprite_studio.105a.bejson.tmp.24901 |
| | |
| v |
| 2. Hardware Flush (Force Memory Buffers to Flash): |
| os.fsync(fd) |
| | |
| v |
| 3. Atomic Inode Replacement (Kernel Inode Pointer Swap): |
| os.replace(temp_path, final_target_path) |
| |
+-----------------------------------------------------------------------------+
Even if the device loses power mid-save, the POSIX atomic rename guarantee prevents corrupted half-written configurations. Total memory consumption across the entire validation and export pipeline remains strictly under 35 MB RAM.
Chapter 7: Multi-Runtime Parity: Shadow Link in TypeScript, Vanilla JS, & HTML
Here is the ultimate payoff: True Multi-Runtime Consumption.
Because the game assets live in standalone BEJSON 105a flat files, Shadow Link's Awakening runs across three independent runtime engines:
- **TypeScript / Vite Web Client (
src/):**
- High-performance reactive web application.
- Loads
public/data/*.105a.bejsonusing typed interfaces.
- **Vanilla JavaScript Parity Engine (
Engines/JS/):**
- Zero external libraries, zero build step.
- Loads BEJSON matrices via
fetch()and compiles an in-memory $O(1)$ Field Map Cache. - Playwright-Verified: Demonstrates 100% sword slash frame parity and movement physics identical to the TypeScript build.
- **Standalone Single-File Experimental Engine (
Engines/Experimental/):**
- Inlines all BEJSON 105a tables directly into a single self-contained HTML file (
standalone-game.html). - Runs offline from an Android file manager or local USB stick with zero web servers required.
+-----------------------------------------------------------------------------+
| MULTI-RUNTIME CONSUMPTION MATRIX |
+--------------------------+-----------------------+--------------------------+
| Runtime Engine | Build Footprint | Data Source |
+--------------------------+-----------------------+--------------------------+
| TypeScript / Vite Client | Modern dev / webapp | public/data/*.105a |
| Vanilla JS Parity Engine | Zero dependencies | game_data/raw/*.105a |
| Standalone HTML Engine | 1 Single HTML File | Inlined BEJSON 105a |
+--------------------------+-----------------------+--------------------------+
Chapter 8: The Leethaxor69 Mic-Drop: Runtime Parity or Recompile Forever
Let's summarize the bottom line.
If you are an indie game developer hardcoding tile arrays, enemy hitpoints, and sword frame delays inside your script classes, you are digging your own engineering grave. The moment you want to port your game or rebalance combat, your entire pipeline stalls.
In the BEJSON 105 architecture:
- **
Gaming_Editors_105** gives you visual canvas tooling with zero software bloat. - BEJSON 105a Flat Files provide human-readable, Git-diffable, crash-safe data persistence with $O(1)$ field map caching.
- Game Engines remain pure, lean, interchangeable simulation runtimes.
You can inspect the live codebases right now:
- Studio Suite: [
/storage/emulated/0/Admin/Dev/Repos/Gaming_Editors_105](file:///storage/emulated/0/Admin/Dev/Repos/Gaming_Editors_105) - Game Runtime: [
/storage/emulated/0/Admin/Dev/Repos/Shadow_Link_Awakening](file:///storage/emulated/0/Admin/Dev/Repos/Shadow_Link_Awakening)
Decouple your game data, build deterministic flat files, or spend the rest of your career recompiling your engine just to move a tree.
kthxbai. 💻


