Selecting locomotives when using newgrfs

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

Post Reply
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Selecting locomotives when using newgrfs

Post by Michiel »

Fellow AI writers,

What criteria are you using to select an engine for a train? I'm currently testing with the 2cc set and I'm running into interesting stuff such as this, when it selects a "Budapest 1894" and tries to add wagons to it:
Image

I'm currently checking:
- IsWagon (discard those)
- CanRunOnRail and HasPowerOnRail
- CanPullCargo (passengers)
- 200 hp minimum (arbitrary, just so it doesn't try to build rail busses or something really weak)

Then, I sort by price and pick one from the middle of the list, so it won't try to buy one a 400.000 pound "Big Boy".
How, other than by trial and error, to figure out which ones are your basic, simple, will-pull-wagons-for-food locomotives?

Edit: for now, I'll exclude the ones which carry passengers by themselves, even though they might be very useful.
Edit: well that doesn't work, all the 2cc monorail engines carry passengers.
Edit: trial and error it is; if it can't add wagons to an engine it sells it and adds it to the list of "do not buy again".
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Selecting locomotives when using newgrfs

Post by planetmaker »

Hello,

though I'm not an AI writer, I maybe can add something :)
Michiel wrote:(...)'m currently testing with the 2cc set (...)
I'm currently checking:
- IsWagon (discard those)
- CanRunOnRail and HasPowerOnRail
- CanPullCargo (passengers)
- 200 hp minimum (arbitrary, just so it doesn't try to build rail busses or something really weak)

Edit: for now, I'll exclude the ones which carry passengers by themselves, even though they might be very useful.
Edit: well that doesn't work, all the 2cc monorail engines carry passengers.
Edit: trial and error it is; if it can't add wagons to an engine it sells it and adds it to the list of "do not buy again".
There's not real general rule to these things as grf writers are quite free on what to allow and what to forbid. And yes, monorail with 2cc Train Set is meant to be sub urban transport with large capacity (pax only) where you can only attach things to itself.

The general thing which also only safely works for a human is to actually test what works and memorize that- that's not bound to fail. Humans might have the advantage that sometimes the grf authors give a hint to as what works in the engine's description. But that's purely optional and based on the good mood of them :P
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests