Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sun Dec 16, 2018 12:20 am

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
 Post subject: gelignAIte
PostPosted: Thu Dec 16, 2010 12:08 pm 
Offline
Engineer
Engineer

Joined: Mon Dec 13, 2010 11:48 pm
Posts: 5
Hi everybody,

this - gelignAIte - is both my try to write an AI and to get familiar with Squirrel. I didn't take that much care of highly performed source code (so you may find things which might be done more efficient) but just wrote the AI I had imagined - a small AI that tinkers around on the map while not really competing with me so I'll win even on difficult level. :P

Description:
Small, simple and non-competitive AI, that will build 1 passenger-service (2 buses) and 1 mail-service (4 trucks). The passenger-service is constructed in the biggest town on the map right after starting the AI. The mail-service will be build only if the following preconditions are fulfilled:
- Loan is less or equal than 20 % of maximum loan and
- the town to build the service in (the biggest town on the map at that point of time) has >= 9k inhabitants

Features are:
- Updating stations (moving outwards (from town center) in dependency of count of inhabitants) every five years after inauguration to a max distance of 16 tiles
- Renew aged vehicles
- Replace crashed/lost vehicles
- Replace/Upgrade vehicles by newer models/engines
- Funds managing: Take loan where required, repay where possible.

Download:
It is available via http://bananas.openttd.org/en/ai/.

Known issues:
- I didn't yet figure why but it may occur that the AI crashes on loading. I encountered that a few times but couldn't reproduce it. If someone encounters it and knows what's going on, I'd be pleased to hear from you.

Have fun with it.
geli


P.S.
Note(s):
I wrote the AI on a default installation and tested it only on that "default", "snow" and "desert" type of map. (What is the correct naming of those?) The AI shouldn't work on the "toyland" type as there seems to be no "PASS"enger service available. I didn't play that to verify because I don't like that type. As I have a default installation I couldn't test whether there are problems with other GRFs. Let me know if there's something wrong and I'll see what I can do.


Last edited by gelignite on Thu Dec 16, 2010 9:50 pm, edited 3 times in total.

Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 12:21 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 888
Welcome to the forums! :)
I tried your AI, but it doesn't build any buses, only the stations if a tram set is present. Make sure you exclude trams when you choose the correct vehicle.


Attachments:
Unnamed, 12th Apr 1951.png [172.09 KiB]
Downloaded 2 times
Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 12:57 pm 
Offline
Engineer
Engineer

Joined: Mon Dec 13, 2010 11:48 pm
Posts: 5
Thanks for the info. I didn't use any different sets so i didn't encounter that phenomenon. :?

Before asking thousands of questions now I think it would be best and easiest I install a tram set. The problem is, I don't know what I have to install. Is it a certain scenario or a special NewGRF i need to have trams?


Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 1:08 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
nice!

1 recommendation: upgrade to 1.0 API, the 0.7 API is now getting a little dated :wink:

_________________
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra


Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 1:59 pm 
Offline
Engineer
Engineer

Joined: Mon Dec 13, 2010 11:48 pm
Posts: 5
Lord Aro wrote:
nice!

1 recommendation: upgrade to 1.0 API, the 0.7 API is now getting a little dated :wink:


Thank you. I'm not sure I understand that correctly. I've now added GetAPIVersion() to info.nut that will return "1.0". Is this what you meant? Or is there something else you noticed that I still miss?

While I've written the AI I'd always looked at 1.0.4 and 1.0.5 API docs, so I thought I'm using the 1.0 API already - though I started with an old tutorial. (I'll update it on BaNaNaS as soon as I've an idea how to solve the tram issue.)


Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 3:36 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
In the main menu, go to online content and download for example the generic tram set. Now open the newgrf settings, click "add", select the grf you've just downloaded. After doing that start a new game and you'll have trams.


Top
   
 Post subject: Re: gelignAIte
PostPosted: Thu Dec 16, 2010 9:35 pm 
Offline
Engineer
Engineer

Joined: Mon Dec 13, 2010 11:48 pm
Posts: 5
Heh, the trams look funny. :)
Well, should be working now. A new version is online. Thank you all for your feedback.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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.