PDA

View Full Version : AI Programming


Ian_Coleman
December 4th, 2008, 01:45 PM
Imagine a situation in which a train under AI control arrives at a terminus where the driver has been programmed to drive to Platform 1. Unfortunately, another AI controlled train which has been delayed for some reason is already situated at Platform 1. The result is a holdup which will probably need human assistance.

I would like to see an instruction to AI drivers which tells them "Drive to Platform 1 - if Platform 1 is not available then drive to Platform 2"

Although I am not capable of producing such a rule, I feel fairly sure that it would be possible.

Does anyone know whether that could be achieved?

Ian

davesnow
December 4th, 2008, 01:50 PM
Man, that would be a GREAT rule to have! I have had AI trains in that predicament before. That rule could solve problems.

aardvark1
December 4th, 2008, 02:46 PM
Would this work?

Enter Drive to....... Platform 1
Enter - Wait for 10 minutes
Enter Drive to....... Platform 2

If Platform 1 is open...then all is good and the driver does his thing. Don't forget to DELETE the Wait for and Drive to Platform 2 commands.

If Platform 1 is occupied....then DELETE the Drive to platform 1 and DELETE the Wait for 10 Minutes.

Then AI would attempt to drive to platform 2....if open.

Just a thought.

Have fun,

Capt_Haddock
December 4th, 2008, 03:41 PM
Ian

I posted a related question earlier this year.
http://forums.auran.com/trainz/showthread.php?t=22532
Natvander's second reply briefly describes a way of using Variables to set up an "IF" type control control loop.
I have not tried it but it looks promising.

Chris

pguy
December 4th, 2008, 03:53 PM
The command DriveToTrackmarkList (<kuid2:61392:1050:3>) has been written for this purpose.
You need to add a trackmark under surveyor at each platform that you will name station(1) station(2) station(3) ... station(n).
Then you can use DriveToTrackmarklist command with either the option DriveTo first not occupied trackmark or DriveTo random not occupied trackmark in list.

This command is already available on the DLS but needs tracmarks. Of course, it is possible to write a new command that can do the same driving to a not occupied platform. May be I will do that if I get some available time.

dougtrain
December 4th, 2008, 06:22 PM
Hi Guys... I like this idea of changing platforms with a rule. This brings more realism to the game. We can have a big "sorry but - change of platform" train announcement and watch all our passengers rushing over the footbridge! This all gets more like the real thing every day.... bring it on.

Doug:p