PieceOfMind's Advanced Combat Odds

I just duplicated most of the code and it's all good now. I'm attaching to this post the source file that is different to the zip file for ACO v1.1.

If you need to use the code soon, use this file.

Since it's just a big if statement, it's easy to remove each time I do a release.
 

Attachments

I'm hoping to get some time tomorrow to merge aco v1.1 with the latest version of Better AI, as it seems to be more popular than the stand-alone mod.
 
Great news! As for now - I love the new ACO :)
 
EF or phungus,

An idea I had that is based off something EF said a while ago, is to only show the Attacker unit help when more than one unit is selected. So when you are attacking with individual units you won't see it, but grabbing a stack and whether stack attack is on or not, it would show you the unit that would attack first.

Know how this might be possible in the code?

Here's what it looks like at the moment:
Code:
if((iView & GC.getDefineINT("ACO_Option_ShowAttackerHelp")))
                    {
                        szString.append(NEWLINE);
                        setUnitHelp(szString, pAttacker, true, true);
                    }

Also, EF, I've just finished moving all the language used in the mod to XML so non-English translations should be easier now. This will be the main change introduced in v1.2 (so far anyway).

v1.2 so far:
Spoiler :
v1.2
-Restored functionality of original game's odds calculator if ACO_enabled is 0. (in v1.1 I had altered the appearance of the default calculator even when ACO was disabled)
-Added XML option that lets you choose to ignore barb free wins. (Maybe you think it spoils it to know when you have barb free wins left.) Might be preferable in an Unaltered Gameplay mod. Default value is 0.
-Added option to label "Attack modifiers" and "Defense modifiers" (XML ACO_WhoOwnsModifiers)
-Sent text to XML so translation easier.
-moved first strikes to top of modifier list for attacker and defender. looks a tad tidier


For the time being I have delayed merging ACO with Better AI as I will most likely release v1.2 very soon.
 
No idea, sorry. :dunno:

I'm not a programmer at all, the first C++ code I ever wrote was for this modcomp, and everything I did was pretty simple. I apreciate the fact you value my advice, but chances are if you can't figure it out, I wol't be able to either.
 
Grabbing a stack and whether stack attack is on or not, it would show you the unit that would attack first.

Give this a shot:

Code:
if (gDLL->getInterfaceIFace()->getLengthSelectionList() > 1 && !GET_PLAYER(getOwnerINLINE()).isOption(PLAYEROPTION_STACK_ATTACK))
{
    ...
}

I wonder if you really want to look at the stack attack setting. If it's enabled, you still want to know which unit will attack which defender first, don't you? If you show the defender, you should definitely show the attacker IMHO regardless of the setting.
 
Give this a shot:

Code:
if (gDLL->getInterfaceIFace()->getLengthSelectionList() > 1 && !GET_PLAYER(getOwnerINLINE()).isOption(PLAYEROPTION_STACK_ATTACK))
{
    ...
}

I wonder if you really want to look at the stack attack setting. If it's enabled, you still want to know which unit will attack which defender first, don't you? If you show the defender, you should definitely show the attacker IMHO regardless of the setting.

Yes I was thinking along similar lines. What I was going to do was create an option to only show the attacker if more than one attacker were selected. Personally I don't want to see the attacker unit help all the time in the odds display because it's all directly below in the unit help box anyway, and it unnecessarily clutters up the odds display. When you have multiple units selected, I think the unit help box gives you detail about the stack (I forget) which is not as helpful so enabling the attacker unit help in the odds overview is more useful.

I'll try your code suggestion shortly. Thanks. By the way, did you say earlier you knew people who'd do some of the translations? I'll post the v1.2 version soon and I could PM them the one XML file with all the language in it. (though they might need the mod installed or at least a screenshot to see the context of each statement?)

phungus,
Sorry I keep forgetting you're not really a C++ guy. You and EF have given me code throughout this thread which is I guess why I keep asking you two. :)
 
What I was going to do was create an option to only show the attacker if more than one attacker were selected.

Agreed. The odds display for me is often too high and I can't see the overall probabilities. I would only want the attacker's info when I had a stack selected.

By the way, did you say earlier you knew people who'd do some of the translations?

I would bet that Cammagno and The Doc would be willing to do the translations since they'll be doing them for BULL anyway.
 
EmperorFool,

I'm in a bit of a hurry so I'm just gonna post a working v1.2 here.

I still have a few XML entries I've been trying to remove because they are a bit redundant but it's not a big issue.

example:
Spoiler :
Code:
	<TEXT>
		<Tag>TXT_ACO_HP</Tag>
		<English>HP</English>
		<French>PV</French>
		<German>TP</German>
		<Italian>PV</Italian>
		<Spanish>PG</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_ACO_HP_POSITIVE</Tag>
		<English>[COLOR_POSITIVE_TEXT]HP[COLOR_REVERT]</English>
		<French>[COLOR_POSITIVE_TEXT]PV[COLOR_REVERT]</French>
		<German>[COLOR_POSITIVE_TEXT]TP[COLOR_REVERT]</German>
		<Italian>[COLOR_POSITIVE_TEXT]PV[COLOR_REVERT]</Italian>
		<Spanish>[COLOR_POSITIVE_TEXT]PG[COLOR_REVERT]</Spanish>
	</TEXT>	
	<TEXT>
		<Tag>TXT_ACO_HP_NEGATIVE</Tag>
		<English>[COLOR_NEGATIVE_TEXT]HP[COLOR_REVERT]</English>
		<French>[COLOR_NEGATIVE_TEXT]PV[COLOR_REVERT]</French>
		<German>[COLOR_NEGATIVE_TEXT]TP[COLOR_REVERT]</German>
		<Italian>[COLOR_NEGATIVE_TEXT]PV[COLOR_REVERT]</Italian>
		<Spanish>[COLOR_NEGATIVE_TEXT]PG[COLOR_REVERT]</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_ACO_HP_NEUTRAL</Tag>
		<English>[COLOR_UNIT_TEXT]HP[COLOR_REVERT]</English>
		<French>[COLOR_UNIT_TEXT]PV[COLOR_REVERT]</French>
		<German>[COLOR_UNIT_TEXT]TP[COLOR_REVERT]</German>
		<Italian>[COLOR_UNIT_TEXT]PV[COLOR_REVERT]</Italian>
		<Spanish>[COLOR_UNIT_TEXT]PG[COLOR_REVERT]</Spanish>
	</TEXT>

I'm not far from having removed all references to both TXT_ACO_HP_POSITIVE and TXT_ACO_HP_NEGATIVE.

It's pretty much ready for translation now, so if you have anyone who wants to translate CIV4GameTextInfos_ACO.xml, you can pass it on to them or let me know.

changes:
Spoiler :
-Restored functionality of original game's odds calculator if ACO_enabled is 0. (in v1.1 I had altered the appearance of the default calculator even when ACO was disabled)
-Added XML option that lets you choose to ignore barb free wins. (Maybe you think it spoils it to know when you have barb free wins left.) Might be preferable in an Unaltered Gameplay mod. Default value is 0.
-Added option to label "Attack modifiers" and "Defense modifiers" (XML ACO_WhoOwnsModifiers)
-Sent text to XML so translation easier.
-moved first strikes to top of modifier list for attacker and defender. looks a tad tidier
 
Here's the file with German and Italian translations. Maybe you can find someone to do the French and Spanish ones as well. :)
 
v1.3 has been posted.

Download link: http://forums.civfanatics.com/downloads.php?do=file&id=12793

Now for German and Italian! :)

And with an executable installer thanks to phungus420.:goodjob:

EDIT Had to fix something and take the download for 10 minutes or so. I think one person downloaded it before I made that change (it had the wrong DLL in it), so you might want to download again.
 
so what exactly is "Better BtS AI v078C"? i couldn't find it when searching the forums, and i'm not sure what it does, therefore i don't know whether to download 1.3 by itself or when it's merged with this

It's Better BtS AI v0.78.

I think the C is for revision C or something like that (it was in the readme).

You can find Better BtS AI here:
http://forums.civfanatics.com/showthread.php?t=297810

The reason I provide ACO merged with Better BtS AI is that Better AI is a very popular mod.
 
I just noticed that in the zip for the ACO+BBAI I had included a gamesave by accident. I've just removed it from the zip in the downloads database, but if you're one of the people who downloaded the mod before now, you can safely delete that savefile with no ill-effect! :lol:
 
I have an idea for future version (2.0?). Calculating defensive odds. When I have 3 promoted bows defending vs 3 AI Swords (just an example) I often want to know whether it is safe to not whip an emergency archer ASAP.
 
I have an idea for future version (2.0?). Calculating defensive odds. When I have 3 promoted bows defending vs 3 AI Swords (just an example) I often want to know whether it is safe to not whip an emergency archer ASAP.

It might be possible to eventually get the switcharoo code working. That code is meant to reverse the attacker and defender so you can see the odds the unit would have if it were defending. It has not been working correctly so far so I have left it disabled indefinitely until I can get it to allocate the defense modifiers correctly. Could be a while before that works.

As for situations of, say, 3 units vs. 3 units, that is probably going to be beyond this mod.
 
What was the problem you had getting it to work again? Sorry to ask instead of rereading the thread; I'm pretty swamped. :crazyeye:
 
Firstly, something is going wrong with the probability calculations when the units are swapped. Secondly, the modifiers are sometimes on the wrong unit or just not displayed at all when they should be. I assume this has something to do with the way you normally pull the details about the terrain the units are on. If by default you get info about the defender by getting details from under the cursor, it could be causing the problem. Maybe the attacker is assumed to be the unit that is selected as well. I haven't given much time yet to looking into what's going on but most troubling to me was the nonsense probabilities I was getting.

Having said all that, it does appear to work well when there are no terrain modifiers at all and only unit-specific modifiers.

I'm not going to be able to look at it until tomorrow.
 
EmperorFool,

If you lik, search for SWITCHAROO in GameTxtMgr in the source for v1.3 and you'll see where I have the code disabled. You're weclome to try getting it to work but I'd imagine you won't have time if you're pretty swamped at the moment.
 
Back
Top Bottom