You are looking for the features implemented at the close airports and the upgrade airports patches. I don't think that you can imitate that behaviour using only AI code, though.Marbs wrote:To destroy an airport there have to be no helicopters at it, so Chopper would either have to send the helicopters to another depot to get them out the way, or sell the helicopters. It would be useful to have some kind of "close airport" option to make helicopters simply circle above until the airport is reopened. The airport could then be demolished and replaced, however there is a small chance this could fail (someone else building in the way really fast or building an airport nearby that raises the noise level). If it failed Chopper might have lost a valuable spot.
Moderator: OpenTTD Developers
In my PAXLink AI I will need to solve how to make the AI not trying to set up a connection with a special storage airport. You might have the same problem.
However, this has brought to attention one possible problem I did not forsee. The catchment area is now much smaller. If airports only took one cargo, it would be a simple matter of scanning through the tiles to find the best place to place the new airport, but unfortunately some airports will be used for multiple cargos, freight, mail, passengers etc. For example, if the station being replaced is between a coal mine and a town, the new station with a smaller catchment might only be in the coal mine catchment afterwards, and thus any passenger helicopters going to that station will not be able to load or unload.
Currently this just means over the course of the next year or so, the helicopter will become very unprofitable and get removed, however I'd prefer to have a cleaner solution to the problem.
One solution could be to use distant join stations to make Chopper build a train/bus/lorry station in each corner of where the old airport was, in order to retain the original catchment size, however this seems like an ugly solution:
Rather than try and retain the original catchment, I could make Chopper check which cargos the new station accepts, and then sell any helicopters visiting that station that can no longer do their cargo on that route. However that could mean that a profitable route is wasted.
Perhaps the best solution would be to check what cargos the station should accept/produce, then try and place it accordingly, and if complete catchment cannot be achieved then place the station near just one cargo, and build another station next to the other cargo, and send the appropriate helicopters to that other new station instead. However this defeats the main reason for upgrading the airport which is to lower the noise level to allow more airports to be built; this method just uses up that freed noise.
Whatever happens, expect a new release of Chopper soon
I've now improved it so that each tile is given a value depending on the accepted/produced cargo, and the highest value is the best. All these calculations are done before the old airport is destroyed, and so replacing the airport with a new one is almost instantanious, meaning there is almost no chance of any competitor being able to build in the way! (However, there is a tiny tiny chance that the game will be saved in the gap between the old airport being destroyed, and the new one being built. If that game is loaded then Chopper will end up with some aircraft forever waiting in a hangar with invalid orders because the station was never replaced, but the chance of this is near impossible...)Eliandor wrote:You might also want to consider evaluating at what place of the original airport the catchment area for the newer (smaller) airport covers the most tiles of the desired goods. That way you'll be placing the new airports closer to your city, contrary to what's shown in your attachment.
I think the next main thing that needs improving is how Chopper starts a game off, especially an early game when there is only the airship available. The current problem is that the airship is quite expensive, slow and not very profitable, and so Chopper will waste quite a bit of money constructing new routes, only to demolish them again because they are not making enough profit (though they are making a small profit). I think perhaps I should change it so that in the first few years (or whilst loan/money is below a certain threshold), as long as the profit is positive the route shouldn't be demolished. Once Chopper has got a solid income he can then worry about finding the most profitable route possible.
One other thing I should probably improve at some point is the levelling of land for an airport. Currently Chopper only knows how to lower land, not raise it, and will only attempt to flatten the land if it is just a small difference in height. This works relatively well for the helistation, helidepot and heliport since they are very small and do not need a large area of land to be flattened, but the small and large airport are substantially bigger and on a rough hilly scenario, Chopper will often not find a spot for them.
Oh, and Chopper now builds an HQ
The HQ is built next to the central airport. The central airport is the first airport created in the game, and is were helicopters are sent to get them out the way. It is also used to build the helicopters if no other depots exist, for example if you start Chopper in the year 1963 when the heliport becomes available, it is very likely that the routes will use only heliports (which has no hangar), because the helidepot and helistation do not become available for another few years after; and so a hangar is needed somewhere to build the aircraft.
No new version of Chopper just yet, but should be soon(ish).
To prevent the save happening between the destroying of the old Airport and the construction of the new one: how about adding a tasklist to your AI, as a stack, saveable? That way he won't forget what he was doing.
What if there is a save/load between the task being added ? You need to solve the atomicity problem I mentioned on this forum before. When you want to atomically add a list to another list, you can make a copy of the first list, add the second to the copy and assign the result to the variable to be saved. Hopefully the last assignment is a single bytecode instruction and thus atomic. This is much trouble for a save/load feature.Eliandor wrote:how about adding a tasklist to your AI, as a stack, saveable? That way he won't forget what he was doing.
AFter a sleep you have at least 5000 ticks where your AI is not suspended. Unless you execute a DoCommand function in which case your Ai will be suspended immediately.Blustuff wrote:What if there is a save/load between the task being added ? You need to solve the atomicity problem I mentioned on this forum before. When you want to atomically add a list to another list, you can make a copy of the first list, add the second to the copy and assign the result to the variable to be saved. Hopefully the last assignment is a single bytecode instruction and thus atomic. This is much trouble for a save/load feature.Eliandor wrote:how about adding a tasklist to your AI, as a stack, saveable? That way he won't forget what he was doing.
Will it still be true in the next versions of OpenTTD ?Yexo wrote:AFter a sleep you have at least 5000 ticks where your AI is not suspended. Unless you execute a DoCommand function in which case your Ai will be suspended immediately.
Everything can be changed, but I see no reason why this would be changed. Don't count on exactly 5000 ticks, but after a sleep you'll have plenty of ticks to copy some lists.Blustuff wrote:Will it still be true in the next versions of OpenTTD ?Yexo wrote:AFter a sleep you have at least 5000 ticks where your AI is not suspended. Unless you execute a DoCommand function in which case your Ai will be suspended immediately.
It performed not so good. It builds 1 or 2 choppers, realizes they don't make profit, sells them, sits on the rest of the money, then slowly goes bankrupt. Chopper only picked up when the Boeing Vertol became available.
Difficulty settings were slightly easier than medium, startdate 1977, max initial loan 200,000 GBP.
See attached save game.
NewGRFs: OpenGFX, better vehicles names, Av8 1.501
(I will post comparable posts in the other AI's topics)
- AI game.sav
- (658.84 KiB) Downloaded 79 times
Thanks for the bug report, but unfortunately I can't really see where the problem is exactly without the code line numbers. Hopefully though that bug is just a one off.
Unfortunately sometimes it seems it is impossible to make a profit using helicopters (e.g. using the airship from pre-1950). However in v9 I have been working on improving how Chopper starts a game, so that he expands cautiously and doesn't waste money building stations that will go unused for years. Hopefully this will fix some of the bankruptcy problems, but Chopper often struggles when the speed factor is less then 1/1
Chopper definitely can perform well when good helicopters are available, but I hope to make Chopper simply be able to survive in any situation. It seems though that this may be impossible, so I may have to resort to giving Chopper a backup plan for when things go horribly wrong, such as build some airplanes. But that defeats the purpose of this AI.
Edit: I saw you used v7, there is a v8 of Chopper on the last post of the first page. v8 can start any time earlier than 1976, so if you do decide to have another AI game, you can start at 1950 if you want
(only posted because Marbs was online only about 2 weeks ago)
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
That's right, I've resurrected this ancient topic back from the dead!
Sadly this is just a very minor update, however it has been an essential one, as you shall see below.
-Fixed a fatal bug where all vehicles only got assigned one order (which made the AI immensely useless).
-Fixed another bug where playing with Chopper on a "lazy" attitude caused him to error almost instantly.
-You may have noticed I skipped releasing versions 8 & 9. That is because I didn't get around to releasing them at the time I wrote them (about 2 years ago ).
What is next for Chopper? It seems to me that playing a helicopter only company on the default aircraft speed of 1/4 makes it impossible to survive, let alone profit, until near the year 2000 (though NewGRFs will help). Even at 1/1 Chopper will just break even on a good day.
I think that the only way forward is to expand from only using helicopters, but to try and keep to the spirit of Chopper. Ultimately I'd like this AI to help grow towns but without interfering with the other players too much. For this I plan an intracity road network. Busses could simply take routes within cities, helping the city grow and balancing off the burden of helicopter transport, perhaps even assisting by transferring cargo to the heli-stations.
Sorry it took so long, but you can stop wondering now!
Chopper v10 is out on BaNaNaS.
Users browsing this forum: No registered users and 4 guests