Machi - Multi-Agent Simulation

Sprited DevSprited Dev
2 min read

This documents the ideation and origin of World Generation logic in Machi.

The world generation will itself be a large simulation. There will be few requirements.

  1. 1 or more planets should be generated.

  2. Generation happens using a random Seed number.

  3. The generation of the world should happen without any human intervention.

How to form planets randomly

We will take inspiration from previous Ants’ Art project (more in this at later posts). Long story short, the Ant’s Art is a multi-agent 2D simulation of particles that form shapes from simulating particles independently. Interestingly the outcome of this simulation is set of loops. Most are circles or ellipsis but some are twisted loops.

The property is that each loop is continuous and each loop rotates at constant speed. It even evolves and shifts, and in some rare situations explodes—reminiscent of supernova explosions.

Basically, we will reuse the code created for this Ants’ Art project, and use it to generate the Machi worlds.

Each loop will be machi planet. And at some point these machi planets may “explode“ too—then those exploded chunks get integrated into other planets if they are lucky.

This is all so much cryptic and I’m speaking nonsense but perhaps it is better I show you pictorially what is going to happen.

Here is a reproduced version of Promisers (the original name of Ant’s Art project): https://kndlt.github.io/antsart

Basically, little “ants” are tiny agents that follow each other. Eventually forming loops in random locations. If they end up too close together, they explode.

Given this behavior, I am planning to simulate this in a very slow fashion to give an illusion that the universe is not just a static piece that is encoded in the disk. It is a living thing that breathes.

Now, given this simulation. How do I connect the dots between Machi project and Ants’ Art. After looking into how this promiser thing work, I notice one issue. How do we detect that there is a planet?

Each ant denote a Machi plate. It’s ant’s target is plate’s Left link, and right link is the closest follower.

This is all good in concept, but I think it will eat away lots of time to implement this correctly. So, I’m going to drop this idea at this state and work on the 2d side scrolling portion for now.

0
Subscribe to my newsletter

Read articles from Sprited Dev directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sprited Dev
Sprited Dev