Ai assistant?
Moderator: OpenTTD Developers
Ai assistant?
Would it be possible to program an AI that works on your team?
For example, I want to build buses, trains, and planes, then let my AI assistant route them and set them up efficiently as I move on to the next inferstructure design.
Is this possible?
For example, I want to build buses, trains, and planes, then let my AI assistant route them and set them up efficiently as I move on to the next inferstructure design.
Is this possible?
Re: Ai assistant?
In single player that would be possible without any modifications to OpenTTD. At the beginning of the game, use cheats to switch to the same company as your AI and then you build your stuf and place a sign to communicate with your AI.
In multiplayer that is not possible as you can't cheat in multiplayer.
In multiplayer that is not possible as you can't cheat in multiplayer.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Ai assistant?
If infrastructure sharing and perhaps cargodist ever hit trunk, something might be possible: an AI managed subsidiary of your company that manages inner city road transport, while you focus on inter-city rail and air transport. If the AI sees one of your railway station with an attached bus stop that doesn´t actually have buses serving it, it might proceed to build and manage bus routes from that station for you. That might really save you some work.
If you could hand vehicles or infrastructure to other companies you might even hand over a train, and the AI will manage, it: clone or upgrade it, if it sees the need. Things can get complex there though: what if you want to add an extra station to a route? There would have to be a way to retake control of the vehicle.
If you could hand vehicles or infrastructure to other companies you might even hand over a train, and the AI will manage, it: clone or upgrade it, if it sees the need. Things can get complex there though: what if you want to add an extra station to a route? There would have to be a way to retake control of the vehicle.
Re: Ai assistant?
Can you point me to a place where I can learn about "place a sign to communicate with your AI". Thanks.Zuu wrote:In single player that would be possible without any modifications to OpenTTD. At the beginning of the game, use cheats to switch to the same company as your AI and then you build your stuf and place a sign to communicate with your AI.
In multiplayer that is not possible as you can't cheat in multiplayer.
Re: Ai assistant?
You understand my request very well. I'd imgien there would be more than one AI in your compnay. Serveal programmed just for routine actions that are trival in sandbox. For example, I forsee an advisor for each mode of transportation.el koeno wrote:If infrastructure sharing and perhaps cargodist ever hit trunk, something might be possible: an AI managed subsidiary of your company that manages inner city road transport, while you focus on inter-city rail and air transport. If the AI sees one of your railway station with an attached bus stop that doesn´t actually have buses serving it, it might proceed to build and manage bus routes from that station for you. That might really save you some work.
If you could hand vehicles or infrastructure to other companies you might even hand over a train, and the AI will manage, it: clone or upgrade it, if it sees the need. Things can get complex there though: what if you want to add an extra station to a route? There would have to be a way to retake control of the vehicle.
If I build some bus stations and setup some routes, the road advisor would balance them every so often, make upgrades to the buses if new vehicles come out (like the auto-update), retime and perhaps elimate buses because of that. In general I'd like to build a structure and move on to the next project and not ever think of the buses again (unless something major needs to be done). I'm mixed on if the AI should auto add new bus stations in (and probably shouldn't because I think that could be abused).
The same for airports, the advisor would reallocate flight times, perhaps destinations to make the route structure work as the cities grow.
Re: Ai assistant?
If existing AI could be used to assist you, this is not their purpose. Assisting a player is sometimes easier and sometimes harder. It is easier as you can let the player choose the global strategy and do only easy things that can obviously enhance profits. It is harder as you have to handle everything the player can do.
If someone wanted to write an assisting AI, he wouldn't probably do the same as if wanted to write a complete AI.
If someone wanted to write an assisting AI, he wouldn't probably do the same as if wanted to write a complete AI.
Re: Ai assistant?
Having read just the basics of making an AI, and not knowing OoP at all I am hard pressed to say if it would be easier or harder, but I do agree that it would be different in some ways. Probably the easist way to explain it would be that the scope would be much smaller.Blustuff wrote:If someone wanted to write an assisting AI, he wouldn't probably do the same as if wanted to write a complete AI.
Take PAXLink for example, it is designed (or was) with no brain at all. remove any of the desire to expand and just manage what exisits and you would have a good assistant.
You could have different levels of thought behind the AI, and unlock more advanced procedures as you the company expand and meet certian scores or goals. Like the how the trading AI works in X.
If you are limited to one AI by internal mechaniusm, you would need one Ai with many faces or facets that still is limited in scope.
In this case, I can dream up how I think such a system should work, but am powerless to implement it. Which is why I would like to know if there was anything from preventing it from working before I attmepted to make a simple Bus manager.
Re: Ai assistant?
No, AI can do the same things as player (except timetables), so you can write ai managing routes constructed by player - just like normal ai but without building functions.
For beginning you can prepare ai replacing crashed vehicles.
For beginning you can prepare ai replacing crashed vehicles.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: Ai assistant?
intereting, that would be helpful.the thing with that though is, wouldn't the Ai have to check often because don't crashed objects get removed from game after some time?Kogut wrote:No, AI can do the same things as player (except timetables), so you can write ai managing routes constructed by player - just like normal ai but without building functions.
For beginning you can prepare ai replacing crashed vehicles.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Ai assistant?
It would just have to respond to the crash message which it gets similar as a player gets it. Modern AI use that already to some degree in order to detect mean players trying to run over their trucks by evilly placed rails.ThunderAI wrote: intereting, that would be helpful.the thing with that though is, wouldn't the Ai have to check often because don't crashed objects get removed from game after some time?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Ai assistant?
Could the AI replace the vehicles and then send a message to the "client" saying it did it, and where the crash occured?planetmaker wrote:It would just have to respond to the crash message which it gets similar as a player gets it. Modern AI use that already to some degree in order to detect mean players trying to run over their trucks by evilly placed rails.ThunderAI wrote: intereting, that would be helpful.the thing with that though is, wouldn't the Ai have to check often because don't crashed objects get removed from game after some time?
I aske because if the player in on the computers team would the player even get those messages?
Re: Ai assistant?
AI can place sign or print output to ai debug console.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: Ai assistant?
Well, I thought some time ago about patch that would allow to run some asistive AI under your company (thus both you and the AI will be in control), but I never got to any working implementation.
Few thoughts:
- you need some way to comunicate with AI (like tell it to build rail from X to Y), so you need code in the AI to export some function as callbacks (build_rail(tile,tile), build_road(tile,tile) along with description of the function and its parameters), then some GUI that will let you pick between these functions (You have selected "build railway segment". Pick starting and ending tile) and invoke them. Then you need to slightly modify the base AI code so it will be able to run "as you". This should then work even in multiplayer, probably....
- the AI API have some limitations, for example AI can't "see" opponents vehicles, stations, etc ... thus AI's does not have all the powers the humans have, though it is quite close
- It may somewhat spoil the game if you take the assistive powers too far, though there are already some patches designed to help you do the tedious stuff faster (my console commands patch, copy&paste patch, ...) - there are some complaints from few people that they make the game too easy, but more people are happy with these extra functions and use them :)
Few thoughts:
- you need some way to comunicate with AI (like tell it to build rail from X to Y), so you need code in the AI to export some function as callbacks (build_rail(tile,tile), build_road(tile,tile) along with description of the function and its parameters), then some GUI that will let you pick between these functions (You have selected "build railway segment". Pick starting and ending tile) and invoke them. Then you need to slightly modify the base AI code so it will be able to run "as you". This should then work even in multiplayer, probably....
- the AI API have some limitations, for example AI can't "see" opponents vehicles, stations, etc ... thus AI's does not have all the powers the humans have, though it is quite close
- It may somewhat spoil the game if you take the assistive powers too far, though there are already some patches designed to help you do the tedious stuff faster (my console commands patch, copy&paste patch, ...) - there are some complaints from few people that they make the game too easy, but more people are happy with these extra functions and use them :)
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: Ai assistant?
Using an AISignList, an AI can get a list of all signs that it has. It will only see it's own signs, no other signs. That is why you need to use cheats to play as the same company as the AI. When you and the AI is at the same company, the AI can from time to time go through all signs it has and see if any of them contain a pre-defined message. On the same way the AI can place signs eg. near the HQ for the player to read.ThunderAI wrote:Can you point me to a place where I can learn about "place a sign to communicate with your AI". Thanks.Zuu wrote:In single player that would be possible without any modifications to OpenTTD. At the beginning of the game, use cheats to switch to the same company as your AI and then you build your stuf and place a sign to communicate with your AI.
In multiplayer that is not possible as you can't cheat in multiplayer.
If you don't want to miss any messages you could make the AI prefix all signs with an unusual character that you search for using my sign list patch. Another option is to make use of the AIDebug window and make it pause the game when an important message comes up.
If you want to see some code, checkout my Helper::BreakPoint, Helper::HasSign and Helper::SetSign functions in SuperLib: http://noai.openttd.org/svn/lib-super/helper.nut
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Ai assistant?
I have played as the same company as my AI a lot. However, I am usually the helper to the AI and not the other way round. 
I think a helper AI could be a very neat project and fun to play with. I would love a function that would build double two way tracks between signs and signal them, for example. It would also be really nice to have an AI helper that would build a little something-something for every town early on to keep them all happy.
-D

I think a helper AI could be a very neat project and fun to play with. I would love a function that would build double two way tracks between signs and signal them, for example. It would also be really nice to have an AI helper that would build a little something-something for every town early on to keep them all happy.
-D
Who is online
Users browsing this forum: No registered users and 9 guests