MinchinWeb's MetaLibrary v.9
Library functions of OpenTTD AI writers.
MetaLibrary is the collection of code I've written for WmDOT, my AI for OpenTTD, that I felt should properly be in a library. Separating my AI from this library has made it easier to write my AI, but I also hope will this code will help some aspiring AI writer get off the ground a little bit faster. ;)
A GameScript version of this library is also available. All functions are available, although some may require an active company context.
Read the complete Changelog.
The easiest way install MetaLibrary is the use the in-game downloader in OpenTTD.
If you want to manually install it, download the folder and place it in your
For you to use the library in your AI's you'll need to import it. Somewhere outside of any other class or function, add an import statement like:
Import("util.MinchinWeb", "MinchinWeb", 9);
If installed from the in-game downloader, the dependencies will automatically be downloaded and installed. Otherwise, you'll need the following libraries:
OpenTTD is able to read uncompressed
tar files without any problem.
Q: How do I use the sub-libraries directly?
A: Import the main library, and then create global points to the sub-libaries you want to use. Eg:
Info: See the sub-library files for the functions available and their implementation.
Q: What is the _MinchinWeb_ ... all over the place?
A: I can't answer it better than Zuu when he put together his SuperLib, so I'll quote him.
" Unfortunately due to constraints in OpenTTD and Squirrel, only the main class of a library will be renamed at import. For [MetaLib] that is the [MetaLib] class in this file. Every other class in this file or other .nut files that the library is built up by will end up at the global scope at the AI that imports the library. The global scope of the library will get merged with the global scope of your AI.
" To reduce the risk of causing you conflict problems this library prefixes everything that ends up at the global scope of AIs with [ _MinchinWeb_ ]. That is also why the library is not named Utils or something with higher risk of you already having at your global scope.
" You should however never need to use any of the [ _MinchinWeb_ ... ] names as a user of this library. It is not even recommended to do so as it is part of the implementation and could change without notice. "
– Zuu, SuperLib v.7 documentation
A grand 'Thank You' to Zuu for his SuperLib that provided a very useful model, to all the NoAI team to their work on making the AI system work, and to everyone that has brought us the amazing game of OpenTTD.
Minchinweb's MetaLibrary v.9 [2015-01-10]
Copyright © 2011-15 by W. Minchin. For more info, please visit https://github.com/MinchinWeb/openttd-metalibrary
Permission is granted to you to use, copy, modify, merge, publish, distribute, sublicense, and/or sell this software, and provide these rights to others, provided:
Notes about static classes, what they are, and which classes are 'static'
Consider Fibonacci Heap version in NoCAB
Add picture of in game downloader
Look into theming dOxygen output
Add 'News' tab pointing back to my Blog updates on MetaLibrary