Page 1 of 1
Posted: 01 Feb 2018 20:19
Some of you may remember my previous attempt at an AI, CPU. Creating if was a fun experience, but the result was super buggy and didn't generate much profit, and generally did a lot of stupid stuff. Since then, I have learned a lot about programming in general, and decided to give it another try. Thus, I present to you snakeAI.
- 150,000 revenue in 3 years, 200,000 in 4, profit after 9 years
- Works with most non-insane new-grf's (tested with several vehicle and industry sets)
- Road vehicle only for now, usually reaches the limit after a couple of years
- Only builds short-distance routes
- Dynamically increases vehicle count when vehicles can't handle the supply
- Vehicles get interesting names
There are probably still plenty of bugs, and I have a few features I still think I may be able to finish before my holiday ends. Please send me all your crashes, bugs, and general strange behavior. There might be some I can fix.
Posted: 04 Feb 2018 00:02
It's always good to see a new AI appearing.
However you might think about putting your AI online on bananas. Most people are too lazy to manually install an AI (including me). I think it will increase the chance of getting feedback. Good luck!
Posted: 14 Feb 2018 08:53
New version uploaded to bananas.
- The automatic road vehicle duplication system has been tweaked to not overproduce RV's
- Now secondary industries are also serviced. This allows profit when using YETI where primary industries hardly earn anything.
- The AI attempts to expand stations when too many vehicles are using them, to prevent traffic jams.
Posted: 14 Feb 2018 15:01
crash report, Snake v2
Posted: 15 Feb 2018 19:02
Thanks Xarick, should be fixed now. Other changes include slightly better loan management and some bug fixing in the station expanding routine.
Even though this AI is quite simple, there are still some code paths that are super annoying to debug since they are taken so rarely. Sometimes while testing it runs fine for 20 years before some feature I implemented a long time ago starts behaving weird.
Posted: 17 Feb 2018 15:30
- Expanding station works better
- Slightly changed naming scheme for vehicles
- Deals properly with new construction getting in the way of old routes
- Destroys depots that get in the way of expanding stations
Posted: 26 Feb 2018 14:32
New version, the most significant new feature is planes. Planes are built to form a network, where every airport should have connections to as many as possible different airports as it can handle. Snake can also upgrade airports and airplanes, though it rather often doesn't work for some unknown reason (ERR_UNKNOWN is so fun to debug).
- Fixed bug where building a new station would sometimes infinite loop
- RV's are also upgraded
- Delete one RV when a 3 or more RV's are waiting for full load at a empty station, to avoid all vehicles from a station being sold for negative profit at the same time when it is actually still producing cargo
- Introduced bug where Snake will continue to try and build routes after the vehicle limit has been passed
- Actually use vehicle cost to estimate vehicle cost instead of the randomly chosen 10,000 pounds
- Slightly more efficient loan management during pathfinding
- Better station naming scheme
- Introduced many more bugs I have not found yet
Posted: 26 Feb 2018 16:56
I recently took SnakeAI v4 for my road ai competition tests. It did well, here's the topic:
Once I get the chance, I'll try the newer version.
Posted: 28 Feb 2018 09:16
SnakeAI v4. The AI appears to be stuck for 2 years already. Can't finish building the route.
Code: Select all
dbg: [script]  [I] 85
dbg: [script]  [I] cloned vehicle LVST Funni Farm to Dintb Facto 15
dbg: [script]  [I] fixing unbuilt road (ERR_VEHICLE_IN_THE_WAY)
dbg: [script]  [I] #v 1404 max: 2500
dbg: [script]  [I] no build location
dbg: [script]  [I] Industry failed: Shorbourne Factory(GOOD)
dbg: [script]  [I] Industry failed: Fudtown Farm(GRAI)
dbg: [script]  [I] Industry failed: Fudtown Farm(LVST)
dbg: [script]  [I] Industry failed: Frafingway-on-sea Factory(GOOD)
dbg: [script]  [I] from Fort Pendhattan Ridge Farm to Fort Pendhattan Ridge Factory
dbg: [script]  [I] Pathfinding...
dbg: [script]  [I] Completed, building route
EDIT: My bad, this is SnakeAI v4, not v5, sorry.
Posted: 28 Feb 2018 17:17
New version, contains mostly fixess:
- Fixed multiple crashes related to upgrading airports
- Snake does a better estimation of the number of vehicles initially needed, instead of just building 4
- Turned out my system to delete vehicles with negative income broke at some point, but it's fixed now
- Fixed strange behavior when close to the vehicle limit
- Made airport blacklists clear every five years, so it can retry when new airports become available.
While I think I allready have a bit many high-res images for a thread, I have a really nice screenshot of testing the limits of my AI by putting 190+ busses on a short intercity route. Snake sold most of them after about 1.5 years, except some actually magically managed to make a profit:
@xairick Thanks for the report. That is indeed probably a bug, and I'll look into it.
Posted: 07 Mar 2018 20:09
Version 7, only minor changes:
- Fixed bug where attempting to build a plane on a heliport would cause a infinite loop due to no depot being found
- Made it so Snake prefers connecting industries that are already serviced by itself even if the distance is greater, this increases profit under FIRS and similar sets
- Now includes a margin before building a new route so upgrading vehicles has priority
Posted: 12 Mar 2018 10:37
Version 8. Turned out my vehicle upgrade system has become horribly broken at some point, resulting in lots of way too old vehicles running around, as well as lots of vehicles without orders. Fixed now.
Posted: 20 Jun 2018 11:33
Version 9. Will now (attempt to) delete level crossings after a train crash. In case of a crash, the AI will first:
- Replace the vehicle
- Send all vehicles with shared orders to the depot
- Wait at least 50 time units, then 10 more until the level crossing can be removed
- Recursively remove all dead ends owned by Snake in a 10 by 10 area around the crash site
- re-pathfind the route of the crashed vehicle
- Start all vehicles on the route again.
Fixed this after noticing Snake was spending excessive amounts of money replacing vehicles on busy level crossings. The system does not currently always work. When multiple lines are using the same level-crossing, only one is replaced. It also does not detect whether the crossing is owned by a other company, (I believe there is no API function for this) and will attempt to destroy it anyway.
Posted: 29 Sep 2018 14:23
excessive cpu valuator crash, openttd 1.8.0
Posted: 21 Sep 2019 15:26
Your AI performed great in the first years when starting up. See e.g. the grey line in the image I posted
in the EmotionAI topic.
However as soon as SnakeAI reaches the vehicle limits you see many ERR_VEHICLE_TOO_MANY. It should try to improve its best routes in that case and get rid of under performing ones.
It probably also is a good idea to add a setting that defaults to off to allow building debug signs.
Posted: 29 Nov 2019 15:10
Version 10 uploaded: Small update to fix valuator crash and helicopters failing to land on helidepots