Page 9 of 9

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 24 Feb 2016 03:27
by yorg
Hi,

I don't have a rock-steady case for reproducing the issue, but the AI I'm working on seems to run into it eventually on big enough maps. Where can I download your patch for testing?

Thanks for the guidance regarding making patches - I have a bit of knowledge of git but am still learning all the ins and outs, so I appreciate the information.

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 24 Feb 2016 19:59
by Zuu
Hey,

I forgot to attach the patch file. I've edited my post and added it now. :-)

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 24 Feb 2016 20:39
by yorg
Perfect, thanks, I've got it now.

At a glance, it seems to match my changes. I'll spend some time testing your patch and report back.

EDIT:

Running your patch throws an error - the iterator falls out of scope after the end of the for... loop in DoPathfinding. The attached patch just moves the declaration if it a line earlier. With that applied, it looks like everything works well and the issues in my last post are all resolved.

I'm going to keep poking around and see if anything else comes up, but for now it looks good to me.

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 20 Dec 2016 20:36
by kraken
Is somewhere documentation please?

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 21 Dec 2016 12:25
by Zuu
The documentation is included in the tar file. There is a readme file with introduction and pointers for where to find further documentation.

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 01 Apr 2017 09:45
by Zuu
Version 40
I have made an update to SuperLib that fixes that RoadBuilder would not timeout.

If you use SuperLib.RoadPathFinder directly in your AI or library, you need to update your code, as I have fixed it to now behave as documented. If you only use RoadBuilder, then the interface has not changed.

Changelog:

Code: Select all

Fix:
- RoadPathFinder::FindPath and ::GetFindPathError was not responding as documented
- RoadBuilder timeout was not working
- Road::GrowStation was connecting added stop in a suboptimal way
- Town::GetTownProducedCargoList and Town::GetTownAcceptedCargoList now neturn a new 
  list instance each time, so that if you modify the returned list, it will not affect the next
  call to the method.
- A few debug messages printed using AILog was fixed to use the Log system 

Thanks to yorg for debugging and posting patches that contributed towards
solving the timeout problem.

The update is available on bananas

Edit: Forgot to include Town::GetTownProducedCargoList and Town::GetTownAcceptedCargoList in changelog.

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 21 Dec 2018 23:37
by Zuu
A word of advice.

If your AI is using RoadBuilder and was using SuperLib pre 40 and then changed to 40, review your max_loops parameter if you set it explicitly when you call RoadBuilder.Init. If you used a too low limit in past versions of your AI it was not a problem in SuperLib 39 because it had a bug that it would not abort at max_loops, so you didn't notice that you used a too low limit. Now with SuperLib 40, you need to take care to not use a too low limit in relation to how long distance your routes are. The SuperLib default value is 4000, but please play around and find a value that suits your AI.

Parameters of the Init method:

Code: Select all

function Init(tile1, tile2, repair_existing = false, max_loops = 4000, forbidden_tiles = []);

Re: SuperLib: Helper, Direction, Tile, ... libraries

Posted: 20 Feb 2024 16:48
by Wormnest
_SuperLib_Money::GetInflationRate can cause a division by zero if "difficulty.max_loan" is zero. See e.g. viewtopic.php?p=1267811&sid=920eabb163d ... c#p1267811