Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Sep 26, 2017 12:07 am

All times are UTC




Post new topic  Reply to topic  [ 93 posts ]  Go to page 1 2 3 4 5 Next
Author Message
 Post subject: DictatorAI
PostPosted: Fri Feb 18, 2011 11:13 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
Hi everyone,

This is now version 1.00, pfff, after all this time i finally manage to do it !
You can grab it on bananas

I'm happy how the AI perform and compete with others, specially without using trains and the eyecandy features doesn't really impact its perf so much.

This is what the AI does now :
- Handle roads (truck all cargos, bus)
- Handle aircrafts (limited to passenger & mail), upto 5 different models could run at the same time (that's to gave a more human touch & diversity in the game, including choppers)
- Should be playable on hard conditions (low money, hard settings... in fact because i need to tune it up a bit more, it play nicer for now in poor conditions)
- Can upgrade vehicles (using its own vehicle upgrade)
- Can upgrade airports
- Can upgrade road stations
- Try to build a network of airports and run aircrafts on it
- 3 options that affect gameplay (a bit dumb ai, fair player or total war), adapt to difficulty settings (this influence where it build stations, number of vehicles allowed...)
- Save/Load supported
- Pretty stable (well, that's not a feature, but it should :P )
- Works with newgrfs (well, the ones i test, ones that change vehicles)
- Can autorepair damage route (road route only)
- Balance load at airports
- Balance load at stations
- Reuse stations & depots (also have a limit per towns to not crowd towns, this depend on gameplay options)
- Detect and lower roads stuck with too many vehicles

I'll be glad to get feedback (specially bugs, i hope you won't get too much crashs)
Thank you


Attachments:
cEngineLib.9.tar [90 KiB]
Downloaded 312 times
DictatorAI-177.tar [670 KiB]
Downloaded 525 times


Last edited by krinn on Mon Mar 16, 2015 12:59 pm, edited 30 times in total.
Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Feb 19, 2011 12:07 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
I had to untar the tar-file in order to make it load in OpenTTD. A correctly made .tar should not need to be untared. I've heard that some people have used a rar-program that can make tar files that are not fully compatible with OpenTTD. With 7zip however the tar files produced are compatible with OpenTTD.

Just before posting this report, your AI crashed and produced this error:
Attachment:
Unnamed, 31st Aug 1971.png [63.25 KiB]
Downloaded 2 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Feb 19, 2011 1:51 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 873
Nice job! :D I wonder what you will be able to do having started as a fork of SimpleAI...
I've been testing it now, here are my remarks:
  • Your AI is quite CPU-heavy. The game lags hard if you're fast forwarding, and after 4 years, it lags even on normal speed. Try to add some AIController::Sleep()-s in your code.
  • I'm sure you know it, as there are quite a lot of occurences of this one:
    Attachment:
    Unnamed, 19th Aug 1950.png
    Unnamed, 19th Aug 1950.png [ 32.51 KiB | Viewed 22165 times ]

    I've seen two types of this problem: when the land was sloped wrong and when it wasn't, probably a vehicle was in the way when the AI tried to connect that piece of road.
  • I've seen a route where there were no depots, only double stations at both ends. But later I saw that two depots had been built - clever! :)
  • A little thing, but "Napoleon" as the manager name appears to be wrong. Some coding issue, I believe.
I've attached the savegame.
Attachment:
Unnamed, 6th Feb 1954.sav [460.27 KiB]
Downloaded 275 times

It's nice to see a new AI, keep up the good work! :)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Feb 19, 2011 6:50 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
Thank you for trying it guys.

Zuu: saddly i can't post a new working version with correction to the bug you've catch Zuu (i've modify too much the ai, and big changes aren't finished yet), but it's now fix.
For the tar problem, i don't know, i have just use tar -cf to build it, and file roller to remove a TODO file from it (might be file roller that put havock)

Brumi: will do, i know it run hards for now i will try optimize that a bit later.
I know the slope problem, last time i played with slope i was having headhatch :P
I'll note i should fix that

For the strange no depot on route or not connected station, it's because if the ai lack money it just stop building road structure (or depot) until it will try later to fix this (as long as station is there, route is considered "working", and that could be fix with few more bucks). The ai itself love to destroy its own depot because it's like a reserved space to upgrade the station, it work nice to find a spot next to your current station, it doesn't work nice when you destroy your depot and lack money ^^

The napoleon bug comes because the name is "a la french", so it's Napoléon, looks like openttd doesn't really like the "é", i have drop it to fix that.

I've start big changes to the ai i was planning to end this WE, saddly i have to go work (and it wasn't plan at first), so i'm affraid i couldn't gave you a new version with less bugs soon.


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Feb 19, 2011 6:53 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Feb 09, 2006 7:15 pm
Posts: 3815
krinn wrote:
it's Napoléon, looks like openttd doesn't really like the "é"
It should, as far as I know work. As long as you're using the right encoding for the files, i.e. as long as the file it UTF-8 encoded.

After all, the translated AI error messages, when they crash, use the same kind of characters; they even can handle the Chinese characters.


Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Apr 21, 2011 9:32 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 873
I've just noticed that you're releasing newer versions :) By only editing the first post, your updates go quite unnoticed... Could you post a message in this thread when you release a new version? I think it's quite a legitimate reason for bumping a topic.
Anyway, congrats for the new release, I'll test it more when I'll have a bit more free time :)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Apr 21, 2011 11:12 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
ok, i will do brumi
i've made a small update that just correct a bug, no big deal, it's rare condition, but it will end the ai running if you fall on it.


Top
   
 Post subject: Re: DictatorAI
PostPosted: Wed Jun 01, 2011 3:30 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 873
I found a bug in your AI:


Attachments:
dictator crash.png
dictator crash.png [ 16.4 KiB | Viewed 21171 times ]
Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Jun 09, 2011 1:05 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
Thank you brumi for reporting it.
I don't have much time to correct it now, i've just check the code to see conditions where this bug could come from. And found it easy, the solve need a better analyze to see why it happen (the bug itself isn't interresting, why it happen is more).

I will correct it when i have more time, i might do a simple workaround until i could do better.
And i also need to add trains, and change things (like optimize for big map play) and this and that and.... pfff so much time need !


Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Jun 09, 2011 10:04 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
krinn wrote:
... pfff so much time need !


Indeed! If it wasn't for the time constraint, I would have had a many more features in CluelessPlus, and I would have time to improve PAXLink so that it works better on the economy management section. :-D

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Fri Jun 10, 2011 9:06 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
i've update to 102 (only in bananas) with a workaround for the bug brumi, but as it need specials conditions (if i'm right a dead industry gone while saving game and effect appears when loading that savegame where the ai still think the industry exists), i would be glad if you can try it on your savegame to see it work (and that not others bad effects appears, as it's a quickfix and not a real deep debug).


Zuu: it's even worst, the more time i lack to code & fix things, the more i think about what i could do to make things better.... But as it's the period where my job eats all my time until winter, i'm far from an escape.


Top
   
 Post subject: Re: DictatorAI
PostPosted: Fri Jun 10, 2011 11:03 am 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 873
I loaded the savegame from this post, as that is the last one I have before your AI crashed. But that probably won't reproduce the crash, as the game was reloaded from an autosave during that period, not the savegame in the post I mentioned.

But I encountered a new crash in 1972:


Attachments:
new crash.png
new crash.png [ 31.84 KiB | Viewed 21002 times ]
Top
   
 Post subject: Re: DictatorAI
PostPosted: Mon Jul 11, 2011 5:03 pm 
Offline
Engineer
Engineer
User avatar

Joined: Tue Jun 21, 2011 4:30 pm
Posts: 32
Howdy,

?( Looking at your code and wondering what does this do?(comments are mine)...

local townid = townlist.Begin(); // townid is TownID?

local townloc = AITown.GetLocation(townid); //townloc is TileIndex

local place_id = AITile.GetClosestTown(townloc); //place_id is TownID

Is there some advantage to this?

Please advise,
Kev!

_________________
I DO like a nice caboose...


Top
   
 Post subject: Re: DictatorAI
PostPosted: Mon Jul 11, 2011 7:53 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
no there's none, just some code left from trys while learning the api & language.
It's the easiest thing you could create with a visible result. I suppose everyone start playing with the buildhq at first no ? :)

i've start the ai with 0 knowledge about squirrel and api, thanks to brumi's code, i've learned a lot from that. The ai start as a fork of simpleai because brumi want keep simpleai as close to original ai while i was wishing some more functionalities.
then after modifying a lot and adding a lot, i was stuck by poor concept and limitations, learning more (this time from rondje) shown me howto implement oop with squirrel (and i must say, it's the most nice and smart code i've seen in squirrel),
So i've change my mind and rewrite nearly everything from scratch, keeping some basic functions i don't feel the need to rewrite.
this is just a part left from earlier dev of the ai.


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Jul 23, 2011 4:02 pm 
Offline
Engineer
Engineer

Joined: Mon Apr 16, 2007 7:50 pm
Posts: 45
Location: Louvain
Same here, bug after a 'load game', seconds into the game


Attachments:
Green Is The Colour, 25 Jun 1881.png
Green Is The Colour, 25 Jun 1881.png [ 10.28 KiB | Viewed 20454 times ]

_________________
Felix Atagong
The Holy Church of Iggy the Inuit
Top
   
 Post subject: Re: DictatorAI
PostPosted: Sun Jul 24, 2011 10:03 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
thank you for the report felix, can you provide the savegame to track this one better ?


Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Jul 28, 2011 8:39 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
Recently I ran a comparison fight between your DictatorAI and my CluelessPlus AI:

Stats:
Attachment:
Unnamed, 18th Jul 1954.png [180.67 KiB]
Downloaded 2 times

Attachment:
Unnamed, 9th Feb 1964.png [242.32 KiB]
Downloaded 2 times


One thing I noticed is that your AI use more stations than mine. It can potentially find a gold mine by exploring more connections quicker but will get a higher maintenance cost as one has to pay maintenance for each station that the AI has. The maintenance fee is not very high though, so as long as you don't spam the game with stations, it is not a major issue. (but it is a contributing factor why PAXLink has economic problems)

In this game, my AI didn't build even a single air link, but your AI managed to build one. Good. :-)

People who like to complain on bad reuse of road will be disappointing by this game as both AIs did a very good job on this. ;-)


Save game:
Attachment:
File comment: IIRC a recent nightly is required. Eg "Last nightly" or so :-)
CLUP vs DictatorAI.sav [228.76 KiB]
Downloaded 238 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Thu Jul 28, 2011 9:08 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
i'm happy you've gave a try at my ai zuu, not so happy by the results :)

but i'll try to change that, if my ai manage to understand howto terraform one day ^^

for the airline, i have made code to help build one and help build aircrafts as well, so it's not a big surprise for me, just result of work and evil thinking.
I'm still happy it work as expect this time :)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Jul 30, 2011 3:54 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
Your AI crashed:
Attachment:
dictator_error.png [18.84 KiB]
Downloaded 2 times


The game is aircraft only. Crash occurred after loading the attached save. Note that I've loaded this save a few time and at two times your AI crashed. Eg. you might have to try a few times until it crashes.

Attachment:
File comment: Yesterdays OpenTTD nightly
AITest2.sav [471.94 KiB]
Downloaded 214 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: DictatorAI
PostPosted: Sat Jul 30, 2011 5:20 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
Thank you zuu & Felix Atagong, found it, and correct it.
It was easier than i first think.

I will look if i could cleanup a bit the ai to release a fix version. (as i work on it, the ai isn't a "nice" state for now)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 93 posts ]  Go to page 1 2 3 4 5 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.