mossfield origins - dev #4

building tech trees



Stock transit

Yesterday I fixed tasks and the stock movement, and today I did a bit more work on that to fix some issues and tidy up usage. Also it's amusing when your resources pile up, at least you know you're good for a while...

Mainly, that any resource that's being transferred somewhere, isn't considered available for building. It's possible to make it only do that if it's actually going toward construction, but nobody is going to go grab that stock out of someones hands, so in reality it can't be used while in transit. Here's an unexciting video showing the numbers go down while they carry it.


Tech tree expansion

Since pathfinding is easy to add and doesn't impact gameplay much yet, I decided to focus on blocking out the full tech tree that's defined at the moment.

This means for every building intended to be in the game, it's now buildable.

That doesn't mean they all do what they intend to, just that they can exist in the world and all their data is set up to add the content +
mechanics onto. I'll start adding the proper behaviours on them next.

Building implementation

This step involved a lot of copy paste and minor edits, because all construction + buildings work the same way. With luxe, I use prototypes (prefabs) to define a building, and that includes any pre-configured entities as necessary. Here's how the current system works, each building has this data:

- info - the title, icon, requirements and upgrades (data)
- readme - markdown files for display. one for before build, and one after
- construct - a prototype with instructions for a construction, including what to build and the steps
- construct.0...N - individual construction steps, one prototype per step
- building - the completed building prototype

Below you can see the main foundation building in the folder.

The construct file tells the construct modifier system how to build the building.
This is the luxe 'lx' format, it's like json for humans.

The rest just contain regular luxe entities and modifiers configured as needed.

And the info file is pretty much what you'd expect in a simple data file.

Markdown is markdown. It displays it in game with basic formatting

Placeholder prototypes

To work quickly, I made two placeholder prototypes, one called building.tmp and one called construct.tmp.

Prototypes can be embedded in other prototypes, so for every new building I added, instead of making unique data, I made the construct.0 step reference the placeholder. Similarly, for every building, it references the temporary building prototype. The temp building embeds the shared building prototype so it functions as a building, as well as an icon. When a building is spawned, I check for the presence of the temporary prototype, and then set the icon from the info file.

This is why all the new buildings are just giant icons, but it's necessary to be able to distinguish between them while working. I think it works well, and the game could be playable even without the other visuals. Here they are in motion, showing one of every building + it's foundation.


There's always exceptions, I made one building actually visual which is the tree "building". I made a tree modifier that switches the mesh randomly and shifts it around off the grid on spawn, just for fun.


next...

I've got a few quick tasks with well defined needs ready to go:

  • I'd like to get all the functional producer/consumer buildings set up, that won't take long but will be one step closer to playable without cheating for resources, and the start of some balancing.
  • I've also got the 'residence' system worked out, so that new people will arrive and people will leave, that should also be a quick one.
  • The stock pile building, which will make construction further away less slow, and generating the tasks to move stock to it from producers.
  • And lastly the power grid, it's binary atm but there are producer/consumer buildings that need power, and I want to get all the relevant gameplay systems in place.

There's plenty more (like food and water) to go though. Till next time!