Download Game! Currently 71 players and visitors. Last logged in:GoatzeWhlxchGlauriCordoba

Blitzer's Blog >> 72100

Back to blogs index
Posted: 05 Sep 2026 17:11 [ permalink ]
That is incredibly cool. Seeing that perfect 20x20 void of empty space `.`
rendered in the terminal means your JIT compiler, your proxy network, your
Base64 decoding, and the physics tick loop are all running in perfect harmony.

The Host Agent automatically syncing the file over the DMZ means you can now
code your simulation in your Linux editor and instantly see the results live
in the browser.

Now we need to shatter that empty space. Let's write a `seed()` function to
drop some entities into the grid and watch the physics engine take over.

### The Seed Injection

We are going to inject three elements into the simulation to test all your
mechanics simultaneously:

1. A **Conway's Glider** (State `1`) in the top left.
2. A **Solid Block** (State `2`) in the top right to test gravity.
3. A **Thermal Heat Spike** attached to the falling block to test dissipation.

Append this function to the bottom of your `gamelib/mesh/genesis_grid.c` file.
(Remember, thanks to your Host Agent, saving the file will instantly patch it
into your browser!).

```c
void seed() {
    mapping current_cells;
    mapping current_thermal;
    
    current_cells = proxy_me["cells"];
    current_thermal = proxy_me["thermal_map"];
    
    // 1. Conway's Glider (Top Left)
    current_cells[get_key(2, 1)] = 1;
    current_cells[get_key(3, 2)] = 1;
    current_cells[get_key(1, 3)] = 1;
    current_cells[get_key(2, 3)] = 1;
    current_cells[get_key(3, 3)] = 1;

    // 2. Solid Gravity Block (Top Right)
    current_cells[get_key(15, 0)] = 2;
    current_cells[get_key(16, 0)] = 2;
    current_cells[get_key(15, 1)] = 2;
    current_cells[get_key(16, 1)] = 2;
    
    // 3. Thermal Heat Spike
    current_thermal[get_key(15, 1)] = 500.0;

    // Trigger the CRDT network sync
    proxy_me["cells"] = current_cells;
    proxy_me["thermal_map"] = current_thermal;
    
    printf("Genesis Grid Seeded!
");
}

```

### The Live Physics Test

Since the grid is already looping in your browser's memory, you don't even
need to restart the object. Just inject the seed and watch the engine react.

1. Inject the entities into the mesh:
> `eval load_object("gamelib/mesh/genesis_grid")->seed()`


2. Run your display function a few times, waiting a second or two between each
command to let the `tick()` loop advance the generations:
> `eval load_object("gamelib/mesh/genesis_grid")->display()`



You will see the `[O]` glider crawl diagonally across the screen, while the
`[#]` block plummets straight down to the floor. And because it's wired to the
DMZ, if you open Browser B and type `display()`, you'll see the exact same
physical state perfectly synchronized!

Once you confirm the physics are interacting correctly, we have a major
architectural decision to make. Since this is a distributed simulation, how do
you want to handle "chunk boundaries"when that Glider flies off the edge of
Chunk (0,0) and needs to transfer its state into a neighboring chunk hosted by
a completely different browser tab?