After the Collapse – devlog #1 : Setting up the basics

This was a decent week. I implemented the two most fundamental parts of any base building game: the ability to store resources in zones for later use, and factories able to convert basic materials into more useful items. Settlers’ ability to move resources around accordingly seems to be working properly. I can have multiple active ‘factories’, building locations and storage zones simultaneously and required goods get moved around without performance or logic problems.

Let’s dissect a forge

As I’m not too keen on showing awful looking screenshots at the moment, here is how a factory looks like internally instead (click the image on the right to enlarge). This is a JSON text file, perfectly editable with any text editor.

First part until “light source” defines the basic properties and is common to all game objects (name, hp, sprite when alive, sprite when dead, and so on). It’s followed by the data of each independent component making the object. Here, the components are:

  • LightSource: It’s decorative here and means that this forge will produce a constant, slightly red, light.
  • BuildReq: For building requirements. It lists the basic materials needed to construct the forge (5 wood logs and 5 stones). Incidentally, it puts the forge in our build menu.
  • InventorySpace: Gives some inventory space to our forge so it can temporarily store resources.
  • Factory:  The important component here. We list the various recipes the forge has access to (stored in other files). We also set if the factory need a settler using it or if it’s automated.

Of course, we have more components for other object types (from simple doors and beds to automated turrets). The main idea here is to showcase the modular system, and demonstrate how easy it will be for modders (and myself) to alter content. Also, contrary to my previous project in which any small change to the data format would break savegames and mod compatibility, here the game will assume default values if a field is missing.

Item storage

I’m not reinventing the wheel here. Items are stored in filterable stockpiles. There are good reasons why the vast majority of colony builders are using stockpiles to store items. For performance reasons, looking for items in specific area is advantageous. It’s also part of the game to organize resources optimally around the colony.

Right now items are placed individually into stockpiles (one per map ‘square’). However it’s very likely I will allow for some degree of stacking so we do not end up having items all over the place. I’am also considering the pros and cons of using chests/boxes for stacking purpose.

Short-term goals

Goals for the coming week are to add the basic interface to place and configure stockpiles and factories. I don’t want to do anything too fancy given that, for now, the UI is mostly a placeholder. Also the simple system I’m using to store the jobs posted by the factories and the player is starting to show its limits, so i’m going to overhaul it. Modifying how public jobs are set will also be our first foray into customizing settlers. The idea is of course to assign professions to settlers, and in the long term make them gain experience doing specific jobs.

The mid-term goal is to have the very basic framework of the game ready within a month. Which means:

  1. Add basic mining / resource collection
  2. Add various objects and item for food, weapons and ammo production and needs
  3. Test and complete friend/foe detection and behaviors
  4. Add basic enemies that will occasionally attack the base