Page 1 of 1

Water is generated last, overwriting essential resources

Posted: Wed Apr 13, 2016 8:12 pm
by scwizard
Because of this, it's possible to get a start without copper or some other essential resource, if you end up starting with a lot of nearby water.

An example is attached.

A solution would be to generate water before placing resources, rather than after.

Re: Water is generated last, overwriting essential resources

Posted: Wed Apr 13, 2016 8:28 pm
by Rseding91
Water overwriting resources, resources not being place-able because water is in the way.

Either way the result is the same.

Re: Water is generated last, overwriting essential resources

Posted: Wed Apr 13, 2016 8:34 pm
by scwizard
Rseding91 wrote:Water overwriting resources, resources not being place-able because water is in the way.

Either way the result is the same.
Resources not being placeable because water is in the way? That doesn't make sense.

Resources should only be distributed among "valid tiles." Of course you can't place resources on top of water, so the sensible thing would be to have a map of tiles where resources can be placed, and distribute them across that map.

Doing it this way has several advantages, not only do you fix the water issue, but you can also avoid resources overwriting other resources.

EDIT: Even though this might take some coding effort, it's worth it because it makes it easier to add additional types of resources in the future.

Re: Water is generated last, overwriting essential resources

Posted: Thu Apr 14, 2016 5:52 pm
by orzelek
You should read up about resource generation on wiki.
The way it's done doesn't allow for something like you are describing.

Since resources are based on 2d Perlin noise functions there is no "valid" tile check. They have their pre-calculated locations based on the noise function and thats where they spawn. Since water works in similar way when they interesect water wins.
Algorithm like that is used to provide determinism.

Re: Water is generated last, overwriting essential resources

Posted: Tue Apr 19, 2016 6:06 am
by scwizard
I don't understand.

Surely map generation allowing for "unplayable" maps is a bug...

Re: Water is generated last, overwriting essential resources

Posted: Thu Apr 21, 2016 6:52 am
by aes
scwizard wrote:I don't understand.

Surely map generation allowing for "unplayable" maps is a bug...
The problem is that the developer observes the code working as expected, and so does not have a bug, but you observe a bad experience, and that's only a problem if you're supposed to have a good time. Yes, that's harsh, but that's ok, you can thank me later.

Re: Water is generated last, overwriting essential resources

Posted: Thu Apr 21, 2016 6:54 pm
by orzelek
It's potentially a design problem basically - resources genration works in certain way since it needs to be deterministic. Since existence of resource depends directly on x/y coordinates of tile moving resources areound to avoid water is not feasible.

Re: Water is generated last, overwriting essential resources

Posted: Fri Apr 22, 2016 7:13 am
by DaveMcW
The ultimate solution will be an algorithm that scans the map for a good start position, and moves the start position or re-rolls the map. Unfortunately it is a low priority.

Re: Water is generated last, overwriting essential resources

Posted: Sun May 01, 2016 7:50 am
by Aru
orzelek wrote:It's potentially a design problem basically - resources genration works in certain way since it needs to be deterministic. Since existence of resource depends directly on x/y coordinates of tile moving resources areound to avoid water is not feasible.
Unless you have some kind of hardware encryption key generator installed, it's difficult or impossible for anything a computer does to be anything but deterministic.