Page 9 of 9

Re: [0.12.29] Starting in the middle of an ocean

Posted: Fri Jun 29, 2018 5:31 am
by TruePikachu
Koub wrote:[Koub] Merged into "island start" topic. :)
I just got really confused when I saw this show up in duplicates and the first page had the old graphics.

Re: [0.12.29] Starting in the middle of an ocean

Posted: Fri Jun 29, 2018 4:04 pm
by Deadly-Bagel
Yeah, it's an old issue, but one common to procedurally generated maps, especially when it includes impassable terrain. It would take some pretty complex calculations to check for this sort of thing, which would slow down the map speed and take time to develop. Overall it's a pretty rare and low-impact problem.

Though could probably be solved by allowing passage across shallow water, maybe at like 50% move speed or something. Make a feature of it, allow digging of moats to slow down biters.Though I guess walls would then need to be allowed to be built in shallow water...

Re: [0.12.29] Starting in the middle of an ocean

Posted: Sun Aug 12, 2018 2:10 pm
by almania
Not actually complex at all, just count how many tiles are pathable from the start, accepting the map once it exceeds some threshold.

Algorithm you want to use for that is floodfill, same thing paint uses for its fill tool. Pseudo code is often expressed in just 5 lines, although in practice a discrete stack is typically better (and not any harder in practice).

Re: [0.12.29] Starting in the middle of an ocean

Posted: Wed Apr 03, 2019 7:55 pm
by Shogal
Actually, this problem is very easy to solve:

1. After map generation, find a nearest ore/stone/coal patch (doesn't actually matter, unless it can be spawned on small island too)
2. Check it's reachability with A* search
3. If reachable, everything is done, spawn player at this location.
4. If not reachable, put player in the point between his original location and coordinate of this ore patch [(x1+x2)/2, (y1+y2)/2], repeat step 2.

So, if player is spawned on island, every iteration he will be closer and closer to ore patch until he reach mainland or this patch itself.

If resource patch can be spawned on island - then check reachability of the nearest 4 basic resources (iron, copper, stone, coal) and if none is reachable - then consider player on island and run algo i written before, if 1/2/3 resources are reachable, and 4th is not - then consider bad generation, pick up next seed (not seed+1, but something pseudo-random depending on current seed) and run generation again. If 5 attempts are failed - then there is something wrong with generation settings (low dimensions to spawn all necessary resources for example) - then show message about generation problem and ask player to choose another settings.

Re: [0.12.29] Starting in the middle of an ocean

Posted: Thu Apr 04, 2019 8:16 am
by Koub
Shogal wrote:
Wed Apr 03, 2019 7:55 pm
Actually, this problem is very easy to solve:
[...]
I think it has been solved with 0.17 new map gen.

Re: [0.12.29] Starting in the middle of an ocean

Posted: Mon Apr 08, 2019 2:31 pm
by Rseding91
Koub wrote:
Thu Apr 04, 2019 8:16 am
Shogal wrote:
Wed Apr 03, 2019 7:55 pm
Actually, this problem is very easy to solve:
[...]
I think it has been solved with 0.17 new map gen.
As far as I know it hasn't. We just don't care about trying to "solve" it. Just press escape and click restart.

Re: [0.12.29] Starting in the middle of an ocean

Posted: Mon Apr 08, 2019 3:09 pm
by mrvn
My solution to this problem would be to check that the map has a path from the starting to position to every resource specified to be in the starting area.

So in vanilla you might get put on a tiny island. But only if it has one tile or iron ore, one tile or copper ore, one tile of coal and one tile of stone. That should cut down the likelyhood of starting on an island to near enough 0. You might end up without wood since iirc that isn't a resource. But could be checked too.