Merging Better AI with BUG 3.5

@Fuyu

Did you find a way to show whether or not this option is active?

New User Interface Features
_________________________

- Holding down SHIFT+ALT and clicking on a leader in the scoreboard toggles your civ's warplan between WARPLAN_PREPARING_TOTAL and NO_WARPLAN. This feature can be used to signal to your vassals that they should begin preparing for war with a particular player as well, allowing them to be much better prepared when you declare. Any warning you can give your vassals will help, but enough time to build one to two units in a city is best. WARNING: Use of this feature is not multiplayer compatible, WARPLANs are not sent across the network since they're otherwise only used by the AI and so it will lead to OOS errors if you have vassals.
- The scoreboard will show WAR in yellow instead of red when you have declared you are planning a war using the above feature.
- Added line to contact help text explaining that SHIFT+ALT clicking toggles war preparation plans.


This change in CvDLLWidgetData.cpp looks like it gets the job done, but there's no visual indicator (even if the advanced BUG scoreboard layout is disabled).


Code:
		if( gDLL->shiftKey() )
		{
			// Warning: use of this is not multiplayer compatible
			if (GET_TEAM(GC.getGameINLINE().getActiveTeam()).canDeclareWar(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam()))
			{
				if( GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_getWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam()) == WARPLAN_PREPARING_TOTAL) 
				{
					GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_setWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam(), NO_WARPLAN);
				}
				else
				{
					GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_setWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam(), WARPLAN_PREPARING_TOTAL);
				}
				gDLL->getInterfaceIFace()->setDirty(Score_DIRTY_BIT, true);
			}
		}
 
It would be pretty easy to make that MP-compatible. Just broadcast the event and have the AI_setWarPlan() call happen in the Execute() method of the net message. Let me know if you want some help with that.
 
You're right, there is no visual indicator. My problem is, I have no clue if there is one in BetterAI itself.
- The scoreboard will show WAR in yellow instead of red when you have declared you are planning a war using the above feature.
It says that, I couldn't find any indication in the code that this (or any other warplan indication) is actually happening though.

You should be able to see all warplans with cheat enabled when holding CTRL and hovering over your own line in the scoreboard, along with other info you shouldn't see though (unless cheating or AI debugging).
To make it visible, I'd need to check for activeplayer's warplans in getAllRelationsString(), I'd need a new TXT_KEY to display it .. but that should be easy enough. "Preparing for War against A, B" for your own line and "You are preparing for War" for every player line you have a warplan against.

@EF: What you say makes sense, I have no idea how to actually do that though. Help?
Or rather, tell jdog how to do it, and I'll port it over when it's done :p . After all this isn't my own but a pure Better AI feature.
 
To make it visible, I'd need to check for activeplayer's warplans in getAllRelationsString(), I'd need a new TXT_KEY to display it .. but that should be easy enough. "Preparing for War against A, B" for your own line and "You are preparing for War" for every player line you have a warplan against.
This sounds like the best implementation. One wouldn't have to worry about altered scoreboards from mods being a problem.

Please let me know if you implement this. Sounds like a cool feature, but I don't want to cheat to be able to use it. I'm still digesting CvDLLWidgetData.cpp and the overlapping/conflicting changes that both BULL & BetterAI introduced into it. :crazyeye:
 
Okay, I'll try to remember to do that this weekend. I'm busy with Bad Company 2 at the moment. ;)
 
I'm really wrestling with whether or not to introduce this feature into BULL. On the one hand, I really want to use it in my games and be able to display it in the BUG scoreboard nicely (different color crossed swords for planning). On the other, it's somewhat Altered Gameplay since it will change how the AI behaves even without Better AI. I suppose I could make it an optional BULL component. ;)
 
@aB: I honestly don't quite see why this is important, it only affects your vassals, and I always play without since vassal stuff is a part from BTS and as such suffers from the same last-minute-hack syndrome that also plagues pretty much everything else that was new in that last addon.
@EF: Telling your vassals what you are planning should be good even for UP imo. Yes it changes gameplay (for some people, not me) but it looks a lot like something that was overlooked or simply ignored because it looked so unimportant. (When a human wages war, small vassalized AIs helping or not rarely has any significance in the outcome since the AI isn't really a genius when it comes to warfare.)
 
I agree. Vassals do not work satisfyingly. I always play with it off too.
 
@aB: The low level of difficulty of adding War Plan text to hover was just as expected, the time it took me until I got around to it not so much. In case you didn't write this tiny bit yourself by now, and if you are compiling your own dll, r53 and r55 might be of interest to you. Otherwise you'll have to wait a bit longer. I plan to put out another version before I merge in the last 7 revisions of Better AI.
 
@aB: The low level of difficulty of adding War Plan text to hover was just as expected, the time it took me until I got around to it not so much. In case you didn't write this tiny bit yourself by now, and if you are compiling your own dll, r53 and r55 might be of interest to you. Otherwise you'll have to wait a bit longer. I plan to put out another version before I merge in the last 7 revisions of Better AI.

Thanks! I actually forgot all about this. I'm giving it a whirl now, and everything looks good.
 
Does anyone know if the merge instructions in the OP would work with BUG 3.6?
 
Very likely but why would you want such an old version of BUG?

After perusing the changelog, I didn't see anything that really interested me in the newer versions plus my own mod is built using some BUG 3.6 files and I'd have more work merging. BUG is great as is at 3.6!

I hope Civ 5 will make it easier to merge different mods.
 
I have Bug 4.4 and Better BTS AI 1.01 installed.

BUG is in the custom assets folder.
Better BTS AI is installed as a mod.

I followed the directions on the first page for this case (the third possibility listed on that page) but must have done something wrong because the following happens:

1) I can load BTS fine by clicking on the BUG 4.4 link.
2) I can load the Better BTS AI mod fine by going to advanced->load mod.
3) When the game loads with the better ai mod and I start a game, the UI doesn't appear and I get the following error:

"bug init - cannot find xml file for mod init"

Any thoughts on where I went wrong?

The only "nonstandard" thing is that a while ago when I just had BUG and not Better AI, I messed with some of the xml files in the custom assets folder to change some unit/building stats.

Thanks!

WORKAROUND:
I got it working by installing both BUG and better ai into one mod as described by the first option in the first post.

To get it working without error messages I had to run cIV as administrator in windows 7. Dunno if this will be true for everyone but you may want to make a note of it in the first post.
 
Worked the first time. Thank you. My blessings upon you, your family, and your favorite sports team (so long as they aren't playing mine).

-Jason
 
Top Bottom