Aiai Caramba v0.9

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2848
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Aiai Caramba v0.9

Post by ChillCore »

Hello all,
this is my first attempt at making an AI.
It is a side project for me so progress might be slow.

I have made it to build roads for me while I concentrate on rails and to learn a bit more on squirrel.
Also it gives me an extra challenge to lay my tracks if/when roads are already in place.
The AI does not build depots, stations or vehicles allowing me to create scenarios with pre-build track without much effort. See: http://www.tt-forums.net/viewtopic.php?f=60&t=47363 for an example.

Some more on its design:
The AI is designed to build random roads and yap.
Pathfinder penalties are tuned to reuse roads as much as possible.
More than one instance can be used at the same time, this is because locations to connect are chosen randomly.
Money is not generated, it goes bankrupt when there is no more money left and starts over. This is a choice of design and will not be changed.
If you are lucky it will restore the bridges and tunels after reboot but most of the times it will find a cheaper route because roads that are allready in place from the previous "life" do not have to be rebuild.

Features to come
None.
It does what I want it to do.

Things to do for v1.0
Fine tune pathfinder penalties for all three pathfinder branches.
Optimise the code without changing functionality.
Expand the yapping in a more random way. The "hint of the day" given is not as random as it should be.
Sometimes invalid places are returned to connect or to yap about. In case of building road the pathfinder will fail and continue with the next round. I will solve this by adding some additional checks.

ps: I hope the tar is valid, it is made using 7z.
Attachments
Aiai_Caramba.png
Aiai_Caramba.png (22.3 KiB) Viewed 2583 times
Aiai_Caramba_v0.9.tar
Pathfinder.Road 3 available from the ingame online content is required.
(50 KiB) Downloaded 115 times
Last edited by ChillCore on 04 Nov 2010 11:02, edited 2 times in total.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Aiai Caramba v0.9

Post by Kogut »

Welcome!
It is one of the weirdest ais :P
Maybe you can forbid building bridges to protect from ugly gaps?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2848
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Aiai Caramba v0.9

Post by ChillCore »

Welcome!
It is one of the weirdest ais :P
Thank you and thank you. :)
Maybe you can forbid building bridges to protect from ugly gaps?
I like the bridges and tunnels, it makes the roads so much nicer looking. Not the gaps after bankruptcy mind you.
Sometimes I buy out the company before it is restarted so I get to keep them. When creating a scenario with pre-build roads that is the way I do it.
When I get the grasp of using the ingame config settings I might introduce a switch for doing so and leave the bridge building and tunneling to the player. Or better if player does want to have bridges an tunnels, let him/her decide on their length.
Thank you for the idea.


I need also to take a look on the pathfinding as sometimes it tries to connect to a sloped road tile.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

Re: Aiai Caramba v0.9

Post by Dwight_K._Schrute »

As I find this very interesting I write here instead of your patchpack-thread...

I've tried to play a game with them... but no roads were built... what am I doing wrong??
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2848
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Aiai Caramba v0.9

Post by ChillCore »

It is hard telling without information ...

Just a wild guess, it is slower because of rough terrain in combination with a bigger map and you are not waiting long enogh for the road(s) to be constructed.
To see the speed difference as mapsize/rougness increases try a very flat and small map. You will see that roads are created rather rapidly.

Also you might miss the "Pathfinder.road 3" library available form the online content.
I need to update the first post as I forgot to mention the dependancy.

Can I see a screenshot of the AI debug window please if none of two possible causes above is the source of your problem.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
User avatar
Dwight_K._Schrute
Traffic Manager
Traffic Manager
Posts: 209
Joined: 01 Sep 2010 11:29

Re: Aiai Caramba v0.9

Post by Dwight_K._Schrute »

ChillCore wrote:It is hard telling without information ...

Just a wild guess, it is slower because of rough terrain in combination with a bigger map and you are not waiting long enogh for the road(s) to be constructed.
To see the speed difference as mapsize/rougness increases try a very flat and small map. You will see that roads are created rather rapidly.

Also you might miss the "Pathfinder.road 3" library available form the online content.
I need to update the first post as I forgot to mention the dependancy.

Can I see a screenshot of the AI debug window please if none of two possible causes above is the source of your problem.
Ok it works. So I've been just on the edge...

But is it normal that it takes years till something happens?
Unbenannt, 15. Dez 1955.png
(61.95 KiB) Downloaded 2 times
This is after 6 years on a 256x256 map and 14 AIs...
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2848
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Aiai Caramba v0.9

Post by ChillCore »

With forteen AI instances ... yes thing might go a bit slower as they have to devide processor time between them. (That is what the opcodes are for in advanced settings.)

Your screenshot is missings some info.
1. Terrain type and smoothess settings. The rougher and higher the height difference is between 'here' and 'there' the longer it will take.
2. The ai_debug window as that will tell me how far apart the tiles are it is trying to connect. Anything further away than 150 tiles might take a bit longer.
Attachments
Farfingford Transport, 2151-03-31.png
Farfingford Transport, 2151-03-31.png (38.97 KiB) Viewed 2242 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 7 guests