Can you outsmart the AIs? AI test scenarios
Moderator: OpenTTD Developers
Can you outsmart the AIs? AI test scenarios
Last night I talked on IRC with some AI-developer colleagues about the fact that I use a couple of simple scenarios to test Convoy. And that, to my surprise, even for some very simple scenarios, our AIs fail miserably.
I like AIs to be smart, in fact I like that even more than their ability to make lots of money. That's why I sometimes try to create a simple scenario and see how the AI reacts, to prove that humans still are smarter.
Here's an example, if someone else has some test scenarios, please do post them here. I think we all can learn from it to make our AIs (even) smarter
Here's another example, created by Rubidium some time ago: http://www.tt-forums.net/viewtopic.php?p=703535#p703535
I like AIs to be smart, in fact I like that even more than their ability to make lots of money. That's why I sometimes try to create a simple scenario and see how the AI reacts, to prove that humans still are smarter.
Here's an example, if someone else has some test scenarios, please do post them here. I think we all can learn from it to make our AIs (even) smarter
Here's another example, created by Rubidium some time ago: http://www.tt-forums.net/viewtopic.php?p=703535#p703535
- Attachments
-
- Unnamed, 15th Sep 1951.png (64.19 KiB) Viewed 6330 times
-
- towntest2.scn
- (13.35 KiB) Downloaded 189 times
Last edited by GeekToo on 21 Mar 2009 12:24, edited 1 time in total.
Re: Can you outsmart the AIs? AI test scenarios
Just out of interest for the AI's that allow airplanes: what if airplanes are not allowed? How does that affect profitability? I'm under the impression that (earl) airplanes are difficult for the AI to manage.
Re: Can you outsmart the AIs? AI test scenarios
It would be hard to make a profit in that situation, but the smart thing to do would be to not start building, instead of just starting to build all kinds of stations, and making a loss.
Re: Can you outsmart the AIs? AI test scenarios
Good one GeekToo. I'm very interested in this sort of thing.
It takes a while but PathZilla is eventually able to turn a profit amongst all the competition. By itself PathZilla does much better, but Convoy really squeezes it.
Its quite remarkable how Convoy is able to assert dominance so early with only five vechiles and two stations. Well done
At the moment I'm still fixing stupid bugs (it took me all morning to make it work with your scenario - turned out to be a freaking typo!) but in general I like to try to test my AI in sub-optimal situations like this.
I'll see if I can come up with some interesting scenarios.
It takes a while but PathZilla is eventually able to turn a profit amongst all the competition. By itself PathZilla does much better, but Convoy really squeezes it.
Its quite remarkable how Convoy is able to assert dominance so early with only five vechiles and two stations. Well done

At the moment I'm still fixing stupid bugs (it took me all morning to make it work with your scenario - turned out to be a freaking typo!) but in general I like to try to test my AI in sub-optimal situations like this.
I'll see if I can come up with some interesting scenarios.
- Attachments
-
- geektoo-testscn1.png (70.28 KiB) Viewed 6219 times
PathZilla - A networking AI - Now with tram support.
Re: Can you outsmart the AIs? AI test scenarios
With airplanes NoCAB, Convoy and AdmiralAI at on par for the first 3 years after which NoCAB dominates (typical 512x512 map). But without it Convoy dominates for the first 10 years as its city handling code is way better than NoCABs at the moment; For each pair of city I allow only 1 connection (an airport or bus station), while Convoy builds several and gets more leverage and money for doing that and since passengers are the most profitable cargo to transport it's quite a challenge to do better for the initial years (without aircrafts that is). Perhaps trains can change that, but we'll have to see once that's implemented.Hyronymus wrote:Just out of interest for the AI's that allow airplanes: what if airplanes are not allowed? How does that affect profitability? I'm under the impression that (earl) airplanes are difficult for the AI to manage.
I don't see how early airplanes are difficult the manage, they require less work than road vehicles in my experience

-
- Engineer
- Posts: 34
- Joined: 01 Mar 2009 19:56
Re: Can you outsmart the AIs? AI test scenarios
Well, you've all seen some of my scenarios. Some things I've seen:
PAX can't compete without a $300k start loan. Otherwise, it blows too much money on infrastructure building an airport and several transfer stations. It usually goes-under.
None of the AIs have been able to compete in desert climate on Hard settings, even if I give them 300k start money. NoCAB makes the foolish error of trying to cart diamonds using aircraft, and Admiral AI wastes money on multiple lines, and is forced to settle for road vehicles. All the AIs can't seem to deal with the higher cost of everything here. Here is a game I played recently on these settings, where ALL AIs in the game (PAX, Admiral, NoCAB and Fanioz) went under at least once.
The save game is before the AIs failed, in 1961. You can see that NoCAB is on the way to failure, making a pittance off those two diamond planes, and Fanioz is doing the best. Eventually, ALL AIs went bankrupt.
PAX can't compete without a $300k start loan. Otherwise, it blows too much money on infrastructure building an airport and several transfer stations. It usually goes-under.
None of the AIs have been able to compete in desert climate on Hard settings, even if I give them 300k start money. NoCAB makes the foolish error of trying to cart diamonds using aircraft, and Admiral AI wastes money on multiple lines, and is forced to settle for road vehicles. All the AIs can't seem to deal with the higher cost of everything here. Here is a game I played recently on these settings, where ALL AIs in the game (PAX, Admiral, NoCAB and Fanioz) went under at least once.
The save game is before the AIs failed, in 1961. You can see that NoCAB is on the way to failure, making a pittance off those two diamond planes, and Fanioz is doing the best. Eventually, ALL AIs went bankrupt.
- Attachments
-
- Pladingham Transport, 27th Apr 1961.sav
- (111.89 KiB) Downloaded 171 times
Re: Can you outsmart the AIs? AI test scenarios
I actually looked into it and was quite surprised as well that NoCAB did this, but as it turns out. I believe the problem is with the AIEngine.GetCapaciy function, it only takes an engine ID as a parameter, but when you refit it with and other cargo this value changes. So for Coleman Count it reports it can hold 65 bags of diamonds, while in actuality it can only hold 18!
I'd like to post a request to Yexo to change the function from:
AIEngine.GetCapacity(EngineID) to AIEngine.GetCapacity(EngineID, CargoID)
That should solve the problem I think. For now I use the following piece of code to 'fix' it, but it will undoubtedly fail with a random NewGRF package...
I'd like to post a request to Yexo to change the function from:
AIEngine.GetCapacity(EngineID) to AIEngine.GetCapacity(EngineID, CargoID)
That should solve the problem I think. For now I use the following piece of code to 'fix' it, but it will undoubtedly fail with a random NewGRF package...
Code: Select all
if (AIEngine.GetVehicleType(engineID) == AIVehicle.VT_AIR &&
AICargo.HasCargoClass(AIEngine.GetCargoType(engineID), AICargo.CC_PASSENGERS) &&
!AICargo.HasCargoClass(cargoID, AICargo.CC_PASSENGERS) &&
!AICargo.HasCargoClass(cargoID, AICargo.CC_MAIL)) {
if (AICargo.GetTownEffect(cargoID) == AICargo.TE_GOODS)
transportedCargoPerVehiclePerMonth *= 0.6;
else
transportedCargoPerVehiclePerMonth *= 0.3;
}
Re: Can you outsmart the AIs? AI test scenarios
I can load the savegame, but when I push the resume button, suddenly FanAI (yellow) become Convoy. And NoCAB (green) become FanAI. Admiral dan PaxLink still got correct. I don't really know, whether that was because load/save unsupported yet, or any other reason.defaultluser wrote:Well, you've all seen some of my scenarios. Some things I've seen:
....
....
Eventually, ALL AIs went bankrupt.

Hi morloth, IMHO AIVehicle::GetRefitCapacity(vehicle_id, CargoID) would give the same result. That is the capacity of vehicle after refit to cargoID. But never try that yetMorloth wrote:I actually looked into it and was quite surprised as well that NoCAB did this, but as it turns out. I believe the problem is with the AIEngine.GetCapaciy function, it only takes an engine ID as a parameter, but when you refit it with and other cargo this value changes. So for Coleman Count it reports it can hold 65 bags of diamonds, while in actuality it can only hold 18!
I'd like to post a request to Yexo to change the function from:
AIEngine.GetCapacity(EngineID) to AIEngine.GetCapacity(EngineID, CargoID)
....
[/code]


Re: Can you outsmart the AIs? AI test scenarios
That's true, but it requires you to build a vehicle first. And it's quite expensive to first build an airfield, aircraft, and only then being able to get the cargo capacity. Must be a better way without wasting moneyfanioz wrote: Hi morloth, IMHO AIVehicle::GetRefitCapacity(vehicle_id, CargoID) would give the same result. That is the capacity of vehicle after refit to cargoID. But never try that yet(just waiting a comment from yexo)

- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Can you outsmart the AIs? AI test scenarios
It is. But it would give the AIs access to something the human players don't have either. If I err, please tell me how I determine the refitted cargo capacity w/o actually building somethingMorloth wrote:That's true, but it requires you to build a vehicle first. And it's quite expensive to first build an airfield, aircraft, and only then being able to get the cargo capacity. Must be a better way without wasting money.

OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Can you outsmart the AIs? AI test scenarios
You're right.. (in that case: aircraft can only build on hangar -> airport) but I really do something like that. I build depot, buy a road vehicle (wich is more cheap than aircraft), and if I can't give it an order to go to one of my station/depot then I sell it to prevent invalid orderMorloth wrote: That's true, but it requires you to build a vehicle first. And it's quite expensive to first build an airfield, aircraft, and only then being able to get the cargo capacity.

For this reason ..... I agree with youMorloth wrote:Must be a better way without wasting money.

For this reason ..... I agree too with youplanetmaker wrote: It is. But it would give the AIs access to something the human players don't have either. If I err, please tell me how I determine the refitted cargo capacity w/o actually building something

Back to topic. Is there any other scenario to test?
Edit: I'm asking because I can't pass that scenario

-
- Engineer
- Posts: 11
- Joined: 19 Mar 2009 02:43
Re: Can you outsmart the AIs? AI test scenarios
Hi GeekToo,
I just downloaded the AI Convoy and dont know whether its applied to my game and if its working does it work after a while like 2-3 years? it should disable other kinds of transport right? please could you tell me whether it would work or if theres something else i have to do. i have the openttd version 0.7.0-RC1 thanks
I just downloaded the AI Convoy and dont know whether its applied to my game and if its working does it work after a while like 2-3 years? it should disable other kinds of transport right? please could you tell me whether it would work or if theres something else i have to do. i have the openttd version 0.7.0-RC1 thanks
-
- Engineer
- Posts: 34
- Joined: 01 Mar 2009 19:56
Re: Can you outsmart the AIs? AI test scenarios
Convoy doesn't support save/loading of games, that's currently on the to-do list. I've also seen it stop building even without a save/load, which is really weird, because I didn't see a crash log.££asai0*saim wrote:Hi GeekToo,
I just downloaded the AI Convoy and dont know whether its applied to my game and if its working does it work after a while like 2-3 years? it should disable other kinds of transport right? please could you tell me whether it would work or if theres something else i have to do. i have the openttd version 0.7.0-RC1 thanks
Re: Can you outsmart the AIs? AI test scenarios
I also like a function to get the capacity of individual cargos. I note that with andythenorth's HEQS set its not really feasible to use many of the refittable vehicles as the reported capacity from AIEngine is -1.
PathZilla - A networking AI - Now with tram support.
Re: Can you outsmart the AIs? AI test scenarios
I still had Pathzilla v5 with some changes (modified number of vehicles in a service) installed, so I tried this scenario with PathZilla (modified) and Admiral.
Admiral did nothing at all. I wonder what's the reason for that? Basically, it's only two towns right next to each other?
Pathzilla behaved nicely first. However it started jamming the roads in ~1963. A few years later, a new connection between the 2 cities emerged and the traffic jam problem was solved. Now a per-service hard limit for vehicles was reached (based on distance of cities, vehicle capacity and speed) and so the map is stuck at 75 vehicles. Some of them are busses and some are post trucks.
Admiral did nothing at all. I wonder what's the reason for that? Basically, it's only two towns right next to each other?
Pathzilla behaved nicely first. However it started jamming the roads in ~1963. A few years later, a new connection between the 2 cities emerged and the traffic jam problem was solved. Now a per-service hard limit for vehicles was reached (based on distance of cities, vehicle capacity and speed) and so the map is stuck at 75 vehicles. Some of them are busses and some are post trucks.
Re: Can you outsmart the AIs? AI test scenarios
Any body would try this ? 

- Attachments
-
- town-industry.test.scn
- (14.66 KiB) Downloaded 182 times
Re: Can you outsmart the AIs? AI test scenarios
Which GRFs are needed for your scenario, fanioz?
[update]nevermind, got it working..
Admiral and PathZilla seem to take forever to find a route. Or maybe I accidentally hit the pause key? Now that I think of it, the CPU seemed quite idle... I will try again later.[/update]
[update]nevermind, got it working..

Last edited by jui-feng on 26 Mar 2009 07:23, edited 1 time in total.
Re: Can you outsmart the AIs? AI test scenarios
Only the games original grfs, it worked for me without newgrfs.
It's a nice scenario indeed Fanioz, none of the AIs I've tried so far succeeded in making a profit. Then I tried myself, and though it took some time, I succeeded in making some money. So humans still rule!
It's a nice scenario indeed Fanioz, none of the AIs I've tried so far succeeded in making a profit. Then I tried myself, and though it took some time, I succeeded in making some money. So humans still rule!
-
- Engineer
- Posts: 34
- Joined: 01 Mar 2009 19:56
Re: Can you outsmart the AIs? AI test scenarios
GeekToo wrote:Only the games original grfs, it worked for me without newgrfs.
It's a nice scenario indeed Fanioz, none of the AIs I've tried so far succeeded in making a profit. Then I tried myself, and though it took some time, I succeeded in making some money. So humans still rule!
It's not hard for humans to make money in this scenario, because the cash and low costs mean you can afford a massive train line. In just three years I was making $1.3 million profit per year.
What really killed the AIs when I played was they were forced to use road vehicles, and they didn't space-out depots along their lines. Thus, road vehicles would turn around at the halfway point.
Re: Can you outsmart the AIs? AI test scenarios
First time I made this scenario is to test how Ai path finding work. In the hope that no one can servicing town or industry except human player. But I'm failed, because convoy does good job:). And NoCab does terraforming to build airport and build road on coast. Although it is unprofitable much.
Defaultuser, is it reasonable for ai to build depot along route? Imo, (and is implemented by fanai, which is build depot near source and destination) giving the vehicles an explicit goto depot order would prevent them search other depot. (Still needed to be proven:)) anyway thanks all for the feedback.
Hope to find an other test scenario.
Defaultuser, is it reasonable for ai to build depot along route? Imo, (and is implemented by fanai, which is build depot near source and destination) giving the vehicles an explicit goto depot order would prevent them search other depot. (Still needed to be proven:)) anyway thanks all for the feedback.
Hope to find an other test scenario.

Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 1 guest