Download

3D map from tiles

As a (relative) simple prototype I’m working on in my spare time, I’m attempting to set up the procedural generation/creation of maps using 3D tiles. Although at this point it’s just for prototyping and seeing if it’s feasible/viable at this time, I do have a more elaborate design for a potential game. In essence, it is to be a base construction and management game, mechanically very similar to Dungeon Keeper and Evil Genius, with some additional inspiration from Prison Architect and RimWorld. For this, I have a list of elements I wish the map to be able to support:

  • Procedural generation
  • Square map size between 150 and 200 tiles (no more than 200, RimWorld has by default 200x200 tile maps and it’s large enough)
  • Multiple floors, absolutely no more than 50 levels, maybe less (hence the map won’t need more than 200x200 tiles ever, as you can build vertically as well as horizontally)
  • Varying types of tiles
  • Detection of enclosed spaces
  • Support for ventilation/air conditioning and fire/temperature propagation

I have conceptual knowledge of procedural generation, and have done experiments with it before (thought that was in Unity). So far, I understand, for optimization, that it’s best to separate the graphics from the data. So I need some way of storing and retrieving the data of every tile (so the type of tile, as well as temperature, oxygen level, etc.) and then actually rendering the tiles with the proper graphics. I know that creating every tile as an actor is far too performance intensive.

I would like the game itself to be 3D, with walls, floors, perhaps ceilings (when walking through the base) and foliage, characters, vehicles. However, I feel that splitting the verticality of the map in separate layers for each floor, similar to floors in the Sims, would be more appropriate for this, as opposed to doing a full 3 dimensional world like Minecraft. 2D is an option if 3D proves to be far too difficult or performance-heavy, but then I’d consider switching to Unity, simply because it is easier to work with 2D-wise (as I feel Paper2D is not mature enough for this, not because UE4 can’t handle it).

I have read and experimented with (Hierarchical) Instanced Static Mesh Components and 2D arrays to represent the tiles, and I’m still working on it. What I need some help with is deciding if (H)ISMC’s are suitable for such kind of maps, what a good method is to store, modify and access tile data and graphics data so the world can actually change (including temperature, ventilation, etc.), and how the verticality could be handled.

Procedural generation is nice, but not critical for this. The most important thing here is that a fairly large multi-level 3D map can be rendered with adequate performance, with the ability to modify every tile to be able to build things, and to have some level of simulation.

I managed to get a 200x200 tile map using HISMC’s, based on the older Epic livestream about procedural rooms. I’ve also managed to do a small experiment with simplex noise to generate impassable rock areas. However, I feel that procedural noise like this, and as used in games like Minecraft, is far too random. Since the whole purpose of the game concept is to build a base either underground or inside a mountain, I think it is better to procedurally generate one large mountain, island or volcano in the center of the map, with normal terrain or water around it. How can I achieve that while still procedurally generating the map, but without the random noise spread everywhere?

EDIT: I think I’ve found an algorithm that could work: the Diamond Square algorithm. It can be used to generate higher elevations in the center of the map than at the edge. Although I understand the theory behind it, my knowledge of C++ however is far too limited to implement it myself, and I have not found a working solution for UE4. On top of that, Unreal doesn’t support traditional 2d arrays exposed to blueprint, while the algorithm spits out a 2d array, which makes it more complex than I can understand. So I think my problem is going more in the direction of programming than content.

Hi!

I am trying to build something similar. Would it be possible for you to post some of your findings? Maybe we can advance together :slight_smile: