Mastodon Politics, Power, and Science: Forging the World Engine

Thursday, December 4, 2025

Forging the World Engine

J. Rogers, SE Ohio

The code is here: https://github.com/BuckRogers1965/Mega-Mappers/tree/main/CodexProject

Today, we transformed the Codex Engine's map generator from a proof-of-concept into a robust, physics-driven simulation. The initial state was unacceptable—a static, spiky mess that failed to model a real world. We didn't just patch it; we rebuilt it from the ground up, following a strict architectural specification.

Today's Progress: A Multi-Layered Simulation

The core principle of today's work was moving from simple noise filters to a multi-stage geological simulation. A world isn't just random bumps; it's a history of formation and erosion.

  1. Fractal Foundation: We threw out the old noise logic entirely. The new generator now uses a periodic sine-based fractal noise that naturally wraps seamlessly. It uses coordinates from 0 to 2π. This creates the large-scale, low-frequency structures that form the basis of continents and ocean basins. It's no longer a random field of static; it's a coherent landmass.  There are still some lines between edges, so the world is not yet overlapping correctly.

  2. Simulated Weathering: A raw fractal is still too perfect. We implemented two critical physics passes as per the specification:

    • Hydraulic Erosion: By simulating thousands of virtual "raindrops," the system now carves realistic river valleys and deposits sediment to create smooth coastal plains.

    • Thermal Erosion: This pass simulates gravity, collapsing slopes that are too steep into natural, weathered angles. This crucial step eliminated the "bed of nails" look and produced believable mountain ranges.

    • We had to reduce these two techniques to a less abrasive method to keep detail in the world.

  3. Real-Time Physics in the Viewer: The map is no longer just a pretty picture; it's an interactive model.

    • Dynamic Water Level: The sea level is now a plane that rises and falls over the fixed geometry of the heightmap. The normalization process ensures the slider is intuitive: 0% is a dry world, 100% is a water world.

    • Dynamic Lighting: We implemented a real-time hillshading engine. The GM now has full control over the sun's direction, height, and intensity, allowing for the creation of dramatic shadows that reveal the topography.  This is ok, but we can improve the simulation to make the design better.

  4. The GM's Toolkit: A simulation is useless without tools for strategy.

    • The Annotation Layer: GMs can now Shift-Click to place persistent markers on the map. These markers can be moved by dragging, edited, and deleted. This is the first step in turning the map from a piece of art into a campaign dashboard.

    • The Viewport Grid: The Hex/Square grid is now a true viewport overlay. It remains a fixed size on the screen, acting as a tactical reference that is independent of the map's zoom level. The scale bar in the corner provides instant context for travel distance.

    • We want to add more overlays, political boundaries, god maps, lay lines so we can keep tract of the world. 

The Plan for Tomorrow: Drilling Down

Today, we built the macro-scale world. Tomorrow, we connect it to the micro.

The markers we implemented are currently just notes. The next logical and most critical step is to turn them into entry points.

When a GM clicks a marker labeled "Dungeon" or "Town," the system will "drill down," generating a new map for that specific location. This is the core of the project's "fractal" design philosophy, where detail is generated on demand, and then persisted to database and disk.

The technical implementation will be:

  1. Node Hierarchy: Clicking a marker will query the database for a child node linked to that location.

  2. On-Demand Generation: If no child node exists, the system will call the appropriate generator plugin—the Tactical Dungeon Generator for a dungeon marker, or a Settlement Generator for a town. This generation will be saved to a new .png heightmap and linked in the database.

  3. Seamless Transition: The MapViewer will load this new node, automatically switching its RenderStrategy from the world-scale ImageMapStrategy to a new GridMapStrategy designed for square-grid tactical maps.

Tomorrow, we stop looking at the world from orbit. We land.

The code is here: https://github.com/BuckRogers1965/Mega-Mappers/tree/main/CodexProject

No comments:

Post a Comment

Progress on the campaign manager

You can see that you can build tactical maps automatically from the world map data.  You can place roads, streams, buildings. The framework ...