Spider Bot build log - WordPad
✕
C:\ar9av\builds\SPIDERBO.TXT
  1. Desktop
  2. Build Log
  3. Games

Build log · Games

How I built Spider Bot

A wireframe spider on 3D two-bone IK legs, hunting words through a city of text

Screenshot of Spider Bot running in the portfolio
Spider Bot, running on the desktop. Open it yourself →

1.Why I built it

Spider Bot started as a procedural IK spider that followed the cursor, with servo and footstep sounds. The source credits two pieces as inspiration: everything.bends' reel "What do you know about me?" and rybinfx's "Making new friends". The second one is where the recruiting came from. Touch a wild spider and it joins you.

Later I turned the toy into a game. Words from a hidden secret about me are scattered around an endless city. You collect them to decode the secret while your battery drains, and red Sweeper spiders hunt you by sight.

2.How it works

Legs are 3D two-bone IK

Each leg has a hip on the body rim, a knee, an ankle and a foot. The foot is planted in world space. The ankle sits a short tarsus length above the foot, splayed slightly outward, and the hip-to-ankle distance is clamped to 99.5% of the two bone lengths so the solve never fails. The knee comes from the circle-intersection form of two-bone IK: a = (L1² − L2² + d²) / 2d along the hip-to-ankle axis, and h = sqrt(L1² − a²) out from it.

The direction of h is a bend hint that points up and slightly outward from the body. I remove its component along the hip-to-ankle axis so it is perpendicular, and that gives knees that rise above the body the way a real spider's do. The hip, knee, ankle and foot are then projected to the screen and stroked as one polyline.

Tripod gait from leg ordering

Hip angles are ordered around the rim so that legs i and i ± 1 are physical neighbours. That makes i % 2 split the legs into two alternating groups: a tripod gait for six legs and a tetrapod gait for eight. While moving, a group lifts together once the previous group has nearly landed and some leg in it has drifted far enough from its ideal spot. The ideal spot is predicted ahead along the velocity and the turn rate, so feet land where the body is going to be.

Idle spiders shuffle one leg at a time and never lift a leg next to one that is already up. A swinging foot follows an eased curve with a sin(πt) lift and keeps retargeting mid-swing so fast turns don't leave it behind. The body sways toward the centroid of its planted feet, turns on a damped spring, and has a leash that slows it down when its feet fall too far behind.

A tilted city of text

The world is drawn in a 3/4 projection: ground y is squashed by 0.78, height lifts things up the screen, and a small perspective term pushes tall things away from the centre of the view. The city is endless and deterministic. Each 430-unit cell has a 68% chance of holding one building, with size, height, rooftop units and screen position all taken from an integer hash of the cell coordinates, and results are cached.

When a foot would land inside a building, it plants on the nearest wall instead, higher the deeper it reached in. That is the whole wall-climbing system. Building walls show scrolling lines from a corpus of facts about me, which is also where the secret words come from.

Sight cones and stealth

Sweepers patrol with a sight range of 380 units and a half field of view of 0.75 radians. They target you or one of your recruited spiders when the target is inside the cone and the line between them doesn't pass through any nearby tower. A spotted player can break line of sight by putting a building in the way.

Your battery drains faster on each level, getting caught costs 20%, and words recharge it. Spiders you recruit pick up words too, and Sweepers can delete them.

Five species with their own sounds

Crawler, Tarantula, Skitter, Longlegs and Mech each have their own leg count, bone lengths, ride height, body polygon, speed and step time. They also differ in sound. Every foot plant mixes a metallic ping, a noise click and a low thump with per-species weights. Each leg lift plays a servo whir, a hydraulic hiss, a chitter or a creak, all built from Web Audio oscillators and filtered noise and panned by screen position.

Each spider also carries a quiet sawtooth hum through a low-pass filter, and its pitch rises with speed.

3.Try it

Point or use WASD to steer (drag on touch), collect the green words, and hide from red Sweepers behind towers.

More from the build log

Spider Bot · 3 min readAll 29 builds