An AI that would not build roads

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
Denswillow
Engineer
Engineer
Posts: 25
Joined: 01 May 2016 12:56

An AI that would not build roads

Post by Denswillow »

I have very limited knowledge of coding but have an idea for a new AI. It would build stations and manage road traffic, but would rely on player built roads and not build them itself. How hard would it be to write one? I have tested Rondje, but it always builds drive-trough stops over tramway lines and blocks all traffic.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: An AI that would not build roads

Post by Alberth »

Not very different from a normal AI, is my guess. You don't build road, but for making money you still need to have a road connection so you need to verify which connections exist. Also, as you don't own the roads, its builder can also delete the road at any time, which is another challenge.

Of course, relying on your opponent to allow you to have a profitable road connection isn't a very smart idea :p
Being a retired OpenTTD developer does not mean I know what I am doing.
Denswillow
Engineer
Engineer
Posts: 25
Joined: 01 May 2016 12:56

Re: An AI that would not build roads

Post by Denswillow »

Alberth wrote: 21 Jul 2019 14:33 Not very different from a normal AI, is my guess. You don't build road, but for making money you still need to have a road connection so you need to verify which connections exist. Also, as you don't own the roads, its builder can also delete the road at any time, which is another challenge.

Of course, relying on your opponent to allow you to have a profitable road connection isn't a very smart idea :p
The idea was that there was a player-controlled(via cheats) company beside the "no-road-AI" that acts like a department for roads and builds the roads for all players. That would also prevent some AI weirdness, like bridges cutting distance when there is a coast to follow or level crossing on six-track mainline.
Wormnest
Engineer
Engineer
Posts: 117
Joined: 14 Jul 2013 12:33
Location: Netherlands

Re: An AI that would not build roads

Post by Wormnest »

Find an AI that uses road vehicles and change its pathfinder to give max penalties to anything except already existing roads, bridges and tunnels.
Denswillow
Engineer
Engineer
Posts: 25
Joined: 01 May 2016 12:56

Re: An AI that would not build roads

Post by Denswillow »

Wormnest wrote: 21 Jul 2019 16:03 Find an AI that uses road vehicles and change its pathfinder to give max penalties to anything except already existing roads, bridges and tunnels.
I can change the code but can`t get OpenTTD to recognise it as an AI.
Wormnest
Engineer
Engineer
Posts: 117
Joined: 14 Jul 2013 12:33
Location: Netherlands

Re: An AI that would not build roads

Post by Wormnest »

Denswillow wrote: 21 Jul 2019 18:45 I can change the code but can`t get OpenTTD to recognise it as an AI.
Sounds like an error in your changes, maybe a missing bracket or quote. Did you change the info.nut to give it a different name and shortname?
Denswillow
Engineer
Engineer
Posts: 25
Joined: 01 May 2016 12:56

Re: An AI that would not build roads

Post by Denswillow »

Wormnest wrote: 21 Jul 2019 19:49
Denswillow wrote: 21 Jul 2019 18:45 I can change the code but can`t get OpenTTD to recognise it as an AI.
Sounds like an error in your changes, maybe a missing bracket or quote. Did you change the info.nut to give it a different name and shortname?
Yes, changed the name and also changed the class name in the main.nut.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 28 guests