Page 1 of 1

An AI that would not build roads

Posted: 21 Jul 2019 11:46
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.

Re: An AI that would not build roads

Posted: 21 Jul 2019 14:33
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

Re: An AI that would not build roads

Posted: 21 Jul 2019 15:16
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.

Re: An AI that would not build roads

Posted: 21 Jul 2019 16:03
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.

Re: An AI that would not build roads

Posted: 21 Jul 2019 18:45
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.

Re: An AI that would not build roads

Posted: 21 Jul 2019 19:49
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?

Re: An AI that would not build roads

Posted: 21 Jul 2019 20:34
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.