CivilAI
Moderator: OpenTTD Developers
- andythenorth
- Tycoon
- Posts: 5667
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
Much civil. Very AI
I've got two of them in my current game. Jazzes it up a bit.
I've got two of them in my current game. Jazzes it up a bit.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: CivilAI
Is it possible to change company settings from the AI level?
I found AIGameSettings::GetValue, but not SetValue.
What I want to do is to change company setting to enable sharing depots (using IS patch).
I found AIGameSettings::GetValue, but not SetValue.
What I want to do is to change company setting to enable sharing depots (using IS patch).
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: CivilAI
Not sure how this is related to CivilAI, but have you tried switching into the company (via the cheat menu) and turning on the IS options yourself?What I want to do is to change company setting to enable sharing depots (using IS patch).
Re: CivilAI
Sorry for hijacking your thread
The problem is, that I'm using CivilAI on my server, and it is not possible, AFAIK, to jump into AI in multiplayer mode,
therefore was my attempt to change AI code.
Saving game and restarting server with changed save is not convenient due to password issues.
The problem is, that I'm using CivilAI on my server, and it is not possible, AFAIK, to jump into AI in multiplayer mode,
therefore was my attempt to change AI code.
Saving game and restarting server with changed save is not convenient due to password issues.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: CivilAI
Very nice to see that awesome AI get even better, Thank You Pikka !
Now i ve made some observation in a small test game :
- Choice of vehicle from AI is debatable, in my test, AI thought it s a good idea to use the very slow but high capacity vehicle from HEQS to transport Food. The vehicle loose money and the AI don t seems to care about it (it s sent to depot after loosing money for a moment, only to be replaced with the same vehcile), also it cause jams on the roads. I understand we can t avoid totally those jams with articulated vehicle, but maybe your AI could avoid selecting amongst the slowest vehicles when it intend to travel relatively far (in my game it choosed a slow vehicle to travel over 140 tiles (flight distance, i haven t counted the exact road distance). Imho those kind of vehicle should probably not be used for distance over 40 tiles.
- Road construction from AI, i have been surprised on how the AI build a lot of roads for nothing, doubling existing ones, creating dead ends.... I would say it s not enough reusing existing roads, it tries to be more efficient that way i supose (but fails at it in a few cases). It makes some very ugly road. In this screenie all the doubling of road have been made by AI, and they are all useless. In the down right corner of the screen, it s two Civil AI competing to lay as most road as they can it seems...even though a "not owned road, from the scenario" was already going through there.
If you wanna test and see for yourself how Civil AI is not enough reusing existing roads imho, i ve done my Test in Cindini, wich does already have a relatively dense road network from start.
- Ships, lovely addition, but is full load really a good idea ? i think with cargodist being used full load should be avoided (i imagine nowadays the majority of players uses it)... but at the same time i can understand why full load is a good idea if cargodist is off (avoid that busses let not enough passengers for the ships).
I haven t seen much else wrong for the moment, and i ve been rather impressed by the couple trains lines some of the Civil AI have built, they seemed very reasonable for AI !
Now i ve made some observation in a small test game :
- Choice of vehicle from AI is debatable, in my test, AI thought it s a good idea to use the very slow but high capacity vehicle from HEQS to transport Food. The vehicle loose money and the AI don t seems to care about it (it s sent to depot after loosing money for a moment, only to be replaced with the same vehcile), also it cause jams on the roads. I understand we can t avoid totally those jams with articulated vehicle, but maybe your AI could avoid selecting amongst the slowest vehicles when it intend to travel relatively far (in my game it choosed a slow vehicle to travel over 140 tiles (flight distance, i haven t counted the exact road distance). Imho those kind of vehicle should probably not be used for distance over 40 tiles.
- Road construction from AI, i have been surprised on how the AI build a lot of roads for nothing, doubling existing ones, creating dead ends.... I would say it s not enough reusing existing roads, it tries to be more efficient that way i supose (but fails at it in a few cases). It makes some very ugly road. In this screenie all the doubling of road have been made by AI, and they are all useless. In the down right corner of the screen, it s two Civil AI competing to lay as most road as they can it seems...even though a "not owned road, from the scenario" was already going through there.
If you wanna test and see for yourself how Civil AI is not enough reusing existing roads imho, i ve done my Test in Cindini, wich does already have a relatively dense road network from start.
- Ships, lovely addition, but is full load really a good idea ? i think with cargodist being used full load should be avoided (i imagine nowadays the majority of players uses it)... but at the same time i can understand why full load is a good idea if cargodist is off (avoid that busses let not enough passengers for the ships).
I haven t seen much else wrong for the moment, and i ve been rather impressed by the couple trains lines some of the Civil AI have built, they seemed very reasonable for AI !
Re: CivilAI
Once more about roads: seems that it have problems with connecting to bridges, many times I observed dead ends like in attached picture.
Another issue is, that AI cannot handle with sea shore, if removing of water is blocked (via patch or high base costs),
see left corner - unfinished route. Similar problem with bridges on sloped sea shore, it should start one tile earlier with higher bridge to avoid possible bridge building failure (such bridge also looks better without ships clipping glitches).
Another issue is, that AI cannot handle with sea shore, if removing of water is blocked (via patch or high base costs),
see left corner - unfinished route. Similar problem with bridges on sloped sea shore, it should start one tile earlier with higher bridge to avoid possible bridge building failure (such bridge also looks better without ships clipping glitches).
- Attachments
-
- civilai-b.png (214.42 KiB) Viewed 5843 times
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: CivilAI
Yes, these crawlers seem to be a popular choice among AIs (not only CivilAI), which is why I only enable the core vehicles and trams of HEQS when playing with them.romazoon wrote: - Choice of vehicle from AI is debatable, in my test, AI thought it s a good idea to use the very slow but high capacity vehicle from HEQS to transport Food. The vehicle loose money and the AI don t seems to care about it (it s sent to depot after loosing money for a moment, only to be replaced with the same vehcile), also it cause jams on the roads.
By the way, when playing with DBSetXL, CivilAI chooses two different wagon types for the same train. It's not a big problem since both can load the same amount of wood, I just found it funny and don't know if it is intentional.
- Attachments
-
- DB AIs, 22nd Jan 1962c.png (190.42 KiB) Viewed 17413 times
Re: CivilAI
I'm not sure it's reasonable to expect the AI to cope with arbitrary base cost changes, much less patched versions of OpenTTD. It's a road building AI and will struggle in an environment hostile to road building. That said, I suspect setting buildroad.cost.coast to a high value at line 2191 might help.McZapkie wrote:Another issue is, that AI cannot handle with sea shore, if removing of water is blocked (via patch or high base costs)
I hadn't considered HEQS when testing - I can certainly tweak the vehicle selection code to avoid such wide outliers.romazoon wrote:- Choice of vehicle from AI is debatable, in my test, AI thought it s a good idea to use the very slow but high capacity vehicle from HEQS to transport Food.
Pathfinder values are always a difficult balancing act (and "ugly" is in the eye of the beholder). The AI does do a lot of rechecking connections, and this can result in some duplicated roads. You could try tinkering with buildroad.cost.no_existing_road at line 2168, and see if you can find a value that produces more pleasing results.romazoon wrote:- Road construction from AI, i have been surprised on how the AI build a lot of roads for nothing, doubling existing ones, creating dead ends.... I would say it s not enough reusing existing roads, it tries to be more efficient that way i supose (but fails at it in a few cases). It makes some very ugly road.
Very short ('water-bus' style) ship routes don't use full-load. For the longer routes, they're more analogous to aircraft - they're better off sitting raising the station rating than zooming back and forth empty. Cargodist or not, full-load or not, ships rarely make the AI much money; the ships, and the AI in general, are primarily to create pleasant background movement for human players, rather than to play the game as efficiently as possible itself.romazoon wrote:- Ships, lovely addition, but is full load really a good idea ? i think with cargodist being used full load should be avoided (i imagine nowadays the majority of players uses it)... but at the same time i can understand why full load is a good idea if cargodist is off (avoid that busses let not enough passengers for the ships).
Yes, it's intentional - the AI will build mixed trains (if more than one suitable wagon exists) for piece cargos like wood.vrn wrote:By the way, when playing with DBSetXL, CivilAI chooses two different wagon types for the same train. It's not a big problem since both can load the same amount of wood, I just found it funny and don't know if it is intentional.
Re: CivilAI
I got client crash with following error:
Not sure if it should be report to JGR patch maker, seems that is is AI related?
Code: Select all
Error: Assertion failed at line 281 of ~/JGR/src/ai/ai_core.cpp: c != NULL && c->ai_instance != NULL
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: CivilAI
I don't know, but there's certainly no point reporting it to me.McZapkie wrote:Not sure if it should be report to JGR patch maker, seems that is is AI related?
Re: CivilAI
thanks for the answers
Now i d love to try tinkering a bit with this value, unfortunately i think would not know where to look for this value so i guess i ll just hope someone find pleasant settings and share the customized AI then (or is that value modifiable in game with an AI developer setting turned on ? )
Now my concern about full load and cargodist was more about how it (might ?) mess cargodist links calculation. I m no sure about it, but i always thought (feeling from user experience, so i ll be happily proven wrong) full load cargo would end up making cargodist believe the capacity of line is zero and so in the AI case, that means ships staying for very very long, which indeed they were, but can t say the outcome on the long run as test stoped quite shortly after last report i made. i shall test further and report when i get some time
of course "it s ugly" is as subjective as it can be and that s not a point i should have raised, inneficiency would have been a more proper term i guess...anyway you knew what i meant i think.PikkaBird wrote:Pathfinder values are always a difficult balancing act (and "ugly" is in the eye of the beholder). The AI does do a lot of rechecking connections, and this can result in some duplicated roads. You could try tinkering with buildroad.cost.no_existing_road at line 2168, and see if you can find a value that produces more pleasing results.
Now i d love to try tinkering a bit with this value, unfortunately i think would not know where to look for this value so i guess i ll just hope someone find pleasant settings and share the customized AI then (or is that value modifiable in game with an AI developer setting turned on ? )
i haven t seen the short ship route yet, so it s good to know AI do adapt orders to profile of the route. and indeed ships were not good money maker in my test...but my settings for ships were far from optimal running cost wise too, so wasn t too surprised about thatPikkaBird wrote:Very short ('water-bus' style) ship routes don't use full-load. For the longer routes, they're more analogous to aircraft - they're better off sitting raising the station rating than zooming back and forth empty. Cargodist or not, full-load or not, ships rarely make the AI much money; the ships, and the AI in general, are primarily to create pleasant background movement for human players, rather than to play the game as efficiently as possible itself.
Now my concern about full load and cargodist was more about how it (might ?) mess cargodist links calculation. I m no sure about it, but i always thought (feeling from user experience, so i ll be happily proven wrong) full load cargo would end up making cargodist believe the capacity of line is zero and so in the AI case, that means ships staying for very very long, which indeed they were, but can t say the outcome on the long run as test stoped quite shortly after last report i made. i shall test further and report when i get some time
- andythenorth
- Tycoon
- Posts: 5667
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
FWIW, cargodist does not measure route capacity when assigning cargo to a next hop. So that should not be a problem hereromazoon wrote:full load cargo would end up making cargodist believe the capacity of line is zero
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: CivilAI
Okay, Version 16:
- Intercity road connections are now built via a middle point, to make connecting cities faster and more reliable.
- Tweaks to the road pathfinder values to (possibly) reduce route duplication and messy road junctions.
- AI will not build trucks with top speed below 40km/h if faster vehicles are available (to avoid building HEQS crawlers).
Now up on Bananae.
- Intercity road connections are now built via a middle point, to make connecting cities faster and more reliable.
- Tweaks to the road pathfinder values to (possibly) reduce route duplication and messy road junctions.
- AI will not build trucks with top speed below 40km/h if faster vehicles are available (to avoid building HEQS crawlers).
Now up on Bananae.
Re: CivilAI
Version 17, just a couple of minor bug fixes.
- do not include mail, goods and food trucks in towncar count (Apparently I haven't tested town cars since version 6!)
- fixed the AI not building airports when noise level feature is disabled.
- do not include mail, goods and food trucks in towncar count (Apparently I haven't tested town cars since version 6!)
- fixed the AI not building airports when noise level feature is disabled.
Re: CivilAI
Could you add a setting to disable Aircrafts and Airports completely?
Re: CivilAI
There's a game setting to disable aircraft for AI. Is there some value to being able to turn them on and off on a per-AI basis, do you think?
Re: CivilAI
Version 19 is now on Bananas. This is a major update and requires OpenTTD 1.9.0 or later.
Unfortunately, passenger trains didn't quite make it in - they'll be in v20.
Changelog:
Version 19:
- Minimum OpenTTD version is now 1.9.
- This update has extensive rewrites of a lot of existing code. Please do report any odd behaviour or crashes.
Features:
- Added 2cc company colours, and different colours for different vehicle types.
- AI has a configurable option to not build an intercity road network, but just to build within towns in its radius.
Tweaks:
General:
- Reworked selection code for vehicles and added company biases towards big, cheap, or fast vehicles, to add some variety between companies and games.
- Reworked the freight train route selection code, for performance and extendability.
Aircraft:
- AI has alternative behaviour to build airports if road vehicles are disallowed.
- AI will build an initial aircraft as soon as it has two airports.
- AI will attempt to replace small airports with commuter airports (attached to a different station in the same town) after commuter airports become available.
- Increased the maximum number of aircraft servicing each small and commuter airport (from 3 and 6 to 5 and 10 respectively).
Ships:
- AI will now build only two ship docks per town.
- AI will not build ferries with a capacity less than 50 if larger ferries exist (to avoid building FISH/Squid trawlers).
Road Vehicles:
- Increased the maximum maximum bus count from 500 to 5000, as requested by Samu on IRC (the default maximum remains 250).
- AI will now build only two mail truck stops per town.
- AI will wait 10 years before trying to build a bus network in a town it previously failed to build enough stops in.
Bug fixes:
- fixed the AI sometimes failing to build goods trucks (because it was trying to build them in another company's depot, whoops).
Version 18:
- There is no version 18 - version number bumped to 19 to coincide with OpenTTD 1.9.
Unfortunately, passenger trains didn't quite make it in - they'll be in v20.
Changelog:
Version 19:
- Minimum OpenTTD version is now 1.9.
- This update has extensive rewrites of a lot of existing code. Please do report any odd behaviour or crashes.
Features:
- Added 2cc company colours, and different colours for different vehicle types.
- AI has a configurable option to not build an intercity road network, but just to build within towns in its radius.
Tweaks:
General:
- Reworked selection code for vehicles and added company biases towards big, cheap, or fast vehicles, to add some variety between companies and games.
- Reworked the freight train route selection code, for performance and extendability.
Aircraft:
- AI has alternative behaviour to build airports if road vehicles are disallowed.
- AI will build an initial aircraft as soon as it has two airports.
- AI will attempt to replace small airports with commuter airports (attached to a different station in the same town) after commuter airports become available.
- Increased the maximum number of aircraft servicing each small and commuter airport (from 3 and 6 to 5 and 10 respectively).
Ships:
- AI will now build only two ship docks per town.
- AI will not build ferries with a capacity less than 50 if larger ferries exist (to avoid building FISH/Squid trawlers).
Road Vehicles:
- Increased the maximum maximum bus count from 500 to 5000, as requested by Samu on IRC (the default maximum remains 250).
- AI will now build only two mail truck stops per town.
- AI will wait 10 years before trying to build a bus network in a town it previously failed to build enough stops in.
Bug fixes:
- fixed the AI sometimes failing to build goods trucks (because it was trying to build them in another company's depot, whoops).
Version 18:
- There is no version 18 - version number bumped to 19 to coincide with OpenTTD 1.9.
Re: CivilAI
In my test games with infrastructure maintenance turned on (running costs on medium; no NewGRFs), CivilAI only ever built a single airport but its income wasn't high enough to cover the maintenance cost of even that one, so it kept going bankrupt.PikkaBird wrote: AI will build an initial aircraft as soon as it has two airports.
Is it possible to check whether infrastructure maintenance is turned on - or perhaps even check what the actual current maintenance cost of an airport is - and postpone building any airports until it can afford it?
Re: CivilAI
I've generally been avoiding adding setting tests - there's just too many variations. This one seems to be a common enough cause of bankrupcy that I suppose I can make the exception.
Edit: done, will be in v20.
Edit: done, will be in v20.
Re: CivilAI
Could you add a feature that the AI would add a Busstop in Villages when a IC bus would drive through it without stopping?
Who is online
Users browsing this forum: No registered users and 3 guests