Skip to main content
Topic: Wanted: New AIs (Read 20990 times) previous topic - next topic

Wanted: New AIs

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!

Re: Wanted: New AIs

Reply #1
Soon there will be also a chance to ****ingn slot to different AIs (i.e. have two p****enger AIs compete.)

Is it possible to select trucks only or freight trains only or both of them for each slot ?

Re: Wanted: New AIs

Reply #2
Soon, the saving and the slot ****ignment need debugging but works already for me. Just not yet comitted.

Re: Wanted: New AIs

Reply #3
Maby try and allow the AI to pick the cheapest route? Or the fastest route, so there will be a certain competition?

Re: Wanted: New AIs

Reply #4
The current AI builts the best route it can do. YOu need a better AI to have such a setting.

Re: Wanted: New AIs

Reply #5
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"

Re: Wanted: New AIs

Reply #6
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!

Re: Wanted: New AIs

Reply #7
oAI selection system now incorporated. YOu can now let several p****enger AI compete (not that is does make sense, but) ...

Re: Wanted: New AIs

Reply #8
Quote
oAI selection system now incorporated.

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.

Re: Wanted: New AIs

Reply #9
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).

Re: Wanted: New AIs

Reply #10
Back to my old question.

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.

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 ?

Re: Wanted: New AIs

Reply #11
This is planned, together with p****word and naming of companies.

Re: Wanted: New AIs

Reply #12
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?

Re: Wanted: New AIs

Reply #13
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
Parsley, sage, rosemary, and maggikraut.

Re: Wanted: New AIs

Reply #14
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"?
Parsley, sage, rosemary, and maggikraut.

Re: Wanted: New AIs

Reply #15

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.

Re: Wanted: New AIs

Reply #16
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 ... )

Re: Wanted: New AIs

Reply #17
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
Parsley, sage, rosemary, and maggikraut.

Re: Wanted: New AIs

Reply #18
It would make sense generally if the AI had as few penalties/bonuses compared to human players as possible.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.


Re: Wanted: New AIs

Reply #20
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  :)


Re: Wanted: New AIs

Reply #21
I want to help on this. Where can i start from? And somebody could help me on this, because I am a c++ beginner.

Re: Wanted: New AIs

Reply #22
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.

 

Re: Wanted: New AIs

Reply #23
To get familiar with simutrans play it :) Then try to change things you dont like/find uncomfortable/find are missing etc.
Parsley, sage, rosemary, and maggikraut.