Author Topic: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche  (Read 4437 times)

0 Members and 1 Guest are viewing this topic.

Offline EmpathCrawler

Tested in the scenario editor under Thinker/Scient's patch. I suppose the boil's brood trainer can have a family, too...

The Datalinks are vague, though the wording of the Brood Pit's entry suggests that the morale effects should not stack.

Quote from: Datalinks
Acts as a Children's Creche for alien units, if there is not already one at the base.

I don't know if that language is original or from the included updated datalinks mod in Scient's patch.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #1 on: September 13, 2020, 08:57:59 PM »
I have multiple installations of SMAC on my computer.  Each one having its various patches and mods or whatever.  One that's pure and unaltered.  This is a good development practice if one reasonably anticipates doing some debugging.

There is no such entry in the original Datalinks, nor in any likely *.txt file I looked at.  I searched several files for the word "brood".

I haven't usually had reason to work with Scient's patch, as my modding is targeted at the official game installation.  It does not presume that anyone has done anything to the game binary or the various *.txt files at all, other than drop my *.txt files on top of it.  Nevertheless I do have a Scient's patch installation sitting around on my machine, from some thing I wanted to look at one month.  Like whether Scient's patch solved a particular bug I was interested in.  Anyways, examining helpx.txt the description of Brood Pit is clearly altered from the original.

So, some of the undocumented behavior anomalies of the Brood Pit were previously discovered.  And then, were they regarded as bugs or features.  And then, what Scient's patch would choose to do in the future.  And then, what would anyone else choose to do.

Offline EmpathCrawler

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #2 on: September 13, 2020, 10:46:18 PM »

There is no such entry in the original Datalinks, nor in any likely *.txt file I looked at.  I searched several files for the word "brood".


What is the unaltered Brood Pit entry? Would you quote it please?

Anyway, the language I found is also what the Alien Crossfire manual has to say:

Quote from: SMAX manual page 19
Acts as a Children’s Creche for native units, if there is not already one at the base. Decreases the cost of alien units built at the base by 25%. Gives the base a +2 Police rating. The Brood Pit is a place where alien life forms can be grown with relative ease. It also doubles as a punishment area. Becomes available upon discovery of Centauri Genetics (E7).


Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #3 on: September 13, 2020, 11:14:39 PM »
helpx.txt:
Code: [Select]
#; Brood Pit
#HELPFAC35
+1 $LINK<lifecycle=11> bonus to native units built here. -25% cost of alien units. Negative $LINK<LIFECYCLE=130004> effects
cancelled in base square. Base also receives a $LINK<+2 POLICE=130005> rating.

I can't at this time verify any "SMAX manual page 19".    My GOG installation contains Manual.PDF.  Page 19 is about something completely different, specifically what a "turn" in the game is.  Probably to be expected early in a game manual.  Searching for the word "brood" in fact yields nothing at all.  Looking at the entries under Facilities, it looks like Manual.PDF only documents SMAC, not Alien Crossfire.

I have a vague memory of the GOG version having some other files when I bought it.  Wonder where they are.

My GOG Galaxy isn't even working.  It's an older version of it.  I saw something on GOG's site the other week that they were releasing some new beta version of it.  Being a beta, I didn't want it.   Well maybe I'm forced.

Oh wait, here it goes.  "GOG is updating.  3%..."  It was so slow to react, that I thought it was dead, and had time to make this post.

Ok that was a little clunky and laggy, but I finally got a .zip of manuals downloaded into a somewhat obscure GOG Galaxy folder.  I've copied them to my "usual" GOG Games folder.  "Sid Meier's Alien Crossfire - manual.pdf", page 19.  Yep, it's as you quoted.
« Last Edit: September 13, 2020, 11:41:05 PM by bvanevery »

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #4 on: September 13, 2020, 11:21:08 PM »
So the updated Datalinks included with my patch are not my work. GooglyBoogly was the one at the time working on trying to revise/update them based on information from the community. I may have made some minor or small changes based on binary patches to allow for greater modding flexibility.

Also, I think in my readme I state that there is a fix for this issue but upon recent analysis this and two other fixes weren't applied to binary:
[BUG] Fixed the CC/BP combat bonus bug.
[BUG][EXPLOIT] Fixed the AI base trading exploit. (credit to kryub)
[EXPLOIT] Fixed the energy stockpile exploit. (credit to kyrub)

Lastly, I thought I had decompiled the functions related to this but it looks like I didn't (get_basic_offense/get_basic_defense). Doing that now. They look fairly straightforward.

Offline EmpathCrawler

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #5 on: September 14, 2020, 12:48:06 AM »
Awesome, thanks!

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #6 on: September 14, 2020, 05:39:45 AM »
Initial drafts. I'll do some testing tomorrow and finalize them then look for ways to fix buggy behavior.

https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L180
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L252

Offline EmpathCrawler

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #7 on: September 14, 2020, 09:40:19 PM »
Guess I should have learned C++ in school...

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #8 on: September 15, 2020, 04:03:31 AM »
A bit under the weather today. I'll set aside some time this week to work on code review and regression testing of these two functions. My guess is it will mostly be some minor clean up and optimizations. The code was fairly straightforward to decompile.

Let me know if you have any specific questions on what a line of code is doing.

The code causing double increase for offense is from here:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L199
To here:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L203

And for defense here:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L271
To here:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L275

Here are quick excerpts from text files and manuals.

SMACX Manual, pg 19; Brood Pit:
"Acts as a Children’s Creche for native units, if there is not already one at the base."

helpx.txt, line 1689-1690; Brood Pit:
"Negative LIFECYCLE effects cancelled in base square."

conceptsx.txt, line 247-248:
A unit with a "+" sign after its morale possesses a combat bonus from its location in a base with a Children's Creche.

SMAC Manual, pg 166; Children’s Creche:
All negative morale effects are cancelled for units in base square; instead such units receive a +1 morale modifier.

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #9 on: September 17, 2020, 04:24:19 AM »
Ran both functions through a battery of automated tests and corrected a couple of issues that are now live. The only thing left is the more in depth assembly regression checks I run everything through.

This is a great breakdown of issues:
https://web.archive.org/web/20160313051407/http://civgaming.net/smac/acad_morale.shtml

Basically, I think there are three main issues with the code.
* Brood Pit double bonus with Creche
* SE morale issues with CC
* Headquarters doesn't give defense bonus as stated in manual: SMAC pg 104 > "Units in a headquarters base automatically gain +1 Morale when defending."

If anyone can think of others, let me know. Still have some other threads to read through and piece together any other problems.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #10 on: September 17, 2020, 04:44:40 AM »
Wow the stock binary MORALE bugs for a Children's Creche are insane.  I'd heard about that, but I'd never seriously looked into it.  So -2 MORALE for Wealth can actually be a bonus!  Just wow.

Offline EmpathCrawler

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #11 on: September 17, 2020, 05:34:08 PM »
Ran both functions through a battery of automated tests and corrected a couple of issues that are now live. The only thing left is the more in depth assembly regression checks I run everything through.

This is a great breakdown of issues:
https://web.archive.org/web/20160313051407/http://civgaming.net/smac/acad_morale.shtml

Basically, I think there are three main issues with the code.
* Brood Pit double bonus with Creche
* SE morale issues with CC
* Headquarters doesn't give defense bonus as stated in manual: SMAC pg 104 > "Units in a headquarters base automatically gain +1 Morale when defending."

If anyone can think of others, let me know. Still have some other threads to read through and piece together any other problems.


I knew it was a mess from back in the day, but I forgot to what extent. There is also this page in the wiki here that duplicates some of that information while maybe adding more: http://alphacentauri2.info/wiki/Morale_(Advanced)

I just verified the lack of a Headquarters defensive bonus. Pretty minor, though it could marginally help out the AI in the early game against native life/Deirdre worm rush.

I couldn't make heads or tails of the Drone Riots effect on morale, either. It added a (-) symbol but with no apparent change to the battle odds math. Here's the check in your code:

https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L1956
« Last Edit: September 17, 2020, 07:41:30 PM by scient »

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #12 on: September 17, 2020, 11:04:04 PM »
Awesome! The wiki has a good outline of the issues. I think all or at least most of the problems with CC/BP and morale revolve around these two get_basic functions. Once I finish vetting code is 1-1 copy of original assembly, I'll try to summarize each issue, problematic code and suggest a way of fixing it via code. Once there is some kind of consensus, I'll apply/push fixes. It's nice that the project is getting to the point where I can work on some of these long standing problems at the code level.

I've started to go through existing references to CC/BP in code I've already decompiled and add comments what mechanic it's tied to. I figured this might be a good way to narrow down other potential problems. So far, haven't seen anything that's stood out other than this:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L1941
Basically, it's halving negative effects of the base morale of a unit based on its home base. So this is independent of whether unit is inside a base that has a CC or BP. Although, for BP it never reaches this area of code since it exits out here:
https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L1926

Yeah, I agree about HQ bonus. I don't really see this being left out as a balance issue since it's pretty narrow scope. My guess is just an oversight.

Offline scient

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #13 on: September 17, 2020, 11:12:49 PM »
I couldn't make heads or tails of the Drone Riots effect on morale, either. It added a (-) symbol but with no apparent change to the battle odds math. Here's the check in your code:

https://github.com/b-casey/OpenSMACX/blob/master/src/veh.cpp#L1956

Forgot to add break down of this code. So first it checks if that boolean parameter (checkDroneRiot) is set to true. Skimming through references, it looks like it's only set to false mostly on display code. Might end up renaming variable once more code is decompiled. Anyway, next it checks to see if the unit's home base is valid (I think it will be -1 for independent units). Then it checks to see if the home base has flag set indicating drone riots. Lastly, it checks to see if the faction rules MORALE variable is not set or false (!false == true).

MORALE = Morale modifier (if 0, indicates an exemption from negative modifiers from other sources).

If all these conditions are met, it subtracts 1 from morale local variable (--) then uses range function that basically bounds value between 0 and 6.


Offline EmpathCrawler

Re: Brood Pit's attacking-from-base morale bonus stacks with Children's Creche
« Reply #14 on: September 18, 2020, 03:51:52 AM »
Forgot to add break down of this code. So first it checks if that boolean parameter (checkDroneRiot) is set to true. Skimming through references, it looks like it's only set to false mostly on display code. Might end up renaming variable once more code is decompiled. Anyway, next it checks to see if the unit's home base is valid (I think it will be -1 for independent units). Then it checks to see if the home base has flag set indicating drone riots. Lastly, it checks to see if the faction rules MORALE variable is not set or false (!false == true).

MORALE = Morale modifier (if 0, indicates an exemption from negative modifiers from other sources).

If all these conditions are met, it subtracts 1 from morale local variable (--) then uses range function that basically bounds value between 0 and 6.

Bingo: Calling the range function in the riot check is a huge problem that actually isn't related to the Creche. If there is any reason for a unit to have negative morale penalties applied before the check, but its home base is rioting, the penalties will be voided because the range function in the riot check will reset the "morale" variable to 0, yes? Same if SE MORALE is net 0. Then the 0 will be applied to the unit's intrinsic morale from Veh[vehID].morale, returning the intrinsic morale unaffected.

With zero or negative MORALE SE, a rioting home base is better or the same as a peaceful one and a Creche doesn't matter:

-2 MORALE (morale = -1), no Creche, Drone Riot (morale = range(-2, 0, 6) = 0!!!), Disciplined = range(0+2, 0, 6) = 2 but really should be 0 (Very Green)
-2 MORALE (morale = -1), no Creche, no Drone Riot, Disciplined = range(-1+2,0,6) = 1 (Green, correct)

-2 MORALE (morale = -1), Creche (morale = 0 due to rounding), Drone Riot (range(-1,0,6) = 0!!!), Disciplined = range(0+2,0,6) = 2 but really should be 1 (Green) as that would be the Creche compensating for the morale negatives but not the riot.
-2 MORALE (morale = -1), Creche (morale = 0), no Drone Riot, Disciplined = range(0+2,0,6) = 2 (Disciplined, correct)

These values explain why somebody thought riots gave bonuses, which I suppose is true in a certain sense. The riot check should really apply a -1 modifier no matter what at the end of the morale calculation, I think.


Also, and this is unrelated to morale, but it is documented that the aliens get +1 RESEARCH in addition to PLANET from the Manifold Nexus (aka Temple?): https://github.com/b-casey/OpenSMACX/blob/defe36bdb1604c738f9cdf842ce1c8caabc456f1/src/faction.cpp#L720

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

You waited so long to heed us, earthdeidre,
Almost we pruned you, as we may yet prune your branches.
~Lady Deirdre Skye 'Conversations With Planet'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 39.

[Show Queries]