[MODCOMP] AIAutoPlay

I've autoplayed the game with just the AIAutoPlay changes for literally thousands and thousands of turns and there is no CTD. If you are getting one, then it must be somthing else.
 
I've downloaded this and haven't the foggiest how to install and get it up and running. Where does it go and how do I get it to work? And will it work with mods running, such as the FfH2 mod?
 
I added installation instructions to the download page, check those out.

This mod can be added to many other mods easily, but for something with a custom DLL it's much more complicated. The good news is that I believe FfH2 has the AIAutoPlay SDK portion already in it. You can test it out to check by using the instructions here.
 
I've autoplayed the game with just the AIAutoPlay changes for literally thousands and thousands of turns and there is no CTD. If you are getting one, then it must be somthing else.

Yeah, I just succesfully ran a 200 turn autoplay session with vanilla civ without a crash, so you must be right.

Damn, that means I have a bug hidden somewhere.
 
Hehe, yea, the 1000 turn test has brought out errors in some of my most "stable" beta mods.
 
do I have to do anything else other than copying what is in the .cpp and .h in order to run it? I merged it with my DLL and I'm trying to do CyGame().setAIAutoPlay(X) but nothing happens at all...
 
yeah, I've compiled it.
I did what Maniac did (just SDK changes), so I dunno what's wrong. I open the Python console, input the command and it accepts it, but nothing happens.
 
Jdog, Question.... I have merged the SDK changes from BetterBTS AI anyway so autoplay should be set I downloaded the latest version of this modcomp to get the python bit and i see that there are revolution files in it and nothing defined as Autoplay.... is there a wrong file or am i just stupid.
 
Ok, it's working, I missed one part of the code that is commented as just AI_AUTO_PLAY, and the rest is AI_AUTO_PLAY_MOD :p winmerge found it!
thanks for the tip and for the mod!
 
Jdog, Question.... I have merged the SDK changes from BetterBTS AI anyway so autoplay should be set I downloaded the latest version of this modcomp to get the python bit and i see that there are revolution files in it and nothing defined as Autoplay.... is there a wrong file or am i just stupid.

Since I upkeep AIAutoPlay as part of Revolution the file organization and dependencies carry over from that ... all the support files have a Rev name is all.

If you want a cleaner Python implementation you can grab the one from the latest version of Better BTS AI, I cut all the extra stuff out for that.
 
Hello!
Can someone help me? In Fall From Heaven 2 I want to bind keys (ex. shift + x) for aiautoplay ex. for 5 turns. How can I do it? I'm totally noob on these things.
I'm not sure what to edit and where.
Thanks.
 
Exactly how to do it depends on how things are set up in FFH, but I can give some general help. The best way to handle keyboard commands is through Python. In standard BTS there's a function in CvEventManager.py called onKbdEvent which creates several key bindings. You'd need to find a place like this somewhere in the FFH Python code (ask in their forums and someone should help you find a good place) and add something like:

Code:
if (theKey == int(InputTypes.KB_X) and self.bShift ):
    game.setAIAutoPlay(5)

Indentation is very important in Python btw, it determines what's inside of an if statement for example.
 
Exactly how to do it depends on how things are set up in FFH, but I can give some general help. The best way to handle keyboard commands is through Python. In standard BTS there's a function in CvEventManager.py called onKbdEvent which creates several key bindings. You'd need to find a place like this somewhere in the FFH Python code (ask in their forums and someone should help you find a good place) and add something like:

Code:
if (theKey == int(InputTypes.KB_X) and self.bShift ):
    game.setAIAutoPlay(5)

Indentation is very important in Python btw, it determines what's inside of an if statement for example.

Thanks! I got working it last night. I just put all of the python folder in the ffh2 python folder and in cvmodname I change to mod name "Fall From Heaven 2 033" then copy AIAutoPlay.ini in mod folder. Then it works. Too simply task to me :blush:
Then I edit the AIAutoPlay.py code.
 
First of all, thanks to this great mod component, I'm using it to test my mod now;)

However, I got some weird things like Maniac has posted before:

In certain point of my test game, year 1680, if I automate 2 turns, then stop, then automate 1 more turn, the game crash; if I automate 1 turn, then stop, then 1 turn, then stop, then 1 turn, the game won't crash... Just weird. Any idea what might be causing the problem?

Also, is there any plan of including change player mod component with this one? I think that will be really helpful for any modders.:)

Edit: Never mind, I've found the bug in my code.
 
I had my first experience with AI autoplay during one of my games and thought I'd share the experience in case others were contemplating the same... this is a very useful mod for some things, but it should be used with care in other situations...

In my case, I wanted "cruise control" for the 37 turns after I launched the spaceship (betterAI 0.37 / 18 civs / Huge map / Marathon speed)... I was playing as Shaka and was first in land, but only half as powerful as Hatty, who was playing a quite a war-monger game... but she was pleased with me, so not a big deal... right?

I gave control to the AI for 35 turns, but I noticed several things that made me nervous...

1. Hatty immediately went from Pleased to Annoyed as soon as the AI took over... it closed borders, picked a religion (I was Free Religion), and switched civics... actually the civics switch was the most bone-headed move of all... I had over 40 cities on one continent, controlled two holy cities, owned the Statue of Liberty and Sids Sushi... perfect formula for Representation + Free Market + Free Religion. I had fish trades with every other AI on the map. The AI picked Monarchy + Communism + Theocracy and canceled all fish trades... many of those were quite lucrative even in Communism (my spices for their fish & 12 gold) :rolleyes:... my GNP went through the floor... OK, who cares about GNP after you launch the spaceship, but this completely cratered my relationship with Hatty, who had "Too much on her hands..." when I checked 35 turns later.

2. Further adding to the economic insanity mentioned above, it crammed 10 or 15 new cities into places I'd rather it not (i.e. encroaching on my uber-powerful Heroic-Epic city).

3. I usually organize my troops into stacks... C3+CR3 maceman upgraded all the way to Mech Infantry go here; however, the instant I gave control to the AI, those units sprayed all over the map.

4. There is no pause functionality... I'd like to have time to see what the AI is doing in a given turn... but these turns go by so quickly, it's really hard to know in detail.

In a perfect world, we would be able to give partial control to the AI... and have selectable options so I can pause it at any given moment, can't touch my 100-unit war stack, can't switch civics, can't cancel existing deals, can't build new cities, and automatically reverts control to me if someone declares war on me. I realize this may be a tall order, but if it is going to fill the need as a cruise control in these kind of games, I think these things are very useful.

Thanks for all the work so far, this is an awesome development mod... but at this point I'm a bit nervous about letting it finish anything but total war-monger games.
 
Well, the main purpose of the AutoPlay isn't to let the AI get through the drudgery of clicking "NEXT TURN" button repeatedly, it is to let mod-makers see if the AI is acting properly so that they can tweak the code and improve the AI (or just to test for a crash). So blocking the AI from doing what it wants to do means blocking potential crashes, and failing to see just how dumb the AI might actually be.


Perhaps what you really seek is a flat out "AutoPlay" function, which would be a seperate modcomp completely.



As for "Pausing" you should have a shortcut key to enable 1 turn of AI Autoplay. Press that while Autoplay is active and you will regain control on the start of the next turn and be able to look around for yourself.
 
Well, the main purpose of the AutoPlay isn't to let the AI get through the drudgery of clicking "NEXT TURN" button repeatedly, it is to let mod-makers see if the AI is acting properly so that they can tweak the code and improve the AI (or just to test for a crash).

Perhaps you don't like this use, but it really is marketed as a way to get through the end-game without the micromanagement...

AIAutoPlay Description
Version: 2.0
For BTS 3.17 (some older versions available below)
Multiplayer: Yes*
Langauges: English, French, German

Potential uses

Great for debugging or watching the behavior of the AI, as it shows you only what the AI can see. Also, if you want to skip certain sections of the game, or you're so close to winning but not quite there, let the AI play it for you! With many civs in the late game, auto play will still take a while but you won't have to do anything ... it will basically take (# of turns)*(in between turn lag + a little bit) to go through the turns. As of version 2.0, AIAutoPlay will automatically stop the game at the end so you can see all the end of game screens.


So blocking the AI from doing what it wants to do means blocking potential crashes, and failing to see just how dumb the AI might actually be.

I'm not suggesting that full AI control is blocked for all games, just that it's implemented with some configurable options to do so, if AIAutoPlay continues to be marketed as a way to get through the end-game.


As for "Pausing" you should have a shortcut key to enable 1 turn of AI Autoplay. Press that while Autoplay is active and you will regain control on the start of the next turn and be able to look around for yourself.

Maybe you don't want a pause button, but I do :p... let's suppose you tell the AI to play as you for 25 turns, but you only discover a reason for pausing after 15 turns... a lack of a pause button forces you to single-step the AI behavior any time you *think* there could be a need to pause... as opposed to having a button available means you don't have to single-step unless it's absolutely necessary.
 
Top Bottom