LocoNeko / RoadsOfTheRim

A Rimworld mod allowing road construction on the world map
MIT License
10 stars 11 forks source link

Roads Generating on Water #63

Open ADamDirtyApe opened 4 years ago

ADamDirtyApe commented 4 years ago

Issue with roads in water, they still generate as if the water tile was land.

Image of issue: https://imgur.com/a/R7trVaQ

Rimworld export Logs are here, these were yellow warnings at the end.

https://gist.github.com/HugsLibRecordKeeper/7ef5f5a8978b01760f7fb38763bda345

I thought it was an interaction with the boats mod and pushing settlements over closer to water, but in generating maps with that setting at different levels has this error no matter the setting for the Boats mod.

It might have to do with Update 1.1.2647 (i confirm i am running this version), but the update notes does not mention anything changed for world gen?

LocoNeko commented 4 years ago

Thanks. The problem is that glitter roads can be built on water, but I only test that when building roads. So somehow, I have to find how road generation decides which type of road it is creating and prevent it from doing so if the road is not a glitter road, which would essentially mean no roads on water since glitter roads can only be built, not generated. Problem : I can't see how road generation picks up the type of road. Still looking...

LocoNeko commented 4 years ago

Note : This is probably in WorldGenStep_Roads.GenerateProspectiveLinks(List indexToTile)

There, it uses Find.WorldPathFinder.FloodPathsWithCost with the cost function from Caravan_PathFollower.CostToMove

I must prevent the floodPathsWithCost from allowing a tile to be used by anything but a glitter road

LocoNeko commented 4 years ago

First find which mod(s) interact with RotR to throw this bug. Doesn't seem to be common

LocoNeko commented 4 years ago

OK, I have confirmed that it's really a combination of mods. Roads are not generated by Roads of the Rim alone. @ADamDirtyApe , please try to find which mod or combination of mods triggers this issue, and please confirm whether adding RotR changes things. I would look first into any mod that directly affects the world map.

LocoNeko commented 4 years ago

@ADamDirtyApe , did you find the mod that triggers this issue combined with RotR ?

ADamDirtyApe commented 4 years ago

I have not been able to, as removing all the mods I have broke rimworld to the point that vanilla didn't even work.

I heavily suspect it is "Preemptive strike" allowing generated enemies to path across water (the mod makes it so that you can see them coming as an entity if you have manned towers). I am using the forked version, https://steamcommunity.com/sharedfiles/filedetails/?id=2056230561 the original has some more documentation https://steamcommunity.com/sharedfiles/filedetails/?id=1890377807

This behavior combines with the way that your mod is attempting to allow bridges, and makes it so that map gen treats water as if it were land for the purposes of roads upon world generation.

LocoNeko commented 4 years ago

Thanks a bunch for getting back to me. I think the best way to debug this is for me to create a new game with RotR and preemptive strike enabled, see if roads are generated on water. The test is reasonably easy since it should be wrong right from the beginning (world generation). You can also try a new game on your side with preemptive strike disabled, see if the world created had roads on water or not. It took me a long time to get back to this issue, but I will do my best to fix it.