My goal here is play on the same team as my kids with my AI assistant so I don't have to establish routes constantly.
I thought I could save a game in single-player and load it in multi-player, but that doesn't seem to work. The player is always company #1 after load. Not saving the player's company # in single-player is a pain for debugging since I have to manually switch it back every load.
Is the only option to start building my own personal OpenTTD binary? I'm hoping to avoid that job.
It seems better to have an official method of flagging the use of script assistance multi-player games if players want to avoid them instead of having players compiling their own binaries.
Add AI to player company
Moderator: OpenTTD Developers
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Add AI to player company
cheat yourself into the AI's company.
On grounds of fairness between different players, players and AIs in the same company won't be supported differently than by the cheat method.
On grounds of fairness between different players, players and AIs in the same company won't be supported differently than by the cheat method.
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: Add AI to player company
Why not implement your AI as a GS? Then you don't need to cheat, be playing on the same company or have the empty Player 1 company after you switch AFAIK this will work seamlessly in MP too.
Re: Add AI to player company
Ah... Thanks! I didn't realize the GS system existed with the same functionality as the AI.
I've tried the cheat method but it doesn't seem to work in multi-player for me.
Is a gamescript able to call an AI library or do I have to sacrifice that to make multiplayer with the kids a reality? Originally I was planning on making my AI available as a library so I could experiment with a more traditional AI without breaking the routing component.
All of the functions I use for the AI seem present in the GS namespace. Maybe I can get away with a macro rename between AI* and GS*...
I've tried the cheat method but it doesn't seem to work in multi-player for me.
Is a gamescript able to call an AI library or do I have to sacrifice that to make multiplayer with the kids a reality? Originally I was planning on making my AI available as a library so I could experiment with a more traditional AI without breaking the routing component.
All of the functions I use for the AI seem present in the GS namespace. Maybe I can get away with a macro rename between AI* and GS*...
Re: Add AI to player company
A subset of the AI API is available in the GS API, which in turn got some APIs not in the AI API. However, if all you need is available in the GS API then you are set.Xycor wrote:All of the functions I use for the AI seem present in the GS namespace. Maybe I can get away with a macro rename between AI* and GS*...
An important difference is that GS doesn't automatically execute commands for a specific company. Instead you have to control this by creating a GSCompanyMode class instance. For the time that this instance is in scope/alive, API calls that you make will be executed as the company given in the GSCompanyMode constructor. It is worth to note that some GS APIs will not work when there is a GSCompanyMode in scope. So while a first idea may be to just stick a GSCompanyMode(0) to always be in scope, it is more flexible to create the company mode instance near the API calls so that you don't cut away the ability to for example display a news message with some text.
Read here for more info about developing your own Game Script:
http://wiki.openttd.org/Game_script#Wri ... ame_script
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Add AI to player company
Bummer... looks like the GS system won't work for me because it cannot alter the orders of the vehicles.
GS is also missing a GSGroup namespace, but that I could workaround
So I guess I am back to modifying the source?
GS is also missing a GSGroup namespace, but that I could workaround
So I guess I am back to modifying the source?
Who is online
Users browsing this forum: Semrush [Bot] and 22 guests