Now the Noise gave me also some lakes which I want to fill/delete/change.
I just cant think of any logic on how to find out if the ocean tiles are actually not
ocean but “lake”. My last try was to start at one tile, check his neighbours if they are ocean and not land, then check all those neighbours that are ocean for their neighbours again and so on. I thought I could find the actual ocean this way and delete everything else. But this just ended in a big mess…
I bet there is a much simpler logic that I am just missing. Please send help.
Thanks
Really hard to recommend something, not knowing how you coded it. But I’d say it’s sea if a block is connected to another block ( recursively ) which is at the edge.
funny how its always you who responses thanks man!
I am still working on it and I am still failing. I think I am on the right track now but still have some issues.
I was able to make my logic work (start at a certain tile, check if neighbours (left, right, bottom, top from start tile) are water, store them uniquely in “alreadyvisitedtiles” and “newfoundtiles” start same search for each “newfoundtiles”.
My problem now is that if I want to scann the whole map like this it crashes with the “infinite loop” error. I can only make approximately half of the map happen. (please keep in mind that I am still a complete beginner)
Now a few questions:
Infinite loop errors are not always actually infinite, right?
After a little bit of research I found that all the loops are tried to be executed in one tick, True? Therefore I assume I get the “infinite loop” error because its just too long/too much for one tick to compute.
I found a setting in the project settings for the maximum loop iteration count, but even after adding a few more zeros it didnt let me run the code without the error, so I assume I really need to find a proper way to split up the workload. So is there a way to adjust the loops to the tick, so it just takes as much time as it needs or do i have to create “chunks” of operations and run one after the other?
I thought someone came up with a funky way of doing this. Was that not you?.. ( who posted the previous land/water question )
To answer your questions: If the system keeps report infinite loops, tweaking the central max loop figure can help but is usually best avoided. The recommended approach is to deal with the looping problem.
I can already check 2940 tiles + spawn 2940 new tiles in one run without an error.
So I feel I am doing pretty OK already. Its close to half the map. (scientific journal here I come?! )
The spawning of the new tiles is just for me to visualize whats going on, so the yellow area is the ocean that is already scanned. I can also see this way that it seems to work great because it stops at land so at the end I will only have water that is actually ocean, then I can say that every water tile that is not ocean is actually lake.
Its similar to your logic just that I don’t check the material but work with my grid information.
But my question kinda remains, do you know If I can use the same code and just “run it on every tick until complete” to avoid the error? If so, what would be the blueprint equivalent nodes for such thing?
If something like that doesn’t exist I guess I will just split the whole map in a few chunks and then adjust my code for every chunk.
While I was doing it, I could see a much better algorithm is to work in rings inwards.
So, start with the outer ring of tiles, then you only have to compute the inwardly adjacent tiles ( so just one side ), then process the next ring in etc. Much more efficient.
So I just moved all of that into the construction script and here it works as I initially wanted it: Run this beast, take whatever time you need but just run it.
Creates the Grid (128x128) and saves each grid point and each grid point location into Arrays (0,3 sec compile time)
Calculate and set grid tiles to “Edge of the map” (not yet in use, maybe useful later on) (still 0,3 sec)
Create Noise and set grid tiles accordingly to Water/Land Arrays (compile time now 0,67 sec)
Scann the map to find all Water tiles that are Ocean, remove them from Water array (now 7,6 sec)
Create all the instanced meshes from the Water/Land/Ocean/MapEdge Arrays. (now 8,7 sec)
All of this in 8,7 Seconds. I dont know if its bad or good since I have no comparison. But the scann is abviously the big oof
But your inward ring sounds like an improvement already. Yesterday I tried to start with the bottom left corner so I only need up and right. But it lead to some holes where the coastline is very curvy. I will try yours as well
Yeah, 8 secs is pretty high. I mean, you’re doing good, but if you had a totally optimized algorithm, you could get it to < 1 I think, even in blueprint.