SuperLib: Helper, Direction, Tile, ... libraries
Moderator: OpenTTD Developers
Re: SuperLib: Helper, Direction, Tile, ... libraries
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.
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
Hey,
I forgot to attach the patch file. I've edited my post and added it now.
I forgot to attach the patch file. I've edited my post and added it now.

My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: SuperLib: Helper, Direction, Tile, ... libraries
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.
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.
- Attachments
-
- error.patch
- Apply after zuu's patch
- (430 Bytes) Downloaded 290 times
Re: SuperLib: Helper, Direction, Tile, ... libraries
Is somewhere documentation please?
Re: SuperLib: Helper, Direction, Tile, ... libraries
The documentation is included in the tar file. There is a readme file with introduction and pointers for where to find further documentation.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: SuperLib: Helper, Direction, Tile, ... libraries
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:
The update is available on bananas
Edit: Forgot to include Town::GetTownProducedCargoList and Town::GetTownAcceptedCargoList in changelog.
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.
- Attachments
-
- NoGoSuperLib-v40.tar
- GS version
- (346 KiB) Downloaded 322 times
-
- SuperLib-v40.tar
- AI version
- (350 KiB) Downloaded 320 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: SuperLib: Helper, Direction, Tile, ... libraries
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:
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 = []);
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: SuperLib: Helper, Direction, Tile, ... libraries
_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
Who is online
Users browsing this forum: No registered users and 13 guests