Skip to main content

Command Palette

Search for a command to run...

Digital Being - Compiling and Previewing the States

Published
โ€ข2 min read
Digital Being - Compiling and Previewing the States

Now, let's continue from previous post, and compile states into a entity definition.

Here are the states we've generated.

Reference
Idle
Greet
Run
Sit
Walk
Look
Sad
Happy
Hungry
Sleeping
Pain
Combat Stance
Punch
Kick
Push
Pull
Laugh
Craft
Immobile

I've compiled them into a single entity:

{
  "kind": "humanoid",
  "world": "machi",
  "initialState": "idle",
  "textureSize": [256, 256],
  "defaults": {
    "state": {},
    "animation": {
      "box": [110, 60, 30, 160],
      "loopCount": 0
    }
  },
  "model": {
    "runner": "random",
    "description": "This is a uniformly random character state player.",
    "params": {}
  },
  "states": {
    "idle": {
      "animation": "idle-1",
      "nextState": "idle"
    },
    "walk": {
      "animation": "walk-1",
      "nextState": "idle"
    },
    "run": {
      "animation": "run-1",
      "nextState": "idle"
    },
    "sit": {
      "animation": "sit-1",
      "nextState": "sit"
    },
    "jump": {
      "animation": "jump-1",
      "nextState": "jump-1"
    },
    "sleep": {
      "animation": "sleep-1",
      "nextState": "sleep"
    },
    "cry": {
      "animation": "cry-1",
      "nextState": "idle"
    },
    "weave": {
      "animation": "weave-1",
      "nextState": "idle"
    },
    "got-hit": {
      "animation": "got-hit-1",
      "nextState": "idle"
    },
    "happy": {
      "animation": "happy-1",
      "nextState": "idle"
    },
    "hungry": {
      "animation": "hungry-1",
      "nextState": "idle"
    },
    "laugh": {
      "animation": "laugh-1",
      "nextState": "idle"
    },
    "engage": {
      "animation": "engage-1",
      "nextState": "idle"
    }
  },
  "animations": {
    "idle-1": {
      "texture": "entity-idle.webp",
      "loopCount": 1
    },
    "sit-1": {
      "texture": "entity-sit.webp",
      "loopCount": 0
    },
    "run-1": {
      "texture": "entity-run.webp",
      "loopCount": 0,
      "actuation": {
        "type": "ground",
        "perFrame": true,
        "vx": 2
      }
    },
    "walk-1": {
      "texture": "entity-walk.webp",
      "loopCount": 0,
      "actuation": {
        "type": "ground",
        "perFrame": true,
        "vx": 1
      }
    },
    "jump-1": {
      "texture": "entity-run.webp",
      "loopCount": 0,
      "frames": [0]
    },
    "sleep-1": {
      "texture": "entity-sleep.webp",
      "loopCount": 0
    },
    "cry-1": {
      "texture": "entity-cry.webp",
      "loopCount": 0
    },
    "weave-1": {
      "texture": "entity-weave.webp",
      "loopCount": 0
    },
    "got-hit-1": {
      "texture": "entity-got-hit.webp",
      "loopCount": 0
    },
    "happy-1": {
      "texture": "entity-happy.webp",
      "loopCount": 0
    },
    "hungry-1": {
      "texture": "entity-hungry.webp",
      "loopCount": 0
    },
    "laugh-1": {
      "texture": "entity-laugh.webp",
      "loopCount": 0
    },
    "engage-1": {
      "texture": "entity-engage.webp",
      "loopCount": 0
    }
  }
}

Sample Playback Demo

https://codepen.io/jin-hyuk-cho/pen/GgjYoOp

After I take a break, I will look into how to model character controller.

-- Sprited Dev ๐Ÿ›