Originally posted: 08/02/2016
The 10th episode in our series of behind-the-scenes developer diaries has been released! This week you get to meet Daniel, one of our programmers who will tell you more about the new environment system in Medieval Engineers.
We made the system to support the features we already had in Medieval Engineers – cutting trees, collecting items from the environment, etc. – which now need to be supported on planets. We went about implementing the environment system by splitting the system into two parts. The first part is responsible for generating what should be on the surface of the planets, and it generates these items using a set of rules.
Each item is categorized into a particular type. The type consists of a provider, which defines the storage and life cycle for the item. For instance, our “tree” and “gatherable” types are growable. That means that once the items are generated, they are managed by a piece of code that determines the next growth steps, how to save the item once it’s cut, etc. All of these items also have a “proxy” that defines how to interact with them once in the world. For example, trees are both gatherable and cuttable.
This system handles all types of environment items that we have – not only vegetation, but also stones on the surface of the planet, AI spawning, simple bushes, etc. The items are defined, and we also define where they spawn – this is determined by slope (angle of the surface), latitude, longitude, altitude, and so on.
Once the items are defined, they’re generated in the game. As the player moves around the surface, items are produced on-demand in a procedural fashion. The further items are from you, the fewer are produced. Check out this week’s update video to see how it works.
Everything is being designed to be fully moddable in the future. We also want you to be able to add extra definitions of environmental items to existing worlds.
As usual, enjoy the next episode in our mini-series!