Better Lakes for VP

Well, work boats can only be built in coastal cities, so if that were the case then coastal cities would have stronger lakes than inland cities, which doesn't really make sense. The current system is more or less balanced, I don't see a reason for a change.

Ah OK. But it can use workers then, same as in case of Indonesian Campongs. I don't like that Fishery improves only 1 resource, and this building comes not very early.
 
Ah OK. But it can use workers then, same as in case of Indonesian Campongs. I don't like that Fishery improves only 1 resource, and this building comes not very early.
Well, I would need something more to consider than "I don't like it". I do agree it is a little strange, but it works with the balance and I think its interesting, you essentially have one/two tiles that are better than the rest.
 
This is interesting, but note that in standard maps (Continents, Pangaea, Oval, etc.) lakes bigger than 1 tile are very rare.
 
I really like this mod! I tend to play on the Highlands map, which usually has plenty of (large) lakes, and this makes them so much more interesting. Unfortunately I did discover a few problems while playing with it:
  1. I haven't, like, 100% verified this (because I'd have to spend quite some time uncovering the entire map in order to do so) but I'm pretty sure that when starting in a different era than the Ancient one, the extra lake resources don't appear at all. I started and restarted in the Classical era several times, had lakes close by, but zero lake resources any of those times. Looking at the source code, I think the problem might be that this
    Code:
    if Game.GetGameTurn() > 0 then return end
    doesn't take into account the Game.GetStartTurn()? I.e. gameTurn will be > 0 at the start when starting in a later era, so rather than checking if gameTurn > 0, it should probably check if gameTurn > startTurn.
  2. When setting up a new game for the first time (& starting in the Ancient era, see above) and playing the map generated at that time, the lake resources show up correctly. However, when restarting the game (i.e. opening the menu on turn 0 and clicking "Restart Game" to regenerate the map) the lake resource placement doesn't obey the rules stated in the mod description. I'm seeing a lot of Salt Lake resources on only a single tile in larger lakes, while they should be filling the entire lake, and Lake Fish as far as I can tell don't appear at all. I haven't examined this in detail but at first sight I'm thinking this might be caused by the arrays (tLakePlots etc.) not being reset to empty when the map is regenerated?

(Note: I know how to code and did some quick googling, but I don't have any experience with civ modding, so please take my "diagnosis" with a grain of salt :p )
 
I really like this mod! I tend to play on the Highlands map, which usually has plenty of (large) lakes, and this makes them so much more interesting. Unfortunately I did discover a few problems while playing with it:
  1. I haven't, like, 100% verified this (because I'd have to spend quite some time uncovering the entire map in order to do so) but I'm pretty sure that when starting in a different era than the Ancient one, the extra lake resources don't appear at all. I started and restarted in the Classical era several times, had lakes close by, but zero lake resources any of those times. Looking at the source code, I think the problem might be that this
    Code:
    if Game.GetGameTurn() > 0 then return end
    doesn't take into account the Game.GetStartTurn()? I.e. gameTurn will be > 0 at the start when starting in a later era, so rather than checking if gameTurn > 0, it should probably check if gameTurn > startTurn.
  2. When setting up a new game for the first time (& starting in the Ancient era, see above) and playing the map generated at that time, the lake resources show up correctly. However, when restarting the game (i.e. opening the menu on turn 0 and clicking "Restart Game" to regenerate the map) the lake resource placement doesn't obey the rules stated in the mod description. I'm seeing a lot of Salt Lake resources on only a single tile in larger lakes, while they should be filling the entire lake, and Lake Fish as far as I can tell don't appear at all. I haven't examined this in detail but at first sight I'm thinking this might be caused by the arrays (tLakePlots etc.) not being reset to empty when the map is regenerated?
I'm glad you're enjoying the mod, and thanks for the feedback.

For the first one, you are correct. I hadn't known that starting in a different era changes the first game turn, thanks. Will be fixed.
(P.S if anyone knows a trigger that starts when the game first initializes (probably after the mapscript) it would be really useful. I searched for a while and couldn't find one)

For the second one, I hadn't noticed this as it seems when I was testing restarting it was actually on an older version and I forgot to do it on the updated one. Will be fixed.

(Note: I know how to code and did some quick googling, but I don't have any experience with civ modding, so please take my "diagnosis" with a grain of salt :p )
No, you basically identified it correctly, good job. Honestly my code is pretty simple, nothing too complicated haha. Again, thanks for the feedback.
 
Tried it out again; can confirm that bug #1 was fixed. #2 was not, but I did some more testing and found the problem. Turns out bug #2 was caused by certain map conditions, and not by the restarting like I thought. (I got a correct "first" map twice and incorrect "regenerated" maps many times and jumped to conclusions. Sorry about that!)

Anyway, the problem is caused by line 64
Code:
if pAdjacentPlot:IsLake() then
where pAdjacentPlot can potentially be nil. I assume this happens when the lake tile sits at the edge of the map and no adjacent tile can be found. (Edge lakes happen a lot on Highlands maps, which is probably why I was the first to notice the problem.) Calling :isLake() on the nil value then causes a runtime error and the script crashes right in the middle of adding Salt Lake resources, which is why so many Salt Lake resources end up on their own instead of filling the lake, and no Lake Fish are generated.

Adding a nil check here
Code:
if pAdjacentPlot ~= nil and pAdjacentPlot:IsLake() then
appears to fix the problem (restarted several times, lake resources around starting area were all correctly placed).
 
Tried it out again; can confirm that bug #1 was fixed. #2 was not, but I did some more testing and found the problem. Turns out bug #2 was caused by certain map conditions, and not by the restarting like I thought. (I got a correct "first" map twice and incorrect "regenerated" maps many times and jumped to conclusions. Sorry about that!)
Right, next time a lua log + Map settings would be useful. But it seems we've got the issue now anyway.

Anyway, the problem is caused by line 64
Code:
if pAdjacentPlot:IsLake() then
where pAdjacentPlot can potentially be nil. I assume this happens when the lake tile sits at the edge of the map and no adjacent tile can be found. (Edge lakes happen a lot on Highlands maps, which is probably why I was the first to notice the problem.) Calling :isLake() on the nil value then causes a runtime error and the script crashes right in the middle of adding Salt Lake resources, which is why so many Salt Lake resources end up on their own instead of filling the lake, and no Lake Fish are generated.

Adding a nil check here
Code:
if pAdjacentPlot ~= nil and pAdjacentPlot:IsLake() then
appears to fix the problem (restarted several times, lake resources around starting area were all correctly placed).
Ok, will be fixed. Thought that it would just return nil if it got nil but apparently not.
 
Last edited:
Right, next time a lua log + Map settings would be useful. But it seems we've got the issue now anyway.
Okay, sorry about that! I'll make sure to remember for next time :) (For the record, map settings were: Highlands - Huge - Hot - Wet - Sparse - Ridgelines - Dense - Seas. LUA log I think has been overwritten by now? I found the cause of the bug (runtime error) by watching the output live in FireTuner.)

Also in that case you can just do
Code:
if pAdjacentPlot and pAdjacentPlot:IsLake() then
As nil is essentially false.
Thanks for the reminder. This was my first time editing LUA code and the syntax is very weird to me tbh. (Like what is up with using ~= instead of !=?) But I'm thinking of getting into civ modding myself, so I guess I'd better get used to it :p
 
I like this mod, it puts a little bit of something, works great.
Although I am building my first Fishery and it is damn expensive. If I can see the reason from a gameplay pov, it is a bit weird it costs that much (530 hammers).
Maybe you can link the cost to the number of lakes around the city? 250h + 25/lake? Just a random thought.
Will keep it in my modset anyway.
 
I like this mod, it puts a little bit of something, works great.
Although I am building my first Fishery and it is damn expensive. If I can see the reason from a gameplay pov, it is a bit weird it costs that much (530 hammers).
Maybe you can link the cost to the number of lakes around the city? 250h + 25/lake? Just a random thought.
Will keep it in my modset anyway.
The cost should be the same as the other buildings + the cost of a workboat, but I'll check it out, might have gotten something wrong.

New version conflicts with Enlightenment Era mod
Will be fixed soon.
 
Well, when I upgraded some of modmods that I play with and started a new game, then I was not able to load a saved game.
I installed only base VP and started adding modmods one by one, start a game, save turn 0 and load.
Tried your mod before and liked it, but couldn't make it work this time. Well, when I use EE without Better Lakes or Better Lakes without EE I'm able to load savegame, but not with both. I thought that may be because of new version of better lakes, but may be that because of other changes, including new hotfix for VP.
I use Promotion Tree, Promotion Icons, More Wonders for VP, Monopoly Buildings for VP, Sixth Policy VP, Parks, Casino, Cemetery, GMO Laboratory, Polar Station, Recruitment Office, Clock Tower, Sky Resort, Reforestation, MUC for VP, EE, City Expansion, Improved City View, Tree Growth, Wonder Race, IGE, RAS
 
I really appreciate the improvements to lakes which were just really not worth working most of the time and it earned it's spot on my always on mods list with the amazing monopoly buildings aswell however i thing the Fishery building is not really worth building in most of the cases since it only improves one fish lake tile (which are not very common btw) so the net yields are usually something similar to the flat watermill yields without the % of population which is not something i would build especially at the medieval era when the building queue is contested by buildings that provide more pressing yields or the new unlocked units at physics.
 
I really appreciate the improvements to lakes which were just really not worth working most of the time and it earned it's spot on my always on mods list with the amazing monopoly buildings aswell however i thing the Fishery building is not really worth building in most of the cases since it only improves one fish lake tile (which are not very common btw) so the net yields are usually something similar to the flat watermill yields without the % of population which is not something i would build especially at the medieval era when the building queue is contested by buildings that provide more pressing yields or the new unlocked units at physics.
I noticed you said that lake fish aren't common,can you provide a screenshot? As for the fishery, I will consider buffing it. But it does boost every fish tile, it just also provides and additional buff to one of the tiles.

Also sorry, I have been quite busy and have not have time to update the mods recently.
 
Last edited:
Top Bottom