Skip to main content

Trees on the land

Agreed with the owner 2026-11-13. Built for the test area the same day (below). It covers dressing the land, step 3: the trees of the generated continent and isles, every one of them fellable. Placement, the kind of country each species grows in, is planned here too, because the generator places the trees as it writes them into the tiles.

The problem​

The home island has a few hundred trees, each a node: one row in world_entities. The generated land is about 80 × 50 km plus its islands. Wooded properly, that is millions of trees, and millions of node rows would choke the database and the server.

The plan in short​

  1. Trees live in the tiles, like grass. The generator writes each tree into its tile's instances: which species and which of its models, where it stands, which way it faces and how big it is. Nothing goes into the database.
  2. The client draws them from the tiles it already downloads. Near trees are the full models; far ones are the billboards, out to 2 km, as now.
  3. Any tree in a tile the server holds can be felled. The server already keeps every tile within 1 km of a player in memory (TileStreaming.cs). A tree in one of those tiles is a real tree: chopping, lore, axe, three logs, the felled log lying by the stump, felling whole for a trunk. It is all the same code as the home island's trees. There is no separate step where a tree "turns into" a node.
  4. Only what players change is saved. A felled tree is written to one small table: its tile, its number in the tile, and when it was felled. So the database holds thousands of stumps, not millions of trees.
  5. Regrowth. A felled tree leaves a stump. Some days later a sapling stands there, then a young tree, then the full tree again (times below). The sapling and the young tree are the same species' smallest model, scaled down.

The home island, West Isle and Orochi Isle stay exactly as they are. Their trees are nodes, they come back the next day, and they are not touched.

Where each species grows​

Kinds of country come from the generator's climate map (temperate, alpine, marsh, dry). Water comes from the rivers and lakes.

CountryWoodsUnderstorey and edges
Temperate, lowlandoak, beech, ash, linden, field maple, birch, wild cherry; giants (oak, beech) rare in old woodshazel, holly, hawthorn
River banks and lake shores (within ~30 m of water)willow, alder, poplar; the leaning and riverbank forms only here
Marshswamp cypress (the kneed form in the wettest parts), alder, willow
Uplands and mountainsidesScots pine, spruce, larch, birch, rowan (crag rowans on steep rock)juniper
Near the tree linestunted pine, birch, rowan; the windswept larchjuniper, including the creeping mat
Above the tree lineno treesthe juniper mat on its own
Dry landScots pine, oak sparse, hawthornjuniper
Hedges along meadow edgeshawthorn, hazel, holly, rowan
  • Nothing stands in water. No tree grows on river carving, in lakes, or on slopes too steep to stand on.
  • Odd forms stay rare. The blossoming cherry is a rare, special tree. The pasture thorn and the fairy thorn stand alone in meadows.
  • Mixed woods and meadows come by noise: dense forest, open woodland and clear meadow, thicker in wet country, sparse in dry.

Decided (2026-11-13)​

  • Density, medium: dense forest about one tree per 60 m², open woodland a fifth of that, meadows a few lone trees. To be measured on the test area for the client's frame rate.
  • Regrowth in about a week: stump for one day, then a sapling, a young tree by day 4 (it gives one log), and the full tree by day 7.
  • Stumps: a felled tree leaves a stump of its own bark and size until the sapling comes.
  • Test area first: one area of a few km² of mixed country near the coast, to check the look, the felling and the frame rate, then the rest.
  • Seasons later: every species gets seasonal variants when the calendar system has its next pass. The trees are summer-only until then.

Built (2026-11-13): the test area​

  • The list: tools/worldgen/tile_trees.json, the one list of trees, with copies at godot_client/data/ and Moondog.GameServer/Data/ (scripts/check_tile_trees.py checks the copies match and every model exists). Each species has its index, model count, trunk radius, which models are special, and its weights by zone. A tree's MeshId is 1000 + index × 10 + model.

  • Planting: tools/worldgen/plant_trees.py reads copies of the live tiles, replaces their trees (grass and anything else stays) and writes them with a new stamp. It also draws a map of what it planted. The test area is x 16,000 to 19,200, z −31,232 to −28,160 (156 tiles, 73,324 trees, about 10 km² of coast, temperate lowland, dry patches, uplands to 460 m and a small river; no marsh). The originals are kept in ~/moondog-tile-backups/pre-trees-2026-11-13 on the R710. Before the planted tiles went live, the live tiles were checked to be unchanged since they were copied.

  • The client (scripts/terrain/TileTrees.gd): far trees are billboards, one MultiMesh per tile and billboard sheet (models/trees/materials/tile_tree_impostor.gdshader), out to the tiles' reach. Within 90 m the trees are the full models (bark, leaves, shadow crown), gathered again every 12 m the camera moves. Within 36 m each trunk has a collider carrying tile_tree = "tx,tz,index" for E (ClientInput: tap to fell for logs, hold to fell whole).

  • The server (TileTrees.cs): trunk colliders for every tree in the tiles it holds. ClientFellTileTree(tx, tz, index, whole) makes the tree a world_entities row of its species' node type at its exact place, with NpcData {"tile_tree": "tx,tz,index"}, then fells it with the ordinary code. A felled row is depleted for 7 days; it is sent with stage (stump to day 1, sapling to day 4, young to day 7) and then deleted, so the tile's tree stands again. A row only part felled is let go from the next day.

  • The client draws a row in the tile tree's place, turn and size, and leaves the tile's copy out; while it grows back it shows the stump (a short trunk of its bark) or the sapling or young tree (its first model, small).

  • Check: scripts/check_tile_trees_live.py TILE_DIR fells a planted oak through the real client: the row appears at the instance's place, gives oak logs, and is sent as a stump. It passed 2026-11-13.

  • The young tree (days 4 to 7) gives one log: E on it (it has a small trunk to aim at) lays a log of its wood by the stump, with the axe worn and the lore and felling XP of one stage, and it is a stump again from then. A stump or sapling says it has nothing yet, and a tree growing back can't be felled whole. The live check's step 4 ages a felled oak to day 5 and cuts it; passed 2026-11-13.

  • Static entities by distance (Broadcast.cs, 2026-11-13): each client is sent only the static entities (trees, felled rows, stations, NPCs, props) within 2 km of it, worked out again when anything changes or it has moved 250 m, and not sent when its list came out the same. Far ones drop off the client's list. The live check's step 3 checks nothing past 2 km arrives.

  • The whole land planted (2026-11-13, owner approved the test area): every generated tile but the home island's and the test area's (43,392 tiles, 15.4 million trees), on copies, 2 low-priority processes on the PC (--skip-newer to finish a stopped run). The live tiles were checked unchanged since copying before each was swapped in. Originals: ~/moondog-tile-backups/pre-planting-2026-11-13 on the R710. A marsh sample (3 km round -31,856, -43,856) came out swamp cypress, alder, willow and poplar first, with birch, ash and a few oaks; nothing in its lakes.

Not yet:

  • Undergrowth (grass and wildflowers, reeds, ferns and bushes) and the seasonal tree variants, as agreed in the dressing-the-land plan.