Devlog 8

One name for each thing, and a camera that stays centred

Another day mostly of tidying, with one change you can feel while playing: the camera now keeps the player centred while moving.

The camera stays centred

While running, the figure used to drift off the middle of the screen as the camera caught up with it. Now, across the ground, the camera follows the feet exactly, so the figure stays centred while running, turning and stopping. Over steps, jumps and falls the height still eases after the player.

One name for each thing

The first cleanup finished. Things that had two names now have one: trees and everything else stamped into the world share one name, and "reach" means only a distance. In the Object Creator, the names that meant a body part now say part.

Every random roll in the world now goes through one small set of helpers, and the rolls are finer than before. So a seed makes a different world from the one it made yesterday, with the same amounts of trees, boulders and towns. And no tree is skipped any more because a boulder is in the way: each grows by its own rules, and where a trunk and a boulder meet, the tree shows.

An oak's trunk rising out of a pale boulder on a grassy hillside, the player clinging to the trunk under the leaves, with more oaks and green terraces behind.

A second tidy

A second read through the code found more to tidy, step by step:

  • Comments that sat on the wrong code, or described code that has since changed, now say what is there, and a function nothing called is gone.
  • Code written more than once is now written once: wrapping a number round, finding a loaded piece of land, the buttons both creators drew by hand, the blur, and the outlined text in the menus.
  • Names say what the code does, and the wireframe view has one switch, on F3.
  • Long functions read as named steps, and the biggest files are split by subject: the world generator into making the land and stamping things onto it; the game's main file into loading assets, drawing the world, and day and night; the HUD into the trade screen and the chat; and the Object Creator's model into a file of its own.

One small change rode along: after loading an object, the Object Creator's view now jumps to it, like every other way of opening one.

Proof nothing changed

After each step, worlds from several seeds were built with the old code and the new and compared piece by piece, land, meshes and towns, and the Sound Maker's sounds byte for byte. Everything matched.

The player standing on a pale boulder in the snow beside a tall pine, with more pines, a snowy slope and a grey and orange cliff behind.

A new look for this site

The home page now shows the newest devlog large, with the rest below it, and each devlog has the ones before and after at its top, and a button back up once you've scrolled down.

Back to building next time.