Just a note: Denver & Rio Grande uses the BSD license wich is less restrictive even then the GPL v2. Basically, feel free to use any of the code however you wish. If you take code I wrote word-for-word then please mark those sections with my name and copyright information in the code file. But that's the only restriction.Yexo wrote:That depends on how an AI is licensed. Currently all AIs uploaded to bananas (with the exception of Denver & Rio Grande) are licenced under GPL v2. That means you're free to reuse code as long as you make your AI available under the GPL v2 licence too (in effect making your code available for reuse too).Kogut wrote:Is it OK to reuse code from other AIs (for example improved road pathfinder from SimpleAI)?
SimpleAI v14 - trying to remake the old AI
Moderator: OpenTTD Developers
Re: SimpleAI v1 - trying to remake the old AI
Re: SimpleAI v4 - trying to remake the old AI
Version 4 is out on Bananas and the first post.
It contains two minor bugfixes (well, two lines of code were changed ):
It contains two minor bugfixes (well, two lines of code were changed ):
- The bug reported by Raider, now the AI should load properly if the game is saved between the construction of two stations.
- A bug was fixed which prevented the AI from getting started if inflation had already done its effect. (Thanks to Zuu for running that test )
Re: SimpleAI v4 - trying to remake the old AI
Test: latest nightly + v4 + inflation - the biggest interest rate (4%) - in 1990, with USD 900,000 available (diluted from the starting USD 200,000), SimpleAI won't build anything - of course with road vehicles set to max. 0. I think it could easily build a short goods or passenger train. Perhaps set it so it buys a bit slower locomotive at first (e.g. Gresley A3 instead of A4 or EE'37' instead of BR'87') so it can get the starting money even if started late...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
Yes, that's quite a corner case. Fixing it is not just 1 extra line of code, because the currently the AI always chooses the fastest train engine available. So a little work in engine selection would be useful...
Re: SimpleAI v4 - trying to remake the old AI
There is very good train finder in Denver & Rio Grande, with newgrf support. (But designed for freight trains)
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: SimpleAI v4 - trying to remake the old AI
Thanks for the kind words Kogut! Please do feel free to use it. It should work for PAX. As I recall you pass in the desired cargo type and it works out an engine that can haul it.Kogut wrote:There is very good train finder in Denver & Rio Grande, with newgrf support. (But designed for freight trains)
Re: SimpleAI v4 - trying to remake the old AI
Another (little) annoyance: sometimes when AI has got enough trains (lets say 15) and it's late in the game and inflation has had its way, so to speak, I get messages if I want to buy the said SimpleAI company. Of course - before that it gets some bankruptcy warnings.
Now from my observation - this happens because AI is too "obsessed" to repay even the smallest amount of loan.
I propose it taking as much loan as possible when in the building mode if it doesn't have at least 3x the amount of the maximum loan money prior to going into building mode.
Now from my observation - this happens because AI is too "obsessed" to repay even the smallest amount of loan.
I propose it taking as much loan as possible when in the building mode if it doesn't have at least 3x the amount of the maximum loan money prior to going into building mode.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
Inflation again... The problem is that I don't play with inflation myself so I'm not used to it.
The interesting thing is that the AI nearly always tries to keep some cash (at least the loan interval) at hand. In the pathfinding loop it doesn't, so that might be the problem. If you experience this again, please post a savegame or a screenshot of the log!
Anyway, did the company survive or it was bought by someone else?
The interesting thing is that the AI nearly always tries to keep some cash (at least the loan interval) at hand. In the pathfinding loop it doesn't, so that might be the problem. If you experience this again, please post a savegame or a screenshot of the log!
Anyway, did the company survive or it was bought by someone else?
Re: SimpleAI v4 - trying to remake the old AI
Oh - that's a frequent situation in my games - in that same game yesterday I saw that message at least 3 more times and one company even went bankrupt - all because locomotives are expensive in 2020+ and that dear sweet AI just had to repay every single USD 100,000. It just so happened that the result of its repayin' was that it was in red (-cash) when just the right month came by (= end of Dec/March/June/September). This happened 3 times and it was out/offered to me to buy it, I didn't want, it was still micro-managing the repayments, so it went bye-bye. Oh well.
The funniest thing aboot it all is that it says in its debug log "I'm in trubel, I don't know what to do!" (those two "typos" are intentional).
P.S.: You can perhaps add a condition that only if inflation=1 it repays money only when it's got 3 or 4 times the max_loan and not before.
The funniest thing aboot it all is that it says in its debug log "I'm in trubel, I don't know what to do!" (those two "typos" are intentional).
P.S.: You can perhaps add a condition that only if inflation=1 it repays money only when it's got 3 or 4 times the max_loan and not before.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
I smell some miscalculation in my code there, because as I said, the AI checks whether it has less than the loan interval, and loans if needed. Or maybe it lost the money during pathfinding. The AI cannot get into negative by its own actions, so paying back loans shouldn't be a problem. The problem comes when it doesn't loan when it should...
So I would need a screenshot or a savegame to check where the miscalculation is. I'm almost certain that this is a bug (because of my lack of knowledge about inflation-enabled games) and not a bad algorithm.
So I would need a screenshot or a savegame to check where the miscalculation is. I'm almost certain that this is a bug (because of my lack of knowledge about inflation-enabled games) and not a bad algorithm.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: SimpleAI v4 - trying to remake the old AI
A small comment dedicated to this AI as based from my (short) competitive run with a number of other AIs: you did very well, this is the AI which did best when considering the use of trains.
Best areas of improvements now seem to be from this brief test: you might consider to also add some basic plane support; they might in some situations make a good money maker. The train support could build more tracks and connections. Long-distance routes might give big(ger) profit. With 5 million on the bank, there's sufficient space to start some serious building, even with 2cctrainset in place.
Attached a screenshot which compares this AI with the best AI (AIAI) and the best train-using AI (simpleAI)
All in all: kudos, you did a great job I love to see real rail tracks being built!
Best areas of improvements now seem to be from this brief test: you might consider to also add some basic plane support; they might in some situations make a good money maker. The train support could build more tracks and connections. Long-distance routes might give big(ger) profit. With 5 million on the bank, there's sufficient space to start some serious building, even with 2cctrainset in place.
Attached a screenshot which compares this AI with the best AI (AIAI) and the best train-using AI (simpleAI)
All in all: kudos, you did a great job I love to see real rail tracks being built!
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: SimpleAI v4 - trying to remake the old AI
Thank you for the test Plane support is already on the to-do list, but I don't know when I will have enough motivation to code that. I intend to do it this summer.
Re: SimpleAI v4 - trying to remake the old AI
One suggestion - for experimenting a bit if nothing else - Brumi, would you please make the rail station and train length (in squares/tiles) configurable - up to let's say 7 tiles trains and stations and passing lanes (single and double rail).
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
Sorry for the late reply, I was away for a week
Surely not the easiest thing to do with the current code, but not impossible. I still don't know when I will continue the development of SimpleAI (plane support should be the first thing to do), but maybe I'll give it a try when I feel like coding.
Surely not the easiest thing to do with the current code, but not impossible. I still don't know when I will continue the development of SimpleAI (plane support should be the first thing to do), but maybe I'll give it a try when I feel like coding.
Re: SimpleAI v4 - trying to remake the old AI
Here's another one - it would be more truck-friendly if one-way path-signals were choose-able for rail lines.
AI can't always make a rail bridge over the road...
AI can't always make a rail bridge over the road...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
Sure, there's already a setting to build two-way signals, I will add PBS signals as a third option.
I really owe you the next version, it's been a long time since the last one
I really owe you the next version, it's been a long time since the last one
Re: SimpleAI v4 - trying to remake the old AI
No need for confusion.
Another thing - aesthetically pleasing mostly, but for towns, functional. When AI is building a new road it could perhaps check for already existing road and not build one on the neighboring square but 2 squares/tiles apart. Pic:
Another thing - aesthetically pleasing mostly, but for towns, functional. When AI is building a new road it could perhaps check for already existing road and not build one on the neighboring square but 2 squares/tiles apart. Pic:
- Attachments
-
- Camana Transport, 20th Feb 1950.png (20.09 KiB) Viewed 2775 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
The left situation is something that the old AI could've done. So for a remake of the old AI...
Re: SimpleAI v4 - trying to remake the old AI
Indeed.
Anyway - another thing - functionality improvement - the AI should consider upgrading the suspension bridges (max. 70mph) to tubular when they are available...
Anyway - another thing - functionality improvement - the AI should consider upgrading the suspension bridges (max. 70mph) to tubular when they are available...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: SimpleAI v4 - trying to remake the old AI
Again, the old ai would have made huge long wooden bridges, and certainly never upgrade them
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
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
Who is online
Users browsing this forum: No registered users and 33 guests