Moondog, day 22 (11 Nov): a shipyard, a fleet, and a much bigger world

About 150 commits. The morning was crafts and ships, and the afternoon was splitting up the server and planning a world hundreds of kilometres wide.

Smithing, rebuilt

I rebuilt smithing in six stages. Metals now work like woods: each one has real figures (density, strength, hardness), and the items made from it carry the metal. There's one Axe Head made of iron or copper, not a separate item per metal. The old ore chain is back: crush the ore, smelt it with charcoal, and burn the charcoal at the kiln from firewood of one wood.

Then the Forge and the Anvil. The forge puts a hot piece into your tongs, and the anvil takes it from there. Hot metal never goes in your pack, so you can't trade it, drop it or store it. If it cools before you work it, it goes back in the pack as cold stock. After that came tin, bronze, pewter and solder, fish oil rendered at a campfire or try-pot, and a ship's lantern that burns it.

The crafts a shipwright needs

Before ships could be built, the materials had to exist:

  • Long timber. Hold E on a tree to fell it whole. A trunk falls, sized by its wood (sugi up to 20 m, oak 10 m), and you work it where it lies into beams, sawn or riven planks, and spars. Only the log cart can haul long pieces.
  • Fibres. Linen, hemp and bast each carry their fibre through thread, cloth, cord and rope. Hemp is a new garden crop. A 21 m² bolt of sailcloth takes 240 thread of one fibre at the loom.
  • Caulking and ironwork. Tar carries its wood. Anchors are made at their real weight, plus cable, chain and hull fittings. The new Pole Lathe makes rigging blocks, deadeyes and hearts.

The shipwright

The harbour has three slipways now: two of 32 m and a great one of 60 m. Claim one and anyone can deliver materials to it, from a pack or a cart. A ship is built the way houses are. Her clock runs while her shipwright is at the slipway or logged out. She's keel-laid, framed and planked at each quarter, then launched where the water first floats her, built in her planks' wood.

Eight ships in a day

Each ship went through the same loop: agree the design, write a model script for her alone, add her database row, and run a live check that boards her and tries every station. In order: the galley, the sekibune, the longship, the junk, the bezaisen, the brig, the galleon and the atakebune. I rewrote the earlier sekibune, longship and junk models from scratch to match the newer ones.

Rowing came in with the galley. Each oar bench is a station: hold W to pull, S to back water. Pets that can row take a free oar when told and pull to the stroke set at the helm. Ships also feel their cargo now. A full hold makes a ship 25% slower, under sail or oars.

ServerMain, split

ServerMain.cs had grown into one enormous file. I cut it into 38 partial-class files (Combat, Quests, Carts, Mounts, Login, Ground and so on), moved verbatim with no behaviour change. The RPC contract check gave the same results before and after.

Large worlds

The big decision of the day: the world should be about 350 km across, a quarter of it land, half a day to cross. That means streamed terrain tiles of 256 m, our own land generator, full detail out to 2 km, and eventually a double-precision server.

Stage 1 was making the existing world cheap when nobody is around. With no players online, creature AI cost about 30% of a core. Now creatures with no player within 500 m sleep: they go home calm, and their spawners wait. That took it from 28% to 0.1%. On the way I found hunters checking every creature in the world ten times a second for prey. Now they only look at the kinds they hunt.

Waking a cell caused a stall of about 850 ms when a player arrived. Part of it was every sleeper asking for a path on the same tick, so waking is now spread over a few seconds. The rest turned out to be first-use compiling of code that had slept since start. A warm-up hack didn't cure it, so I reverted it and left that cause open for a later day.

I also cut the navigation mesh into 256 m cells, switched on only near players. Godot's navigation queries check every polygon on the map with no spatial index, about 5 ms each, so I wrote our own nearest-point lookup that only searches nearby cells.