CityBuilder
OpenTTD CityBuilder script.
Install / Use
/learn @AphidGit/CityBuilderREADME
/*
- This file is part of CityBuilder, which is a GameScript for OpenTTD
- CityBuilder is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License
- CityBuilder is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with CityBuilder; If not, see http://www.gnu.org/licenses/ or
- write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301 USA.
*/
////////////////////////////////////////////////////////////////////////////// // 0: INDEX ////////////////////////////////////////////////////////////////////////// 1 NOTES 2 QUICKSTART 3 SERVER SETUP 4 SETTINGS 5 TESTING ////////////////////////////////////////////////////////////////////////////// // 1: NOTES //////////////////////////////////////////////////////////////////////////
Please read this file before playing citybuilder. It contains all documentation. Because citybuilder is a fairly complicated script, it also has a great deal of customizability. Under the default settings, it does not work correctly with a newGRF-less game. This is intentional.
This is the Release version of CB script. The version numbering will match the beta version number that gets released. This release requires openTTD 1.4.0 or nightly 26156 or newer. It may work on older nightly releases, but this is not guaranteed or tested.
////////////////////////////////////////////////////////////////////////////// // 2: QUICKSTART //////////////////////////////////////////////////////////////////////////
To set up a game quickly, follow the following procedure.
- Set your game difficulty to 'custom'.
- Set the script settings to default.
- Decide which landscape to use.
- Create a map with one town and zero industries (funding only). Note that all cargoes can be used. However, to get a town to store a cargo houses do not accept, like with coal, you must build a power plant within the town's authority field (or another industry that accepts it). An industry that is not within the town's authority field, but becomes part of that town's authority due to expansion does NOT count towards citybuilder's town goals. This is a deliberate design choice for optimization.
////////////////////////////////////////////////////////////////////////////// // 3: SERVER SETUP //////////////////////////////////////////////////////////////////////////
Multiplayer servers will have their own framework built up in most cases. This script can integrate with your framework rather easily. If you are already using a gamescript, please first follow the following procedure:
- Rename "main.nut" into "CityBuilder.nut"
- include "CityBuilder.nut" in your "main.nut"
- Add the options in the "info.nut" to your own "info.nut", and discard this one.
- During your start function, create a 'CityBuilder' object.
- Call CityBuilder.Start_Lib() in your main's start function.
- Call CityBuilder.Manage() in your main loop. Make sure this is called at least once every game day or the script may not work as intended.
- If you have a game that ends and you want to sync with Citybuilder, check CityBuilder.go for true/false. If it is false the game has ended. It is freely accessible so you can end the game manually as well.
- Optional: If you are already using a versioning scheme, merge the two versions into one version.nut manually. Please do this, for it will help support the content download service quality.
Optionally, you can follow the following steps to ensure that you get access to CityBuilder's messages to the user for the server. For example, to broadcast them over IRC.
- Include "SendStats.nut" in whatever file you use to broadcast.
- Choose whether to use the GSText (continue in step 12), or plaintext (step 9).
- Create your own chat function f1 that accepts a company ID and a string.
- Create a function f2 that returns a cargo suffix for SS.
- Call SendStatistics(i,f1,f2) with your own chat function. Proceed with step 14.
- Create your own chat function f that accepts a company ID and a GSText object.
- Call SendStatisticsGS(i,f) with your own chat function.
- Resolve any variable name conflicts and related bugs.
- Optional: Turn off the default town news messages (see 4: SETTINGS).
- Done!
If you are not using a gamescript, you can of course write a wrapper to gain the benefits of SendStats anyway.
/////////////////////////////////////////////////////////////////////////////// // 4: SETTINGS /////////////////////////////////////////////////////////////////////////////// Setting name: Short version of setting name. Setting Range: What you can set it to. Comments: Necessary information. /////////////////////////////////////////////////////////////////////////////// Setting Name: Debug level Setting Range: 0-7. The higher you set this, the more diagnostic messages the script will output about what it's doing. This uses up system resources, so the recommended setting for normal play is 0.
Setting Name: Point to goal GUI if goals > 3 Setting Range: No/Yes. If turned on the town GUI window will point users to the goal GUI window if both are available for a town and a fourth goal exists.
Setting Name: Show owner above town name Setting Range: On/Off Comments: Adds labels above town name with it's owner. Off by default. Recommend turning this on for multiplayer games, especially with novice players.
Setting Name: Amt. of tiles per town Setting Range: 0-65,536 Comments: Set to 0 for no extra towns. The script will spawn extra towns until the amt/tiles per town is the specified amount. Non-cities generated in this way will always be small towns.
Setting Name: Amt. of tiles per primary industry Setting Range: 63-65,536 Comments: Set to 63 for no extra industry. The script will spawn extra primary industry until the amt/tiles per industry is the specified amount. If your Industry GRF contains raw industries that don't spawn by default at game start, also set to 63!
Setting Name: Amt. of tiles per secondary industry Setting Range: 63-65,536 Comments: Set to 63 for no extra industry. The script will spawn extra nonprimary industry until the amt/tiles per industry is the specified amount. If your Industry GRF contains nonraw industries that don't spawn by default at game start, also set to 63!
Setting Name: Chance of building industry in a town at game start: Setting Range: Nil, 1-999, Everything Comments: Of all industry types, Any types that do NOT create cargo but DO accept cargo are deemed town industry types, provided they are not water-based. A town will, at the start of the game, try to build one of each of these types, with probability defined by this setting. Thus, at 1,000, each town would try to build a water tower in the normal desert climate. At 500, about half the towns would have water towers, and about 1/4 both water towers and banks.
Setting Name: Game Length in years Setting Range: 0-4,000 Comments: Set to 0 for an infinite game. Set to a finite number for a goal game. A 12-year game lasts about 3 hours.
Setting Name: Goal Target Setting Range: 0-10,000,000 in steps of 500 Comments: Set to 0 for no target. Otherwise, the game ends as soon as a company hits this target.
Setting Name: Game Type Setting Range: Freebuilder, Citybuilder, Co-op, Metropolis. Comments: In freebuilder, companies are free to do whatever, it's merely town be- haviour that the script affects. Citybuilder is the regular mode, companies claim a town and grow it. In Co-op all companies work together to get the biggest world population. In metropolis, all companies work together to grow a random town as high as possible. This town will demand high amounts of mail, yet give large amounts of passengers.
Setting Name: Maximum HQ Distance to claim town Setting Range: 5-32 Comments: The distance is manhattan. If you happen to place your HQ too far, you can 'move' the HQ closer by re-plopping it. A helpful warning message pops up when you do.
Setting Name: Metropolis cargo multiplier Setting Range: 1-500 Comments: Making the metropolis require less cargo makes for an interesting game. Reminder: the metropolis demands you to transport x% of it's cargo!
Setting Name: Metropolis growth multiplier Setting Range: 1-500 Comments: The metropolis should grow a little faster. 12x is recommended.
Setting Name
