AI in scenario editor

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

Post Reply
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

AI in scenario editor

Post by Bilbo »

I thought about using AI in scenario editor - as AI can now examine world and construct paths, manage vehicles, etc, AI in scenario editor would be able to construct world. The only difference would be that company-related functions won't make sense and everything is free.

And these "generator" AI's will run and after some while they'll exit when they have done their work.

Basically we would need to disable company functions in the editor and add few specific scenario functions (create/delete/rename town...). Then just let users run these "AI" scripts.

You can have for example improved landscape generator, improved town/industry generator, script that will connect cities with roads .... I think people would come up with many useful scripts, people could have improved scenario generation without having to make patches for code.

Also, on servers, these AIs could be run as "postprocessing" step after generating random map to add some cool features to it.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AI in scenario editor

Post by Yexo »

I'm already working on allowing squirrel scripts as map generators, when this works I'll try to expand this to other areas, like town generation, tree generation. Take a look here http://devs.openttd.org/~yexo/mapgen/ for the progress so far. The diff might be a bit outdated, but I think it should still work. Apply the patch, create a directory named "mapgen/" in the dir the config file is in. You can now create a directory in mapgen/ for every map generator script, create a direcotry, place info.nut and main.nut in it and it should work. This is just a sample generator to demonstrate how it works. Feel free to come up with your own.
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: AI in scenario editor

Post by el koeno »

Yexo wrote:I'm already working on allowing squirrel scripts as map generators.
Wow! That should be nice. It's one of things I'd really like to see. :D
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AI in scenario editor

Post by Zutty »

Brilliant idea
PathZilla - A networking AI - Now with tram support.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: AI in scenario editor

Post by Bilbo »

Squirrel script as map generator? So someone though of same idea :)

Though I meant it more general - user will pick one script from list of scenario editor scripts and set some parameters (using same GUI as is used to pick up AI's to play with). User presses execute and the script will do their work, whatever it is. It could be landscape generation (some API call to reset the heights of landscape from some precomputed array would make this faster than having to do this by individual terraforms), building some extra roads, adding some random rivers, do some extra terraforming or other changes on generated landscape (which could be done by current API), or do something with towns (shrink/expand/delete/create new .... which would need few API calls to be added).
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
Xander
Route Supervisor
Route Supervisor
Posts: 485
Joined: 18 May 2007 12:47
Location: Oxford
Contact:

Re: AI in scenario editor

Post by Xander »

I'm not so sure on the terrain design AI - I'd be very surprised if someone could do better than TerraGen - but I love the idea of a river AI, that's exactly what the river generator needs!
Real Tycoons do it on Trains!

JAMI: Just Another Moronic Intelligence
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: AI in scenario editor

Post by Bilbo »

Xander wrote:I'd be very surprised if someone could do better than TerraGen
Not in general case, but if you want some special sort of map (crater in the middle, two large islands, mountains and valleys changing with some special repetitive pattern, whatever ....), script could help. Such script could use call to terragen with some parameters as part of the land generation process.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: AI in scenario editor

Post by el koeno »

Xander wrote:I'm not so sure on the terrain design AI - I'd be very surprised if someone could do better than TerraGen - but I love the idea of a river AI, that's exactly what the river generator needs!
Are you familiar with Civ4? They've got great map scripts, and the type of script you play really influences the game, and I imagine it would work the same for OTTD. An archipelago (consisting of small islands) map would require boats or airplanes to start the first long range routes. Pangea maps (the world is one landmass, like most maps are now) would allow early long range trains. Continents would be between the two. And that's just the three basic map types that have been around for ages in Civ, they've got loads more, each having their own character.

Of course Yexo might have something else in mind, in which case I'm just talking nonsense here. :D
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 16 guests