Create a map/landscape in this way that the material/texture on every position is influenced by parameters which can changes while the game is running

Hello everyone,
I have researched a lot, but i can’t find a solution for my specific problem, maybe someone have an idea for a solution.
In my game for every position of the map/landscape the ground/land receives a couple of values. It is necessary, because I want to put plants on it and depending on these values the plants grow more or less.
The problem is: how can I implement, that the landscape/map have on every point the correct texture?
Pour example when there ist no water and much sand, then it is a section of desert an i want to see the right texture on the monitor for these section.
Pour example next to it there is water and so I whant to see the water-texture there.
The values have to settet (randomly) while the game is running und they will change while game is running.
And so i need a method to “draw” the texture automaticly dependent on the values - and it have to chance the texture, when the values will chances.

Information:
First I tryed it in a minecraft-style. I let create a lot of cubes as underground. These Cubes were part of “Groundactors”.
Every Actor stores the parameters and values. For very very small maps it works fine.
10x10 Cubes (20mx20m) were spawned, they got their values und dependend of the values a suitable texture were assigned. Well. It’s great. Here you can get a little Impression of how it could look like:

But… it would be a very small world. Wenn I changed the Size of World (100x100 Cubes = 200mx200m), the world is still small, but the PC died… (it needs more than 30min to build up the map in running game).

I could take staticMesh “plane” instead of “cube” - this would be a little better, but the main part of the problem persists :frowning:
The maps are very hardly limitted.

Maybe it could be a better solution, to use the LandscapeMode.
So I try to create a landscape (flat land is sufficent) with the tools of the “landscapeMode” and try to find ways for “drawing” the
correct textures on the correct positions. Squares/cubes/blocks are sufficient (like Minecraft-Voxel-graphics).
I could imagin, that an Idea could be:
after the game makes the values for all positions of the map (that meens for every square), the game could make a kind of imagefile out of these values. Than the game takes this file and makes a new texture according these values while using the given textures for desert, water, grass and so on.
But there are so many problems and quastions. The big mainproblems are:
(1) How to let the game create a image file - i didn’t find any helpful explainings…
(2) How to let the game load such a file and make a new texture out of it?
(3) How to let the game change the texture of the Map/Landscape at the right position?
For all these specific problems I couldn’t find really helpful content.

Are there any Ideas how to let the game create a map/landscape so that the kind of ground is visualized?
(and… the map should be taller than some square-meters and a normal PC should can handle it).
It is ok for me, use voxelgraphic - it can be organized in blocks. It is a valid solution.
It also can be a solutione that uses the “landscapeMode”.
I guess, using the landscapemode would be more efficient an more flexible, but I told the problems.

I would be very happy about Ideas and approaches.
Best regards and thank you very much

1 Like

Just a little bit of rambling, but it seems, the biggest performance problem comes from your current system creating your underground from independent actors (therefore a 100x100 map apready is made out of 10000 individual actors), and not creating one actor, that contains one big mesh or landscape.
Ok, you made this, because those actors contain your values for your plants growing, but it probably is better, if those values are stored in a struct or array, or something like that.

Or… since you wrote, you would be ok with flat landscape, there might be a system, that can hold all your values for your underground, and act as a landscape, including forming your textures: A Paper2D tilemap.
Yes, usually, those are used for 2D games, but they could be used as regular flat underground too. Nobody said, that they have to be limited to 2D games ^.^ And you don´t even need to use them for rendering, just using them as a data collection, that is invisible in your game, would work.
But since you can give each tile a unique sprite/texture, and probably drive that with a blueprint too, based on your calculations/results, you could use the tilemap as landscape too.

Reason for mentioning them:

  • Tilemaps are made out of one or more layers, which are made out of grids, you have access to them
  • each grid is made out of tiles, and you can access each tile individual tile, and if you made your tilemap an instance, then you can even edit those tiles at runtime
  • each individual tile can hold individual user data, which you also can read and write at runtime

So if you don´t want store your data in an array or whatever, you can create a tilemap, and give it some layers, like one layer for underground type (rock, sand, soil, swamp), one for water amount , one for fertilizer amount, etc.
Then you can edit the tile textures depending on those stats, and whatever your calculations say, it should look like with those values (maybe not all at the same time ^.^).

Hey there,
thank you very much, thats an important hint - I didn’t heared before of Paper 2D tilemaps. I will start to researche to this theme! Thank you :slight_smile:
I’m sorry, my English is not very well, I tried my best. Yes, you discribed my main problem - I want to create a map (and every position have its own values), but when I let the game construct a lot of individual cubes/actors, than the Computer is overloaded.

This was my idea to solve the problem. Like you say in:

This is my hope to do so - and there is the problem:

In summary: yes - to create an individual actor for every “point” of map needs too much power. So I wonder, wheather I could find a way to use just one big actor (pour example a landscape actor) - but there is the problem, I didn’t find a way to illustrate the surface - every “point” have to receive his own texture depending on the values of this point (in this case these values are stored in an array).

Your hint to use a Paper 2D tilemap sounds very constructive! Thank you very much! I start to researche now to this theme (an i will study your p.m.). You said, in this case, every tile could store its values - that sounds great! - yes - an another solution (to store the data in an Array) would also be fine, too, when there is a way to “draw” a map and every point got a suiteable texture.

Now, I try to use th 2D tilemap. Maybe it will be the perfect solution, thanks a lot :slight_smile:

1 Like