A cave - exterior view.
One of the two rock meshes in the game, scaled up about 50x.
a second rock mesh with "black" texture forms the entrance.
CAVEMAN draws 3 types of scenes: outdoors, in_cave, and in_cavern. When the player approaches the entrance to a cave, it triggers the "enter cave" action. about 5 seconds of game time pass, then the view switches to cave interior.
Caves can be unoccupied, player controlled, occupied by neutral or hostile cavemen, or by wild animals. Cave occupants change at random over time, with a given occupant present for about 3 game months on average.
The player takes over a cave by kill or driving off any occupants, and then building a fire, bedding, or storage pit in the cave (signs of occupation).
The game tracks how many days since the player visited one of their caves, and the chance of something taking it over is based on how long its been since it was last occupied.
Caves provide shelter from rain, and prevent rain from putting out fires. The game models things like exposure, and fire's effects on encounter chance, so being dry and having a fire are important.
Based on the size of the game world, and the estimated number of caves in the real world and what type of terrain they appear in, there are 65,000 caves in CAVEMAN. they're stored as a list, an array of structs. this list is indexed to speed searches. the world is 500x500 map squares of 5x5 miles each. the list of caves is bucket sorted on map x,z into a 500x500 array index, with each index entry being a list of the caves in that map square.