Since the AIs are now more or less complete in seperated files, I would like to include more AIs than the two standard ones. (ai_p****engers.cc and ai_goods.cc). Soon there will be also a chance to ****ingn slot to different AIs (i.e. have two p****enger AIs compete.) If you feel like trying, please do so!
Is it possible to select trucks only or freight trains only or both of them for each slot ?
Soon, the saving and the slot ****ignment need debugging but works already for me. Just not yet comitted.
Maby try and allow the AI to pick the cheapest route? Or the fastest route, so there will be a certain competition?
The current AI builts the best route it can do. YOu need a better AI to have such a setting.
No code to show, but I thought I'd mention what I've tried to avoid duplicate effort...
(I haven't ever written C++ beyond basics, and that was a long time ago, and my german isn't great, so I stuck to modifying the ai_goods.cc code, rather than starting from scratch)
I tried making the decision over whether to build road or rail connections between towns based on the expected time to make a return on investment (ROI) - i.e. to choose whichever would make the money back the fastest.
That didn't work - it performed slightly worse than the existing method when I tested it (the existing method is based on which would make the most profit per month)
Then I decided to only use the ROI method for connections that would use a large percentage of the cash that the player has, to avoid going bankrupt.
That seems to work ok - but I'm not sure if it's better than the original. The players don't go bankrupt as quickly as they sometimes do with the current code, but they are more likely to at some point. I'm going to try playing around some more if I have any time - perhaps it's just a case of "you've got to spend money to make money"?
Edit: decided to share my patch after all if anyone is interested (or has comments about coding style/me not understanding something), there's not much there but it took a while to understand how the code works ( both C++ and simutrans ). Patch is taken direct from the file with "svn diff ai_goods.cc"
Well I started C++ with Simutrans, as Hajo did too. So do not fear and fell free to ask all kind of questions. It is good to know, that smebody works on a AI again!
oAI selection system now incorporated. YOu can now let several p****enger AI compete (not that is does make sense, but) ...
How do you register a new AI with the game? I can't see where you say your subcl**** of ai_t is available for selecting in-game.
You have to change simplay.h, define a proper return value for your AI and add a name to player_frame.cc (see next revision).
Back to my old question.
Currently, I can't select trucks only or freight trains only or both of them for each slot.
Is there an another patch for this ?
This is planned, together with p****word and naming of companies.
Works anybody on this projekt?
I think a lot of patches were made. But the AI is not really inteligent. That can be better.
Wants anyone to improve this?
Here is a small patch such that the p****enger ai can deal with carriages / kutschen. Starting more than one p****enger ai will now lead to traffic jams even as early as 1870 ;D
In the current implementation the ai's are allowed to create vehicles everywhere they want. That is, they do not need to build them in a depot. Imho this looks like cheating. Is it wanted to change this to a more strict "build only in depots"?
Indeed. But they also have big penalty.
They must pay the cost of raise(lower) lands and cost of building stops and ways, even if they failed to connect their root.
And if they failed to connect their root, they must pat the cost of removing ways, too.
The patch is not really complete, as the check for pulling engines needs to meet constraits. To have a general AI the constraits must be checked too.
As for depots (then of course for everything) just go ahead. But then you should of course try to use as few depots as possible. (Also the AI could start their convois and then removing the depot. WOuld be cheaper on the long run anyway ... )
Ok, I was not aware of these vehicle constraints :) At least for pak.german, the p****enger AI's play with carriages.
And it would be even cheaper (for the goods AI) to sell the vehicles after unloading and buy a new one instead :D
It would make sense generally if the AI had as few penalties/bonuses compared to human players as possible.
This was requested fairly frequently in my old forum, so I ****ume the answer is yes.
Haven't had time to look at this since my very basic patch (start of December), but I just wanted to thank prissi for the translations.
Only a few changes, but they have made the code far more readable for me :)
I want to help on this. Where can i start from? And somebody could help me on this, because I am a c++ beginner.
You can give it a try; if you are only new to C++ you could look into the folder "trunk/player", look at the code and ask for stuff you do not understand. The ai_goods.cc and ai_p****enger.cc are the respective code for the AIs.
If you are new to programming, then better search something less complex for the start than simutrans.
To get familiar with simutrans play it :) Then try to change things you dont like/find uncomfortable/find are missing etc.