Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

water not placed as in the original #1519

Open
Spikeone opened this issue Apr 8, 2022 · 3 comments
Open

water not placed as in the original #1519

Spikeone opened this issue Apr 8, 2022 · 3 comments

Comments

@Spikeone
Copy link
Member

Spikeone commented Apr 8, 2022

RttR places water wrongly. Sadly I have no idea yet on the correct algorithm.

grafik

grafik

It's not related to farming/trees:
grafik

@Flamefire
Copy link
Member

"Wrong" is a hard word here. We have an own algorithm to add water where there isn't any and "fill" up pre-filled water places which the original may or may not do. See the algorithm at

uint8_t minHumidity = 100;
for(const DescIdx<TerrainDesc> tIdx : GetTerrainsAround(pt))
{
const uint8_t curHumidity = GetDescription().get(tIdx).humidity;
if(curHumidity < minHumidity)
{
minHumidity = curHumidity;
if(minHumidity == 0)
break;
}
}
if(minHumidity)
curNodeResource = Resource(
ResourceType::Water, waterEverywhere ? 7 : static_cast<uint8_t>(std::lround(minHumidity * 7. / 100.)));
else
curNodeResource = Resource(ResourceType::Nothing, 0);
SetResource(pt, curNodeResource);
which is based on the terrain humidity.

So this deviation is a deliberate choice and I'm not sure we want the original behavior here especially if we don't know that anyway. I mean: We did fix other bugs too and "missing water" could be one of them. Maybe the original relied on the resource value stored in the map file only and hence on the editor setting that correctly which is likely not (always) the case for (all) custom maps.

@Spikeone Spikeone changed the title water wrongly placed water not placed as in the original Apr 10, 2022
@Spikeone
Copy link
Member Author

Wrongly and not as in the original are interchangable in this case.

I guess this depends on how you view it, for me this hasn't been a bug in the original but I always expected it to work that way. Thats because now you have to put at least some thoughts into building wells. Currently you can use any building spot in RttR and just build a well. This can be any useless spot at all - so producing water is a nobrainer. In the original, especially on maps with fewer building slots, you at least should search if you are to close to water or not.

So I don't see any problem in adding a water placement algorithm that at least mimics the original. As said I don't agree with seeing the current behavior as a bugfix.

And yes we don't know the algorithm, but testing this may shed some light on a more correct behavior. I also think we once had a more original approach some years ago.

@Flamefire Just asking as I still don't fully understand the difference between "Water Everywhere" and "Inexhaustible" - aren't they the same at the moment? Except having different quantity signs but that doesn't make any difference with inexhaustible water.

@Flamefire
Copy link
Member

And yes we don't know the algorithm, but testing this may shed some light on a more correct behavior

Well our current approach is to place water with an amount according to the terrain with the lowest humidity. I.e. next to desert there won't be any water. Feel free to try and research how the water is placed in the original or if the game (only) uses what is stored in the map. We seemingly do that partially, i.e.: If there is water, we adjust the amount (which may remove it)

Just asking as I still don't fully understand the difference between "Water Everywhere" and "Inexhaustible"

  • Inexhaustible: Water will not be decreased/consumed during the game
  • Inexhaustible and water everywhere: Additionally water will be placed in spots where there isn't any during map load

I.e. the difference is that for the first we change only the amount in places where any water already is and for the 2nd we additionally place water when there isn't any resource. See

if(curNodeResource.getType() == ResourceType::Nothing)
{
if(!waterEverywhere)
continue;

I think the way we do it was a workaround for custom maps using only "binary" water, i.e. either there was 7 water or none. And we enhanced that to consider the terrain around the node and with the 2nd option above may additionally place water.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants