Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Sep 24, 2018 10:32 am

All times are UTC




Post new topic  Reply to topic  [ 13 posts ] 
Author Message
 Post subject: SnakeAI
PostPosted: Thu Feb 01, 2018 8:19 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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.
Image
Some features:
  • 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.


Attachments:
screenshot.png [2.39 MiB]
Not downloaded yet
SnakeAI.tar [81 KiB]
Downloaded 58 times

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Sun Feb 04, 2018 12:02 am 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 86
Location: Netherlands
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!


Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Feb 14, 2018 8:53 am 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
New version uploaded to bananas.
New features:
  • 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.
Image


Attachments:
screenshot2.png [4.19 MiB]
Not downloaded yet

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Feb 14, 2018 3:01 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 218
crash report, Snake v2


Attachments:
Transport city, 1955-09-01.sav [241.83 KiB]
Downloaded 17 times
screenshot#2.png [242.64 KiB]
Not downloaded yet

_________________
Formerly known as Samu
Top
   
 Post subject: Re: SnakeAI
PostPosted: Thu Feb 15, 2018 7:02 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
Thanks Xarick, should be fixed now. Other changes include slightly better loan management and some bug fixing in the station expanding routine.
Image
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.


Attachments:
screenshot3.png [2.35 MiB]
Not downloaded yet

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Sat Feb 17, 2018 3:30 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
Updated version:
  • 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
Image


Attachments:
Brown & Co., Jul 17th, 1954.png [605.17 KiB]
Not downloaded yet

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Mon Feb 26, 2018 2:32 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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).
Image
Other changes:
  • 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


Attachments:
screenshot4.png [1.07 MiB]
Not downloaded yet

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Mon Feb 26, 2018 4:56 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 218
I recently took SnakeAI v4 for my road ai competition tests. It did well, here's the topic:

viewtopic.php?p=1171159#p1171159

Once I get the chance, I'll try the newer version.

_________________
Formerly known as Samu


Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Feb 28, 2018 9:16 am 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 218
SnakeAI v4. The AI appears to be stuck for 2 years already. Can't finish building the route.

Code:
dbg: [script] [0] [I] 85
dbg: [script] [0] [I] cloned vehicle LVST Funni Farm to Dintb Facto 15
dbg: [script] [0] [I] fixing unbuilt road (ERR_VEHICLE_IN_THE_WAY)
dbg: [script] [0] [I] #v 1404 max: 2500
dbg: [script] [0] [I] no build location
dbg: [script] [0] [I] Industry failed: Shorbourne Factory(GOOD)
dbg: [script] [0] [I] Industry failed: Fudtown Farm(GRAI)
dbg: [script] [0] [I] Industry failed: Fudtown Farm(LVST)
dbg: [script] [0] [I] Industry failed: Frafingway-on-sea Factory(GOOD)
dbg: [script] [0] [I] from Fort Pendhattan Ridge Farm to Fort Pendhattan Ridge Factory
dbg: [script] [0] [I] Pathfinding...
dbg: [script] [0] [I] Completed, building route


EDIT: My bad, this is SnakeAI v4, not v5, sorry.


Attachments:
Snake, 1st May 1960.sav [1.95 MiB]
Downloaded 20 times
screenshot#80.png [291.27 KiB]
Not downloaded yet

_________________
Formerly known as Samu
Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Feb 28, 2018 5:17 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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:
Image
@xairick Thanks for the report. That is indeed probably a bug, and I'll look into it.


Attachments:
Snake, Jan 21st, 1951.png [828.65 KiB]
Not downloaded yet

_________________
my AI: CPU, SnakeAI
Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Mar 07, 2018 8:09 pm 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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

_________________
my AI: CPU, SnakeAI


Top
   
 Post subject: Re: SnakeAI
PostPosted: Mon Mar 12, 2018 10:37 am 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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.

_________________
my AI: CPU, SnakeAI


Top
   
 Post subject: Re: SnakeAI
PostPosted: Wed Jun 20, 2018 11:33 am 
Offline
Engineer
Engineer

Joined: Sat Mar 22, 2014 8:45 am
Posts: 13
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.

_________________
my AI: CPU, SnakeAI


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.