Posted January 26, 2022 by Robin Johansson
#Industries #Resources #GUI
This version finally introduces some early gameplay. It is now possible for the player to build industries on tiles. These industries consume and produce resources. These resources are then transported throughout the network through diffusion. Some of the industries like the "gold smith" and "foundry" require resources produced by other industries. The production chains aren't that complex, but it's a start.
The new map filter GUI separates the filters into multiple categories. The filters used for natural resources and resources are generated on program startup from .xml files. This drop down menu makes it faster the find the filter you are looking for.
At the moment 2 kinds of natural resources exist. Minerals (iron ore, coal, gold) and ecosystem related natural resources (forest, animal). Mineral resources are generated using perlin noise. Minerals are generated with unique parameters which changes distribution and rarity. Gold for example is very rare, whilst coal is common.
Ecosystem natural resources are directly mapped from ecosystem biomass.
The following image shows a part of the .xml file used to define resources. Some resources have tags, examples are "fuel" and "food". These tags can be used as input to industries. An industry that requires 10 "food" can either take 10 grain, or 2.5 meat. This .xml template file makes it very easy to add new resources. At the moment this .xml file is compiled into the build, so players can't change it. Only I can change it as I develop the program. But in the future I should probably make this file editable by everyone, which would allow people to mod the game.
At the moment resources are transported using diffusion. This is just a temporary solution, later on I'll implement a weight based approach. Resources are only transported on the so called transportation network. The transportation network is defined as all tiles containing industries + adjacent tiles.
Industries are what I call the "buildings" that players can construct on tiles. At the moment this includes things like "farm", "lumbermill", "smith". These industries takes resources or natural resources as input. They can also have "tags" as inputs, in that case any resource with the matching tag can be used as input. Industry input->output production occurs each time the players presses the "NEXT TURN" button.
The following image shows an example of the industry GUI for the "lumbermill". It takes the natural resource "forest" and the resource "labor" as input. It produces the resource "wood".
At the moment industries are just implemented for land tiles. Ocean industries will have to be implemented later.
These GUI elements are generated using prefabs in Unity. Something which I'm pretty new to, but they are very useful when multiple similar objects are to be created.
Just as with the resources, industries are defined using .xml files. In the .xml file stuff like inputs and outputs can be defined.
The following gif and image shows examples of the industries in action.
Long term items are not listed in chronological order.