Migrations GS

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Joubarbe
Engineer
Engineer
Posts: 19
Joined: 06 Dec 2019 16:14

Re: Migrations GS

Post by Joubarbe »

Amazing script! I agree there should be an option to activate vanilla growth though. Having to go into the source code to comment out a line is a bit rough :)
But I admit I don't know how to run multiple scripts at once, so maybe you had that in mind when writing your script.
cmhbob
Engineer
Engineer
Posts: 66
Joined: 29 May 2010 06:06
Contact:

Re: Migrations GS

Post by cmhbob »

I'm getting an error on the script, and it may well be operator-induced.

I've never run scripts before, AFAIK. I downloaded V3 via in-game content manager. That left me with a .rar. file in D:\Documents\OpenTTD\content_download\game. The game recognized that I had the script available and let me change settings and so forth. I started a game running JGRPP 33.2 on top of 1.9.3. Not long after I started the game, a couple of new cities sprouted near industries, even before I started servicing those industries. None have popped up in the last few game years though. Then I noticed that none of the cities were growing at all, even after I Funded New Buildings. The game has been running for 14 years at this point.

Log says "Loading failed: there was data for the script to load but the script does not have a Load() function. Script settings are default other than logging.

I've also tried unzipping the .rar filewhichh left the .nut files in D:\Documents\OpenTTD\content_download\game\Migrations-3\Migrations-3. I assume I'm missing something obvious here.
--
Bob
The wrinkles only go where the smiles have been...
Me, elsewhere
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

cmhbob wrote: 02 Apr 2020 03:40 I'm getting an error on the script, and it may well be operator-induced.
I found an issue that would cause the script to hang when pathing over a river. It has been fixed in the latest version
R-TEAM wrote: 08 Dec 2019 23:53 would it be possible to make the "vanilla" growth as an additional growth option ?
Joubarbe wrote: 02 Jan 2020 07:00 Amazing script! I agree there should be an option to activate vanilla growth though. Having to go into the source code to comment out a line is a bit rough :)
But I admit I don't know how to run multiple scripts at once, so maybe you had that in mind when writing your script.
I added an option to enable both jobs growth and vanilla growth. Keep in mind that that the script hasn't been tuned for that situation so results may vary.
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

Released version 4 of the migrations script. It's compatible with older saves but has slightly different growth behavior.

Changelog
  • Job seekers will now take past economic results into account making them slower to migrate. This also makes people stay put longer when there are short periods of no transport.
  • People will now stay put if their town / city has less than 50 inhabitants.
  • Default grid size has been changed to 48 tiles to keep a bit of space between cities for transport / industry.
  • Fixed a bug where the script would hang when it had to build a bridge.
  • Added debug messages that show the amount of job seekers and the amount of available jobs.
  • The simulation now updates monthly instead of continuously. This fixes the slower growth that would occur if the amount of cities increased.
  • Added a challenging mode setup to the first post.
L3x4ur1n
Engineer
Engineer
Posts: 3
Joined: 12 May 2025 11:08

Re: Migrations GS

Post by L3x4ur1n »

I can't seem to make the cities grow? Probably I'm misunderstading something.

I have a city "Stubbelose" with Steel Mill in the vicinity. I provide Iron ore to the Steel Mill, and take out Steel from the mill to Factory in city B.

I provide passengers to Stubbelose.

But Stubbelose is not growing. What am I misunderstanding?

Game screenshot attached.
Attachments
scenario.png
(432.36 KiB) Not downloaded yet
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

It looks like the Steel Mill next to Stubbelose is not considered to be in the same grid tile as the town. If a town is influenced by an industry the mod spawns a road between the industry and the town. In this case, once you transport enough of its output away a new town will form next to it.
L3x4ur1n
Engineer
Engineer
Posts: 3
Joined: 12 May 2025 11:08

Re: Migrations GS

Post by L3x4ur1n »

thexa4 wrote: 18 May 2025 22:27 It looks like the Steel Mill next to Stubbelose is not considered to be in the same grid tile as the town. If a town is influenced by an industry the mod spawns a road between the industry and the town. In this case, once you transport enough of its output away a new town will form next to it.
As it turns out, the city had another Steel Mill and they did connect with a road (mechanic I was not aware of before your message). So I switched the mills and let it run a few years. It unfortunately did not get the town to grow.

Edit: I created a route taking Goods from Factory to Svinestrup. Svinestrup did not start growing. I then created a route from nearby Farm to the same Factory and after few years a new town appeared near the Farm (Birkeholm) that is growing and that is cool! But no other town/city is growing! :( I am at a loss at what is going on.. I am sending a save file if that helps
Attachments
scenario2.png
scenario2.png (640.57 KiB) Viewed 386 times
scenario3.png
(1.31 MiB) Not downloaded yet
test game migrations.sav
(2.32 MiB) Downloaded 4 times
Last edited by L3x4ur1n on 20 May 2025 11:25, edited 1 time in total.
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

I've enabled debug signs to debug this, if you want to do that too, do the following: (does have a performance impact and you'll have a ton of signs all over the place, don't recommend doing this during normal play)
  • Unzip this tar: `Documents/OpenTTD/content_download/game/4d494752-Migrations-4.tar` into the same directory so you get a single `Migrations-4` folder
  • Uncomment the code in Migrations-4/economy_manager.nut on line 121: `DrawPopularity();`
It indicates that you currently give the factory enough revenue to support a town of about 600 inhabitants. Given that the town is currently way bigger it will slowly drain houses to places that have worker shortages.

You can open the AI/Game Script Debug window under the questionmark to see the monthly imbalance. It looks something like this:
Computed month 1234; 5993 job seekers; 0 jobs available
This means that there is not enough work for all existing people. Once there is enough work for existing people migration will start happening from outside.

I'll check if I can put the info in the town text area.
Attachments
image (2).png
(6.18 MiB) Not downloaded yet
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

Released version 5 of the migrations script. It's compatible with older saves.

Changelog
  • Towns now show the amount of unemployment / how big the worker shortage is.
  • Industries now show in which town the workers live.
User avatar
2TallTyler
Director
Director
Posts: 573
Joined: 11 Aug 2019 18:15
Contact:

Re: Migrations GS

Post by 2TallTyler »

Great! I will have to play this again. I recommend it about once a month whenever someone asks for new ways to play OpenTTD — very creative and interesting. :)
L3x4ur1n
Engineer
Engineer
Posts: 3
Joined: 12 May 2025 11:08

Re: Migrations GS

Post by L3x4ur1n »

thexa4 wrote: 21 May 2025 18:53 Released version 5 of the migrations script. It's compatible with older saves.

Changelog
  • Towns now show the amount of unemployment / how big the worker shortage is.
  • Industries now show in which town the workers live.
How should it look like? I created a new game with new version but I see nothing changed. The town and industry window doesn't show anything about what the shortage is or where the workers live.
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

Released version 8 that fixes bugs in the last release. Fully compatible.
thexa4
Engineer
Engineer
Posts: 16
Joined: 28 Aug 2019 15:29

Re: Migrations GS

Post by thexa4 »

This is what it looks like:
image (3).png
(462.32 KiB) Not downloaded yet
It only populates the text once initialization has completed. On the shared save this takes a bit more than a year after loading the game.
It also looks like you played with the version that was missing translation strings. That likely prevented the script from displaying the messages. If you download the newest version you should be able to resume with the same save.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 13 guests