The COG Factory / COG Factory Experiments

The Crab Pen

2026-10-01
DOWNLOAD ZIP · 981 KBBUILD 12026-10-01
The Crab Pen

Gnarly's crab, made a Jedi Knight enemy you can drop into any level: scaled down, animated (a sideways scuttle, side-steps, a claw smash, a pincer snap, a pounce, and a death that flips it onto its back), and run by a swarm controller. Six of them leap out of an acid pool, fan out round you, circle facing in, and come at you two at a time, or back off and pounce. Kill them and the next six come. The same kit puts the crabs in the kraken boss fight (p59).

Stock enemies chase; a swarm needs a controller. Underneath, the crab is a stock melee actor -- the gamorrean's path: with the DELAYFIRE flag the AI's PrimaryFire plays the claw key, and the key's type-3 MARKER fires an instant-impact weapon at that frame, so the claw lands when the claw comes down. On stock Follow six of them simply MOB the player: all six in claw reach in every snapshot, 618 swings in the test (the located control). The controller steers each crab itself every tenth of a second: each heads for its own bearing round the player, holds a ring facing him (the strafe keys: a crab side-stepping), and only two hold a token to strike at once; some back off and LEAP. Same six, same arena: ring coverage ~220 degrees, never more than two in reach.

Retail JK's COG has no trigonometry (sin/cos are openjkdf2's enhanced verbs), so every direction is a vector, and a leap is v = D*E + (0,0,H) with E and H solved by the generator for gravity and the actor's air drag. A cog leap needs DetachThing first (attached, the vertical velocity is removed every tick), an actor flag to stop the AI's own thrust bending the arc, and a floor-stick to land; from under the acid a launch goes nowhere, so a crab that falls in is teleported to the surface first. The first arc out of the pool met the 0.12 lip at floor height and three of six fell back.

The model was already cut -- Gnarly had jointed all 33 pieces on shared vertex rings -- so the kit only scales it, re-centres it on its shell and moves the body's joint there. Two engine facts it paid for: an actor's movesize= is ignored (size= sets both radii, so the first crab floated 0.02 off the floor), and a walk key with puppet flag 0x01 advances 280 frames per unit travelled, so the scuttle's length is solved from its stride. Gate 4 of 4 with one located control, GOB build 1; retail JKDF2 has not run it.
projectp60-crab
date2026-10-01
packageP60.GOB, readme.txt, screenshot.jpg
build1 — 2026-10-01
sha2562ad5a217f23fd6c587656fd386d36a48abe964564724df333bb3cccba6007fc0

Installing it

  1. Unzip it.
  2. Drop the .GOB into the episode folder of a Jedi Knight install — the one that already has JK1.GOB in it.
  3. Pick it from the episode list. On a libretro frontend, load the .GOB itself as content.

The GOB carries its own level, cogs, models, materials, and sounds. Everything else is read from the stock resource/, and there is no retail game data in the zip.

These are living projects, not finished releases. A level is rebuilt whenever something is learned — a lighting rule, a texture orientation, a whole detail pass — and it keeps its filename through all of it. The build number is how to tell which one you have: it is printed in the readme inside every zip, and it only moves when the level's bytes actually change.

Screenshots

The readme that ships with it

========================================================================
 Jedi Knight Level

 P60.GOB

 A test arena for the crab kit: a room with an acid pool. Six of
 Gnarly's crabs leap out of it, fan out round you, circle, and come in
 two at a time to claw you, or back off and pounce. Kill them all and
 the next six come.

 [cogfactory / p60-crab]

 BUILD 1  --  2026-10-01
 sha256 2ad5a217f23fd6c587656fd386d36a48

 This level is not made or distributed by LucasArts
 Entertainment Co.
========================================================================

THIS PACKAGE
------------------------------------------------------------------------
  P60.GOB          the level
  readme.txt       this file
  screenshot.jpg   what it looks like

INSTALLATION
------------------------------------------------------------------------
Drop P60.GOB into the `episode` folder of a Jedi Knight install (the one
that already has JK1.GOB in it) and pick it from the episode list.
Nothing else needs to change: the GOB carries its own level, cogs,
models, materials and sounds, and reads the stock resource/ for
everything else.

On a libretro frontend such as RetroArch, unzip first and put P60.GOB in
the episode folder of your Jedi Knight folder, then load it from there.
The core treats the folder above the GOB's folder as the game folder,
reads the episode from episode/P60.GOB inside it, and will not start
unless that folder also holds resource/ (Res2.gob) from a real install.

CONTROLS
------------------------------------------------------------------------
  shoot the crabs: forty points of health each

NOTES
------------------------------------------------------------------------
  the crabs come from tools/cogfactory/projects/p60-crab, the same kit
  p59's kraken summons

WHAT IS IN THE GOB
------------------------------------------------------------------------
        78  episode.jk
     12200  jkl\crabpen.jkl
      2234  cog\crab.cog
     18844  cog\crabswm.cog
      3025  cog\p60test.cog
    225849  3do\crab.3do
    158293  3do\key\crbdie.key
     56289  3do\key\crbhit.key
    212678  3do\key\crbidle.key
     56290  3do\key\crbland.key
     69886  3do\key\crbleap.key
    219475  3do\key\crbrun.key
    117573  3do\key\crbsmash.key
     83582  3do\key\crbsnap.key
    131102  3do\key\crbstnc.key
    171890  3do\key\crbstrl.key
    171890  3do\key\crbstrr.key
    158294  3do\key\crbwalk.key
    174220  mat\acidbase.mat
    174220  mat\acidwave.mat
    524428  mat\crabss.mat
      8332  mat\p60ceil.mat
      8332  mat\p60flr.mat
      8332  mat\p60wall.mat
     50318  sound\crbdie.wav
     38852  sound\crbhiss.wav
     21212  sound\crbhurt.wav
     19888  sound\crbland.wav
     26504  sound\crbsmsh.wav
     17684  sound\crbsnap.wav
     35324  sound\crbsplsh.wav
       397  misc\ai\crab.ai
      1325  misc\pup\crab.pup
       635  misc\snd\crab.snd

   2979475  bytes in 34 entries

CREDITS
------------------------------------------------------------------------
  The crab (crabs.3do, crabss.mat) is Gnarly's; the acid materials are
  SM Sith Lord's (Asylum of Mortality); the rig, the animations, the
  cogs and the arena were generated by tools/cogfactory; the crab's
  sounds were generated with ElevenLabs.

  The readme format is styled after SM Sith Lord's cog headers,
  because his are the ones everybody read.

========================================================================