[SDK] Lead from Behind

Any info about when to expect next update fixing the bug Cybah talked about?
Because I'm one of the players who use right click menu. It is very useful for me because of my low vision. I wanted to merge this mod into RevDCM sources and test it out before I commit to saying "YES! It hadve to go in!" for next single-player version of RevDCM.

Btw, I have to seriously thank you for your clear commenting what is original and what is new in C++. I did not even use WinMerge to merge in your sources when I merged it in to Merged mod by Ninja2 code. (I just did not success because of need for new type of makefile that Ninja2 did not make available because he has BULL in there as well.)

Anyway, I would like that fixed version very much :).
 
I think most players won't attack with their great general led unit with odds of say 90%. They'll wait until the unit has 99+% odds. So I think those players would also prefer it if their valuable units only defended in such cases.

So maybe the value of 850 is not exactly what most players would like. A unit fighting a series of 85% odds battles wouldn't live long.
OK, I changed it to use 990 instead. Adjustment is now (odds-990)*(value/5). It still may make your valuable unit defend - e.g: you have 85% odds, other unit has 70% odds ... with value 5 (great general) you'd still defend. But add even 10 XP (up to value 6) and the other unit would defend. You can let me know if the adjustment seems to be too little (or too much). If you turn off the sliding scale (xml setting) then the adjustment is (-250)*(value/5).

Any info about when to expect next update fixing the bug Cybah talked about?
How about ... now? :P Seriously, just uploaded it :D (And should note that this time I tested it with Python exceptions enabled!)

Btw, I have to seriously thank you for your clear commenting what is original and what is new in C++.
No problem - I've been coding long enough to know the value of comments! Though the idea for using orignal/modified comments I got from someone else (can't remember who - just saw it posted somewhere awhile back).
 
A I wanted to merge this mod into RevDCM sources

Why waste the time, I already merged it with my sources. ;)

How about ... now? :P Seriously, just uploaded it :D
Excellant, I will get the latest version.
No problem - I've been coding long enough to know the value of comments!

Yes, good commenting is very helpful, especially when your sources are as convoluted as mine, with bits of code from lots of places.
 
Why waste the time, I already merged it with my sources. ;)

For HitM? For plain RevDCM? For Merged after Ninja2 get his makefile straightened out? And maybe few others?

These are what I meant by merging. I already am waiting with bated breath for your release for RoM :D!
 
OK, I changed it to use 990 instead. Adjustment is now (odds-990)*(value/5). It still may make your valuable unit defend - e.g: you have 85% odds, other unit has 70% odds ... with value 5 (great general) you'd still defend. But add even 10 XP (up to value 6) and the other unit would defend. You can let me know if the adjustment seems to be too little (or too much). If you turn off the sliding scale (xml setting) then the adjustment is (-250)*(value/5).

I actually don't have a strong opinion about the matter. I just know that people don't use their valuable units in battles without extremely high odds. But for me personally, I don't care a lot about protecting super units.

I just thought a bit about the consequences of your formula. I didn't really think about it at first.

The formula doesn't really do what you want (or what I think that you'd want). For instance:
-a 40 xp unit (value 3) at 60% odds will defend before a 0 xp unit at 35% odds.
-a 40 xp unit (value 3) at 75% odds will defende before a 0 xp unit at 60% odds.

I suspect that people who value their high xp units won't want them to fight at such low odds if there are other defenders. In general, if the odds are far away from the ideal 99+% odds, players won't want that high xp unit to defend. Squaring the distance between 99% odds and the actual odds will help obtain that behaviour.

A formula of the form: odds + 1/40 * (odds-990)^2*sign(odds-990)*(value/5) or something like that (sign is a function that produces a value of +1 when the value of its argument is positive and -1 when the value of its argument is negative). Maybe 1/40 is wrong. You'd need to experiment a bit with it. Take a few practical cases and see how it works. Some value 2 units, some value 8 units and just see how they will defend in various cases compared to low value units.

Good luck with getting the behaviour exactly as you want it.
 
Using a mod that have merged lead from behind, protective leader give rather ... "intersting" results. Sitting bull had a city with 4-5 longbow with 4 total promotion, CG3 + Drill 1. They were also a bunch of elephant and swordman with 1 prom, City raider or combat. I was able to destroy all swordman and phant with my cavalry because the 4-prom longbow were deemed more precious than the attacking troops.

Maybe the experience weight should be tuned down a little. If protective mean "your dedicated city garrisons are destroyed last", it may cause some balance problem.

I don't have disactivated the option that make more experienced defenser less likely to defend. To give an idea, I had 97%+ against sword and 70% + 20% retreat against longbow.

Edit : no luck in finding in wich situation it occur, but another example : a medieval stack with combat 2 pike and trebuchet. I have attacked and destroyed the 4-strength unpromoted treb before the 7.2-strength pike. Attacker was infantry.

Re-Edit : the bug is : 4-prom longbow and 2-prom pike are not precious unit, SB is building them directly with this experience, so their value is way overrated.
 
lol ... I have one saying it's adjusting too much, and one that it's adjusting too little ... I must be doing something right ;)

Using a mod that have merged lead from behind, protective leader give rather ... "intersting" results. Sitting bull had a city with 4-5 longbow with 4 total promotion, CG3 + Drill 1. They were also a bunch of elephant and swordman with 1 prom, City raider or combat. I was able to destroy all swordman and phant with my cavalry because the 4-prom longbow were deemed more precious than the attacking troops.
I don't give value based on promotions, just experience - for Sitting Bull, Longbow's would get CG1+Drill 1 by default, so sounds like these had two extra promotions. Basically 4 XP ... are you sure this is the latest version? 4 XP would be enough with v1.0 to make it 'more valuable' then a unit with 0 XP - but with v1.1, you'd need at least 10 XP to get any value. (Although it's still possible with the right civics/buildings for units to start with 10 XP - but the adjustment for value 1 wouldn't be very big)
 
I suppose it's not the last version, at least I hope so. It's embedded in another mod, so I'm not sure

Some more test shows me that catapults were regulary before longbow as defense, so the XP option were simply unplayable, no stack defend were possible at all. I suppose the formula should not be linear, i.e. not linked to XP but to XP². Still, since the XP value that make an unit "valuable" change a lot (in the beginning, 4 XP is kind of a lot, in the end you can pump out 8 or 10 XP unit), maybe it's just that the idea sound good but does not work too well. (the idea of reducing defense odds with XP, that is)

Edit : a pretty extreme case I just had, that seem to show others bug. Zulu capital on grassland, with one grenadier (Combat 1 / shock), one longbow (guerrilla 2) and a last one (CR1). I attack with 100+ quechua (worldbuilder). The guerrilla 2 defend against all quechua and have his strength sapped, little bit by little bit. I can't really fathom why.

Re-edit : the guerila 2 longbow stop defending when reduced at 1.7 strength. WIth a little more thought, I think I understand what happen : since he has 99.9+% chance to win, like the other 2, and has 2 more XP, he defend first to give XP? That feel very wrong because he can actually lose HP rather easily, unlike the grenadier. SO it's more a case of very counterintuitive defense.
 
I suppose it's not the last version, at least I hope so. It's embedded in another mod, so I'm not sure
I should've put a version number in the readme or something ... well, I'll know for next time :P

I suppose the formula should not be linear, i.e. not linked to XP but to XP². Still, since the XP value that make an unit "valuable" change a lot (in the beginning, 4 XP is kind of a lot, in the end you can pump out 8 or 10 XP unit), maybe it's just that the idea sound good but does not work too well. (the idea of reducing defense odds with XP, that is)
In the latest version it's valued in tiers, starting at 10 and doubling with each tier (10/20/40/80/etc). (In the older versions it was based on having at least 25% more XP than the other unit)

Re-edit : the guerila 2 longbow stop defending when reduced at 1.7 strength. WIth a little more thought, I think I understand what happen : since he has 99.9+% chance to win, like the other 2, and has 2 more XP, he defend first to give XP? That feel very wrong because he can actually lose HP rather easily, unlike the grenadier. SO it's more a case of very counterintuitive defense.
Yes, it does increase chance of defending when odds are higher (higher than 99% in latest version - higher than 85% in previous version). Though 2 more XP wouldn't be enough to make it 'more valuable'. But of course as it gained XP from the first battles, it would become more valuable, which probably kept it defending even after it was damaged (as long as odds were still high enough).

As for defending in the first place ... you say the odds were 99.9+% - so basically it computed the defenders odds at 1000. And if every unit has 1000 odds, then they're tied (assuming equal value) - and it simply comes down to the unit's cycle order as a tie-breaker.
 
PIG Mod is the mod TLH is referring to. In the pre-release version of that mod it was only version 1.0 of LFB that had been merged in. I've since merged 1.1 but have not yet released PIG with that, so if the issue is fixed with LFB 1.1 then it might be ok now.
 
As for defending in the first place ... you say the odds were 99.9+% - so basically it computed the defenders odds at 1000. And if every unit has 1000 odds, then they're tied (assuming equal value) - and it simply comes down to the unit's cycle order as a tie-breaker.

I understand. I suppose its not very important because it happen mainly in extreme case, thoses where the %victory is equal or nearly equal but one unit is clearly superior, and that happen either in already won war or cooked case.
 
If someone has merged this with revolutionDCM 2.6, Please can you share the source files that have RevDCM + Lead From Behind code. Be very much appreciated.

I'm having bad issues merging this, Keep getting frustrating errors.
 
If someone has merged this with revolutionDCM 2.6, Please can you share the source files that have RevDCM + Lead From Behind code. Be very much appreciated.

I'm having bad issues merging this, Keep getting frustrating errors.

I've merged it fine, but I've got tons of other modcomps and personal changes in my sources too. It wasn't too bad of a merge if I recall correctly.
 
I've merged it fine, but I've got tons of other modcomps and personal changes in my sources too. It wasn't too bad of a merge if I recall correctly.

I don't recall exactly. But I remember getting one error repeatedly when I tried to merge in LFB into HitM sources. It say something about bdefender not recognized or something like that. And it is about animals? I gave up at that point.

Next step is manually merge into original sources (copied of course!) to see if I have better getting dll the same as Uncutdragon gives out. I want to see how it works in the original sources, with nothing in it except BtS sources.

Merging C++ can be a maddenning task! However, it is a lot better now that I refuse to depend on WinMerge for merging, only for comparison.
 
I don't recall exactly. But I remember getting one error repeatedly when I tried to merge in LFB into HitM sources. It say something about bdefender not recognized or something like that. And it is about animals? I gave up at that point.

Next step is manually merge into original sources (copied of course!) to see if I have better getting dll the same as Uncutdragon gives out. I want to see how it works in the original sources, with nothing in it except BtS sources.

Merging C++ can be a maddenning task! However, it is a lot better now that I refuse to depend on WinMerge for merging, only for comparison.

What do you use for merging then? With more SDK merging I've been doing recently, I've been growing more fond of winmerge.
 
I don't recall exactly. But I remember getting one error repeatedly when I tried to merge in LFB into HitM sources. It say something about bdefender not recognized or something like that. And it is about animals? I gave up at that point.

Merging C++ can be a maddenning task! However, it is a lot better now that I refuse to depend on WinMerge for merging, only for comparison.

Yes! pDefender inside Dales coding for allowing battle effects with animals. I just took it out and it worked fine from there. Didnt look as though it was a vital piece of coding anyway. I use to do it manually a lot, but winmerge is the lazy mans best friend and im lazy :)
 
Yes! pDefender inside Dales coding for allowing battle effects with animals. I just took it out and it worked fine from there. Didnt look as though it was a vital piece of coding anyway. I use to do it manually a lot, but winmerge is the lazy mans best friend and im lazy :)

Does this modcomp conflict with DCM?
 
Does this modcomp conflict with DCM?

Yeah, One piece of code from LFB has to be copied across twice to replace a line thats repeated twice inside Better AI code segment (This line only present once in vanilla). The other is something to do with pDefender or pBestDefender, Its used inside Dales battle effects code segment and is something about animals. I just took it out because im not a fan of battle effects. There may be one or two more conflicts but i was half asleep when doing it so i cant really remember all the pieces. Winmerge does not work well with this merge too, so most has to be done manually. Played 150 turns of my game so far and no problems yet.

BTW Double thanks!

Thanks UncutDragon for Lead from Behind!
Thanks Arian for Event Images!
 
Yes, I noticed that one conflict, and thought to myself:

"everybody hates battle effects anyway, no one is ever going to notice" and promptly merge LFB overtop.

Figures that someone would notice..
 
Yes, I noticed that one conflict, and thought to myself:

"everybody hates battle effects anyway, no one is ever going to notice" and promptly merge LFB overtop.

Figures that someone would notice..

What a relief that I'm not alone. I will Glider1 do the final merging later, if he decides to merge this modcomp to his mod in future. I will do what you and Voltage mentioned.
Thanks!
 
Back
Top Bottom