Skip to main content

Command Palette

Search for a command to run...

Type 2 - Simulation - Environment

Published
3 min read
Type 2 - Simulation - Environment

In previous post, we discussed roadblocks on building Type 2 Harness UI.

One of the issues was that we needed to build a environment to simulate our digital beings, and we decided to use the Celeste-like environment.

So, we built tile based environment like Celeste.

Map Definition:

<?xml version='1.0' encoding='UTF-8'?>
<map>
  <levels>
    <level
      name="lvl-0"
      width="448"
      height="184"
      x="-48"
      y="0"
    >
      <solids offsetX="0" offsetY="0">
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        00000000000000000000000000111100000000000000000000000000;
        00000000000000000000000000000000000000000000000000000000;
        00000000000000000000000000000000000000000000000000000000;
        00000000000000000011110000000000000000000000000000000000;
        00000000000000000000000000000000000000010000000000000000;
        00000000000000000000000000000000000000010000000000000000;
        00000000001111000000000000000000000000011111110000000000;
        00000000000000000000000000000000000000000000000000000000;
        00000000000000000000000000000000000000000000000000000000;
        00000000000000001111111111111111111111110000000000000000;
        00000000000000011111111111111111111111111000000000000000;
        00000000000000011111111111111111111111111000000000000000;
        00000000000001111111111111111111111111111110000000000000;
        00000000000011111111111111111111111111111111000000000000;
        00000000011111111111111111111111111111111111111000000000;
      </solids>
      <entities offsetX="0" offsetY="0">
        <player id="4" x="224" y="136" />
        <strawberry id="1" x="338" y="108" spawnAfter="2000" />
      </entities>
      <bg offsetX="0" offsetY="0">
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
        ;
      </bg>
    </level>
  </levels>
</map>

Now, the entity can stand and even navigate to adjacent levels.

Basic physics has been implemented as well. If they fall off the cliff, they die.

At this time, they can be controlled using keyboard Left Right Up Down and Space (Jump).

Figure 1: Manual Control

We also realized that we would want basic path finding system. The path finding in the platformer world is not obvious but we got to a satisfactory solution.

Basically, for each standable tile, we do simulations to check reachable other tiles to create a reachability graph (along with movements that can get you there). Then rest is path finding.

Figure 2: Path finding demo. AI controls the character to get from point A to point B.

I think I got too engrossed in this and really need to focus back on to simulating digital being.

However, the key is that we have a world that we can place our digital being on top of and that we solved waypoint navigation.

So, we can ask LLM to just say desired XY position, and we can have our agent move their on it s own.

Next thing to focus on is to migrate this code over to new "anima" repo and add body simulation to it.

We won't be working on making this pretty at this point in time. The goal of agent is going to be to stay alive. I think we will make the food spawn randomly at a location and have LLM determine next action based on current state. For the LLM, we will start with few-shot prompting on OpenAI APIs.

Tricky thing is that we are not sure how to provide a challenging enough scenario.

It would be good to have something that requires world knowledge like grabbing a key and then opening a door. Or something like adding adversary to make it so that character can run away.

-- Sprited Dev 🐛