OtviAI (version 415)

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

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 312)

Post by Maninthebox » 05 Oct 2010 16:59

The status has been upgraded from alpha to beta! Version 372:

- Major reordering of the code over more files
- bit of terraforming for train stations
- added generic transport class as superclass for trains/road en later water/air/trams
- 'intelligence' for determining what mode of transport to use (WIP)
- less stations, less depots
- can now handle modes of transport being disabled in openttd
- more elegant handling of multiple instances of the AI

Bring on the bugreports and suggestions :)
Attachments
OtviAI.tar
Version 372 (beta)
(190 KiB) Downloaded 126 times

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: OtviAI (version 312)

Post by Brumi » 06 Oct 2010 17:51

Let me bring my bugreports:
I'm doing a test right now with OtviAI, SimpleAI and ChooChoo. OtviAI tried to use trains, but it didn't manage to build a connection for some reason. When removing stations, it leaves that little piece of track there:
Track left there.png
Track left there.png (19.2 KiB) Viewed 4442 times
Otvi is having financial difficulties in the game, although its routes are really profitable. It seems that it is spending all its money on terraforming.
Terraforming.png
Terraforming.png (111.77 KiB) Viewed 4442 times
I have attached the savegame.
SimpleOTVIChooChoo.sav
(411.62 KiB) Downloaded 118 times
Anyway, I'm glad to see that there is another multi-profile AI coming, so keep up the good work! :D

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1502
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: OtviAI (version 312)

Post by SirkoZ » 06 Oct 2010 20:04

I can confirm Brumi's report. I otherwise do not like OtviAI, if for nothing more, than for its pompous HQ sign.

Anyhow - today I did run a test run with 1 SimpleAI and 1 Otvi - and again - Otvi managed just well to bankrupt itself out of the game and off my computer. :-)

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: OtviAI (version 312)

Post by Lord Aro » 07 Oct 2010 06:13

SirkoZ wrote:I can confirm Brumi's report. I otherwise do not like OtviAI, if for nothing more, than for its pompous HQ sign.
AroAI does that...you never complained about it there, and besides, it identifies the HQ of a particular company
(I copied the HQ building code from Rondje, so i'll bet they're exactly the same as OtviAI)

on-topic...
train support? damn...AroAI could just about beat OtviAI-312 (in certain conditions)...
Congrats on getting it working, i've seen that getting train support to work is actually quite hard (see AIAI)
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 312)

Post by Maninthebox » 07 Oct 2010 09:07

I fixed the small pieces of track getting left behind and also fixed trains deadlocking each other. I haven't witnessed otvi going bankrupt yet, except in cases where I was running 6 instances of otviai at the same time. The terraforming code is very preliminary untested code and well... it shows :) Will try to fix that before putting a release in bananas.

Sirkoz: what kind of settings and newgrf's are you using so I can see what's going wrong?

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1502
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: OtviAI (version 312)

Post by SirkoZ » 07 Oct 2010 12:22

Well - I use just the old "Plane set" and of course only_decrease neutraliser new .GRF's. Otherwise difficulty settings are from "Hard", a few changed - veh_brkdowns:none, terrain:flat, lakes:verylow, econ:steady, disasters:off. All that with original map_gen, 60°turn enabled, towns:betterroads, all modes of transport enabled for AIs.

There are some other settings, that I do not think matter.

P.S.: "Z", not "z".

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 312)

Post by Maninthebox » 11 Oct 2010 12:09

I don't see how those grf's would influence my AI, I'm not building planes yet and I'm rarely connecting oil wells. The original map generator makes it a bit more challenging though it seems :) But even then, with 2 OtviAI's running in a game with your settings, both survived. I will run some more tests of course, but at least these settings didn't showcase a clear bug in the AI.

P.S.: I assume you mean 90, not 60 degrees? I'm not sure whether my AI can handle 60 degree turns ;)

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1502
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: OtviAI (version 312)

Post by SirkoZ » 11 Oct 2010 20:41

:lol: indeed - not 60° turns, rather ninety-degree. That 60km/h speed limit for those turns seems to haunt me. :)

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 08 Nov 2010 17:00

New release in bananas!

After lots of testing it's time for a release version again. What has changed since the previous release version in bananas?

- added trains
- added trams
- added generic transport class and mechanism to select a mode of transport for a given route, so adding aircrafts and boats is easy now
- more maintenance (removing unused stations, less depots, vehicle replacement, adding busses to an existing route, etc)
- newgrf support: not just trams, but also support for building nice looking cargo stations, ECS, FIRS, 2cc and more
- loads of small bugfixes and improvements (to prevent bankruptcy and being able to handle disabled trains etc)

So have fun with it!

Plans for the next release include:

- boats
- aircrafts
- less depots
- configurable parameters (like: option to go for maximum expansion or to go more player friendly, etc)
- more newgrf testing

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: OtviAI (version 379)

Post by Samu » 08 Nov 2010 18:32

Hi, the savegame shows OTVI with buses and a train (with 1 wagon only) competing in the same route. That would be ok, but the stations, bus and train in each town, are placed almost near each other and the 2 towns aren't that big. Also, while OTVI still makes a profit, from time to time I get the news showing it's going bankrupt, sometimes I even have the option to buy it. Another thing is OTVI crossing his own road with rail, making road vehicles from own company prone to accidents.
Attachments
Sem nome, 30 Out 1956.sav
(84.06 KiB) Downloaded 115 times

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: OtviAI (version 379)

Post by Zuu » 08 Nov 2010 19:37

The good thing with AIs that don't bridge rail is that then CluelessPlus can demonstrate its algorithm to replace level crossings with road bridges. :-) This algorithm has also found its way into AIAI which has copied that code.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: OtviAI (version 379)

Post by Samu » 08 Nov 2010 22:30

Crash! Division by zero error. I was away when the error happened, sorry.
Attachments
Sem nome, 11 Nov 1992.sav
(178.8 KiB) Downloaded 113 times
Sem nome, 11 Nov 1992.png
(20.24 KiB) Downloaded 1 time

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: OtviAI (version 379)

Post by Samu » 08 Nov 2010 23:00

Problem with a connection by road.
Attachments
Sem nome, 1 Jan 1962.png
(149.89 KiB) Downloaded 1 time

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: OtviAI (version 379)

Post by Samu » 08 Nov 2010 23:35

Some more problems. Look at those road pieces around the Battery farm, and look at the log, it keeps enabling and disabling the same town, trying to place either a bus or a train station there, but the local authority doesn't permit, yet it keeps terraforming near the town.
Attachments
Sem nome, 17 Out 1980.png
(151.45 KiB) Downloaded 1 time

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 09 Nov 2010 09:53

Samu wrote:Hi, the savegame shows OTVI with buses and a train (with 1 wagon only) competing in the same route. That would be ok, but the stations, bus and train in each town, are placed almost near each other and the 2 towns aren't that big.
In fact, the bus route is from A to B and the train route is from B to A (you can see this if you look at the orders). There is code in there to prevent the AI from building B-->A immediately after A-->B and from building A-->B again with a different mode of transport, but at the moment I'm not keeping track of all build routes, so preventing A-->B, C-->D and then B-->A is not possible at the moment.
Samu wrote:Also, while OTVI still makes a profit, from time to time I get the news showing it's going bankrupt, sometimes I even have the option to buy it.
That's sort of inevitable if you try to expand quickly. Although I do try to avoid it by being more careful with my money after such a warning. I have some ideas left to further improve this.
Samu wrote: Another thing is OTVI crossing his own road with rail, making road vehicles from own company prone to accidents.
It's a feature, not a bug ;) Adds some fun :P But especially with AI's like choochoo where you get double crossings and have a higher chance of killing a bus it might be a good idea to use bridges. I'll think about it :)

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 09 Nov 2010 10:27

Samu wrote:Crash! Division by zero error. I was away when the error happened, sorry.
It took me a little time to figure this one out, but as it turns out the AI was building a subsidized route near the end of the subsidy term. It checks the source and destination, takes a month or so to do the pathfinding and building and in the meanwhile the subsidized route ends. It then checks what cargo to transport, which doesn't work anymore, so you get 0xFF, then finds an engine for that cargo, which again doesn't work and then does division by the speed of that not existing engine: zero :)

Thanks for spotting that bug! Will fix it.

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 09 Nov 2010 13:02

Samu wrote:Problem with a connection by road.
By the looks of it, there was a working connection there, but then the vehicles didn't have enough profit and got sold and later the stations were removed as well to cut down on maintenance costs. Depots and roads are not removed (yet).

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 09 Nov 2010 13:15

Samu wrote:Some more problems. Look at those road pieces around the Battery farm, and look at the log, it keeps enabling and disabling the same town, trying to place either a bus or a train station there, but the local authority doesn't permit, yet it keeps terraforming near the town.
Bug found and fixed. Thanks for all the testing Samu! Re-enabling towns will now not happen more then once a year. And I'll probably have to start checking how 'willing' a town is to receive some terraforming from the AI...

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: OtviAI (version 379)

Post by Brumi » 09 Nov 2010 18:59

Bug report:

OtviAI built a point-to-point train route, but there are two trains on it (train 1 and train 3, so the other one might have been added later), and both trains are stuck at the station, waiting for a free path.
Attachments
Unnamed, 8th Dec 1950.png
Unnamed, 8th Dec 1950.png (101.7 KiB) Viewed 4128 times

Maninthebox
Engineer
Engineer
Posts: 107
Joined: 08 Aug 2008 11:35
Contact:

Re: OtviAI (version 379)

Post by Maninthebox » 10 Nov 2010 10:50

Hmmmm... you're absolutely right, there is a bug in the track connection code, which lead to only half of the tracks getting connected. Fixed and testing... Thanks!

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests