Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu May 23, 2019 5:56 pm

All times are UTC




Post new topic  Reply to topic  [ 204 posts ]  Go to page Previous 13 4 5 6 711 Next
Author Message
PostPosted: Tue Jul 21, 2009 1:48 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Dustin wrote:
Fanioz,

I am trying your AI out against mine. In 3 of 4 trials your AI got off to a slow start and went bankrupt (at which time I stopped). However, when yours got a good start, mine can't keep up. My passing lane builder is just too slow. (I have some ideas to fix that.) Your system (however it works) works nicely and you build routes much faster than my AI. Well done sir!

I like your network. Your stations with the depot and PBS signal works really well.

I would suggest you should limit your starting route distance. If your first route is short (50-200 tiles) then your AI gets a good start and runs well. Otherwise it's very nice. I really like your debug output. Very friendly. -> Good Job :-D

I would like to see derchesten try to do better. Yours is a nice AI and I am impressed by it. Moreso that you aren't a programmer. Squirrel isn't the easiest scripting language! (But I like it well for this.)

Thanks Dustin. :D. I would like to take an other approach to solve the pathfinding waste time.
Thanks for testing. :D

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Sun Jul 26, 2009 5:59 pm 
Offline
President
President

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 903
Hi Fanioz,
I experienced some strange behaviour while playing with your AI. If '#opcodes before AI is suspended' is set to 5,000, sometimes Trans AI 'forgets' to start the first vehicle of a line, and doesn't rename the recieving station. I tried to figure out when this happens, but it seems to be random, it occurs in roughly 50% of the cases when the opcode count is set to 5,000. May be a bug in the API... Or are the AIs expected to behave differently based on this setting?
Anyway, I like the idea that Trans starts the first train before building the second line, it comes good if the AI fails to build it.
Attachment:
TransAI strange behaviour.sav [90.22 KiB]
Downloaded 112 times

And some other issues:
If the AI fails to connect a road due to congestion, it doesn't check (correctly) if the road is OK or the vehicles indeed arrive to the station. Later Trans buys loads of new trucks, hoping to improve the service, but fails.
I'm happy to see that Trans transports mail (and passengers by train), but it's not optimal yet, it often tries to transport mail from small villages. Or it builds entire mail trains, and the station is too far away from the town centre. Maybe combined passenger/mail trains?
I'm sorry if I seem to crtiticise your AI, in fact I really like it :)


Top
   
PostPosted: Mon Jul 27, 2009 7:05 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
About not renaming certain stations, I have noticed that sometimes PAXLink fail to rename its inter-city stations. I have not been able to track down the reason for it, but I have not tried any different op-code settings than the default value.

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


Top
   
PostPosted: Mon Jul 27, 2009 9:18 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Brumi wrote:
Hi Fanioz,

Hi, (again) Brumi :D
Brumi wrote:
I experienced some strange behaviour while playing with your AI. If '#opcodes before AI is suspended' is set to 5,000, sometimes Trans AI 'forgets' to start the first vehicle of a line, and doesn't rename the recieving station. I tried to figure out when this happens, but it seems to be random, it occurs in roughly 50% of the cases when the opcode count is set to 5,000. May be a bug in the API... Or are the AIs expected to behave differently based on this setting?
Anyway, I like the idea that Trans starts the first train before building the second line, it comes good if the AI fails to build it.
Attachment:
TransAI strange behaviour.sav


me too, :D , So, it maybe API/OpenTTD bug, but I need to prove it with simplified script to reproduce this behaviour. Another thing happened if opcode was set to 5,000 is : Building a long rail track (about 400+ tiles) it will can't build some tiles in the middle, with the result of AIError.GetLastError() == AIError.Unknown.
And since the sequence of servicing is not satisfied, TransAI will immediatelly break, so it doesn't rename the station. And you're right, this occurs in roughly 50% of the cases.
Brumi wrote:
And some other issues:
If the AI fails to connect a road due to congestion, it doesn't check (correctly) if the road is OK or the vehicles indeed arrive to the station. Later Trans buys loads of new trucks, hoping to improve the service, but fails.

Current code doesn't check if a vehicle was arrive at station, just make sure there are road tiles connected. I think, I should improve this. :)
Brumi wrote:
I'm happy to see that Trans transports mail (and passengers by train), but it's not optimal yet, it often tries to transport mail from small villages. Or it builds entire mail trains, and the station is too far away from the town centre. Maybe combined passenger/mail trains?

Trans, would try to transport all transportable cargo, but it seems there are many things to check before doing something. :)
Brumi wrote:
I'm sorry if I seem to crtiticise your AI, in fact I really like it :)

Thanks, I'm glad to know what is inside your mind / your opinion about Trans. :D

Zuu wrote:
About not renaming certain stations, I have noticed that sometimes PAXLink fail to rename its inter-city stations. I have not been able to track down the reason for it, but I have not tried any different op-code settings than the default value.


Well, if that is really true, it mean that OpenTTD opcode switcher (or whatever the name :?: ) forget to return to AI's state, or there is something I did'nt know yet ? :D

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Thu Jul 30, 2009 9:55 am 
Offline
President
President

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 903
Hi Fanioz,
Recently I've been trying to understand the mechanics of your AI by looking at the AI debug window. Reading the code itself is still hard for me, as I'm completely new to C and Squirrel.
I have a few questions:
What is PRECONDITION_FAILED? ?( The API documentation doesn't say much about this. I'm comfused when I see lines like this: Last month transported:0 PRECONDITION_FAILED
Is it intentional that it always tries the same destination for a given cargo? It can lead to complications when there is not enough space to build the destination station.
I tested TransAI on toyland as well (Why not? :)) ), and there fizzy drinks seem to be problematic. I think this problem may apply to all types of secondary cargo which are transported to towns.
Here is a screenshot:
Attachment:
transai fizzydrink.png [111.53 KiB]
Downloaded 60 times

It seems that TransAI failed to build the source station, and that particular fizzy drink factory can be seen in the background. I think a station could be built there without problems... It might be the problem that Trans doesn't build adjacent stations separately (from a player-point of view, it doesn't press Ctrl while placing a station). Or is it the destination station which cannot be built? :? (it is always harder for goods-type cargoes)
And one more thing, the bug I mentioned in my previous post occurs if the opcode count is set to 10,000, but with a smaller probability.
Nevertheless, it is a good AI, I think it is fun to play against. I like the friendly environment of the debug window, welcoming new companies and industries, etc. :)


Top
   
PostPosted: Fri Jul 31, 2009 1:31 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Brumi wrote:
Hi Fanioz,

Hi Brumi :D
Brumi wrote:
Recently I've been trying to understand the mechanics of your AI by looking at the AI debug window. Reading the code itself is still hard for me, as I'm completely new to C and Squirrel.

I'm a newbie too :) ,look at the 2nd post, there was downloadable code documentation , you may could understand some of them.
Brumi wrote:
I have a few questions:
What is PRECONDITION_FAILED? ?( The API documentation doesn't say much about this. I'm comfused when I see lines like this: Last month transported:0 PRECONDITION_FAILED


Quote:
int32 AIIndustry::GetLastMonthTransported (IndustryID industry_id, CargoID cargo_id) [static]
Get the total amount of cargo transported from an industry last month.

Parameters:
industry_id The index of the industry.
cargo_id The index of the cargo.

Precondition:
IsValidIndustry(industry_id).

AICargo::IsValidCargo(cargo_id).

Returns:
The amount of given cargo transported from this industry last month.

When the Industry no longer valid (disappear) this will return PRECONDITION_FAILED

Brumi wrote:
Is it intentional that it always tries the same destination for a given cargo? It can lead to complications when there is not enough space to build the destination station.

Yes. I've think about it. And current code should choose another new destination. But it maybe doesn't work well now.
Brumi wrote:
I tested TransAI on toyland as well (Why not? :)) ), and there fizzy drinks seem to be problematic. I think this problem may apply to all types of secondary cargo which are transported to towns.
Here is a screenshot:
Attachment:
transai fizzydrink.png

It seems that TransAI failed to build the source station, and that particular fizzy drink factory can be seen in the background. I think a station could be built there without problems... It might be the problem that Trans doesn't build adjacent stations separately (from a player-point of view, it doesn't press Ctrl while placing a station). Or is it the destination station which cannot be built? :? (it is always harder for goods-type cargoes)

The log said, it was source station can't build there, and I have not found any valid reason why Trans can't find tile any more
Brumi wrote:
And one more thing, the bug I mentioned in my previous post occurs if the opcode count is set to 10,000, but with a smaller probability.

I still have no a valid reason too for this.
Brumi wrote:
Nevertheless, it is a good AI, I think it is fun to play against. I like the friendly environment of the debug window, welcoming new companies and industries, etc. :)

Thanks... I'm still working on this AI to improve it. :D

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Fri Jul 31, 2009 1:37 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
fanioz wrote:
When the Industry no longer valid (disappear) this will return PRECONDITION_FAILED

Please don't count on that as the IndustryID will be reused when a new industry appears. For example. it's possible that an industry closes on jan 1, and on jan 2 a new industry opens with the same ID.


Top
   
PostPosted: Fri Jul 31, 2009 5:24 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Dec 07, 2005 7:22 pm
Posts: 272
Yexo wrote:
fanioz wrote:
When the Industry no longer valid (disappear) this will return PRECONDITION_FAILED

Please don't count on that as the IndustryID will be reused when a new industry appears. For example. it's possible that an industry closes on jan 1, and on jan 2 a new industry opens with the same ID.


I have the same sort of logic in my AI. What I did it save the location of the industry, then check to see if that location still has an industry with the same ID. To trick my AI the game would have to remove the industry, then plop down a new one in the same spot with the same ID but different cargo within 90 days.

_________________
Denver & Rio Grande Railroad AI


Top
   
PostPosted: Fri Jul 31, 2009 5:33 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Again, don't count on that not happening. A user might not like a coal mine and use the magic bulldozer cheat to destroy it and then build an iron mine in the same spot;


Top
   
PostPosted: Fri Jul 31, 2009 7:58 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Dec 07, 2005 7:22 pm
Posts: 272
Yexo wrote:
Again, don't count on that not happening. A user might not like a coal mine and use the magic bulldozer cheat to destroy it and then build an iron mine in the same spot;


Well, I personally consider that to be pretty unlikely. And when the coal runs out I would sell off the route anyway.

_________________
Denver & Rio Grande Railroad AI


Top
   
PostPosted: Sun Aug 02, 2009 1:18 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Okay, after investigating ...: :D
1. Its maybe an invalid industry
2. Its maybe an invalid cargo
3. its maybe my variable for storing Industry is not valid
4. All of above is valid :
In this case, my debugger code give an invalid output. it only check if
Code:
 AIError.GetLastError() != AIError.ERR_NONE;

If there is error from previous command (before checking last_month_transported), it would be catch again here. Therefore I ever asked something like AIError.ClearLastErr(), but I think I can do this way :

Code:
AISign.ClearSign(AISign.BuildSign(AIMap.GetTileIndex(1,1), "LastErrorCleaner"));


Would be fixed in the next version.

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Sun Aug 02, 2009 1:24 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Another option is to check the return value so see if there is any error. Every command that can return an error returns true if successful and false if not.


Top
   
PostPosted: Sun Aug 02, 2009 2:47 pm 
Offline
Engineer
Engineer

Joined: Mon Apr 16, 2007 7:50 pm
Posts: 45
Location: Louvain
Hi Fanioz,

You'll see a crash report at http://bugs.openttd.org/task/3078... the game crashes when Trans v90713 kicks in...

*** OpenTTD Crash Report ***
Date: 2009-08-01 21:13:40
Build: 0.7.2-RC1 (0) built on Jul 15 2009 20:57:25
Reason: Assertion failed at ..\src\ai\api\ai_testmode.cpp:24: this->GetDoCommandModeInstance() == this
Language: dutch.lng
Exception C0000005 at 004FBAF6

Probably it is Trans (v90713) that causes this behaviour... this is its last message... (see also screenshot)
Executing Headquarter Builder Task

Hope you can do something with that...


Attachments:
crash.png
crash.png [ 6.24 KiB | Viewed 3290 times ]

_________________
Felix Atagong
The Holy Church of Iggy the Inuit
Top
   
PostPosted: Mon Aug 03, 2009 1:03 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Felix Atagong wrote:
Hi Fanioz,

You'll see a crash report at http://bugs.openttd.org/task/3078... the game crashes when Trans v90713 kicks in...

*** OpenTTD Crash Report ***
Date: 2009-08-01 21:13:40
Build: 0.7.2-RC1 (0) built on Jul 15 2009 20:57:25
Reason: Assertion failed at ..\src\ai\api\ai_testmode.cpp:24: this->GetDoCommandModeInstance() == this
Language: dutch.lng
Exception C0000005 at 004FBAF6

Probably it is Trans (v90713) that causes this behaviour... this is its last message... (see also screenshot)
Executing Headquarter Builder Task

Hope you can do something with that...


Confirmed.
will fix it soon, thanks :)

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Wed Aug 19, 2009 10:38 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Here is new U.S Zip code for Trans :P
* 090819 *

Which is doesn't contain any improvement, only fix the following :

Fix :: Crash on un-managed TestMode
Fix :: Wrong "last_transport" setting
Fix :: Error type while Save/Loading Station manager

I'm sorry for any inconvenience. Hope you enjoying :D

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Thu Aug 20, 2009 3:34 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2365
Location: Location, Location
will it still run on 0.7.2?
on content download its vanished!

_________________
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


Top
   
PostPosted: Fri Aug 21, 2009 9:50 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Thu Aug 03, 2006 7:32 pm
Posts: 318
Skype: woldy_bg
Location: Bulgaria
Well eventually the road was finished but it took quite a while to do so

Attachment:
Hardinghall Transport, 30th Mar 1966.png [122.08 KiB]
Downloaded 42 times


The other thing - you said you've fixed the bridge problem :)

Attachment:
Unnamed, 30th May 1970.png [78.01 KiB]
Downloaded 43 times

_________________
Image


Top
   
PostPosted: Sun Aug 23, 2009 5:44 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
A quick update : :lol:
Lord Aro wrote:
will it still run on 0.7.2?
on content download its vanished!

It should working now.

Wold wrote:
Well eventually the road was finished but it took quite a while to do so

Attachment:
Hardinghall Transport, 30th Mar 1966.png


The other thing - you said you've fixed the bridge problem :)

Attachment:
Unnamed, 30th May 1970.png


Please confirm if I've fixed it now :D

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
PostPosted: Sun Aug 23, 2009 6:37 pm 
Offline
President
President

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 903
Hi Fanioz,
I'm happy about the new release. :)
Let me return to the engine selection problem a bit:
I looked in your code, trying to fix it. I did a little change to Vehicles.SortedEngines:
Code:
static function SortedEngines(engines)
   {
      local heap = FibonacciHeap();
      foreach (idx, val in engines) {
         AIController.Sleep(1);
         local score = 1000000;
         if (AIEngine.IsWagon(idx)) {
            score -= AIEngine.GetCapacity(idx);
            heap.Insert(idx, score);
            continue;
         }
         
         local vtype = AIEngine.GetVehicleType(idx);
         if (vtype == AIVehicle.VT_ROAD) {
            score -=  AIEngine.GetMaxSpeed(idx);
         }
         
         if (vtype == AIVehicle.VT_RAIL) {
            score -= AIEngine.GetPower(idx);
            if (!TransAI.Setting.Get(Const.Settings.realistic_acceleration)) {
                  score -= AIEngine.GetMaxTractiveEffort(idx);
            }
         }
         heap.Insert(idx, score);
      }
      return heap;
   }

I put the line 'local score = 1000000;' in the foreach cycle, and it worked. :) Trans was now choosing better train engines with the default set. I don't know if there are other places to fix this problem, please tell me if this fix is right or not.


Top
   
PostPosted: Mon Aug 24, 2009 12:52 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Dec 19, 2008 5:03 am
Posts: 315
Location: Indonesia
Brumi wrote:
Hi Fanioz,
I'm happy about the new release. :)
Let me return to the engine selection problem a bit:
I looked in your code, trying to fix it. I did a little change to Vehicles.SortedEngines:
Code:
static function SortedEngines(engines)
@see ..above

I put the line 'local score = 1000000;' in the foreach cycle, and it worked. :) Trans was now choosing better train engines with the default set. I don't know if there are other places to fix this problem, please tell me if this fix is right or not.


Well, if that code is work then yes it is. :D , thanks for take the time to bring back issue and fix it.
And because you have made it, TransAI 090824 is now available both in 2nd post and Bananas.

PS:
The trunk code [WIP] would have an other code to handle 2cc trainset too, and for branch, this would be enough.

_________________
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 204 posts ]  Go to page Previous 13 4 5 6 711 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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-2019 phpBB Limited

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