[0.12.29] Starting in the middle of an ocean

Things that has been reported already before.
User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

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

Post 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.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

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

Post 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...
Money might be the root of all evil, but ignorance is the heart.
almania
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sat Aug 11, 2018 6:11 am
Contact:

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

Post 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).
Shogal
Inserter
Inserter
Posts: 29
Joined: Tue Mar 05, 2019 1:46 am
Contact:

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

Post 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.
Koub
Global Moderator
Global Moderator
Posts: 7807
Joined: Fri May 30, 2014 8:54 am
Contact:

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

Post 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.
Koub - Please consider English is not my native language.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14403
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.
mrvn
Smart Inserter
Smart Inserter
Posts: 5946
Joined: Mon Sep 05, 2016 9:10 am
Contact:

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

Post 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.
Post Reply

Return to “Duplicates”