• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

Submarine Warfare Mod

NP300

Prince
Joined
May 18, 2004
Messages
402
Location
North America
I think many would agree that the naval aspect of cIV is a bit lacking. I personally find the implementation of submarine warfare to be boring. Submarines are invisible but if a ship has the SeeInvisible flag it has 100% odds of seeing the submarine. I find this 100% certainty to be dull. A better way to capture the nature of submarine warfare would be to give ships like destroyers a chance of seeing the subs, say 50%. I think this would make the hunt for subs a lot more fun. If I recall correctly this is how it worked in Civ 2.

I am thinking of using something like the existing SeeInvisible and Invisible flags.

Variable Explanation:

D= DetectInv = DetectInvisible = SeeInvisible
I = Invisible
detectprob = Probability of the sub being seen.
invprob = Probability of sub not being seen.
Evidently: invprob = 1 - detectprob

The following rule could be used:

START

If D - I > 0 then detectprob = 1 = 100%

If D - I < -1 then detectprob = 0 = 0%

Else detectrob = 1 + D - I

END

Comments:

Detectprob represents the odds of the submarine being seen by a given unit. Notice that if SeeInvisible=1 and Invisible=1 then the odds of being seen are 100%. The same is true if both are zero. This is as the game currently exists.

The interesting part comes from different values for D and I. The odds of the submarine being detected are determined by the difference between D and I. If we want a Destroyer to have 50% odds of seeing the sub then D = 1 and I = 1.5.

Now, I also want promotions to improve the odds of destroyers seeing subs and to improve the odds of subs remaining invisible. I might want to create a 10% bonus promotion. So I could have an "anti-submarine" promotion which would modify the D from D=1 to D=1.1. Now the Destroyer's odds of seeing the sub would be 1 + 1.1 - 1.5 = 0.60.

I might also have a promotion for submarines. It may be "invisibility". Then we might have odds of being detected by a destroyer of detectprob = 1 + 1.0 - 1.6 = 0.40.

Anyway, I hope you get the idea. I want the detection of subs to have around 50% odds (or any other percentage). And I further want to be able to modify these odds with promotions.

In addition, I want to give subs bonuses against surface ships, bonuses to destroyers versus subs, and perhaps bonuses versus aircraft. Ideally the "surface ship" and "submarine" categories could be created in a manner similar to that for "melee" units and the like. Then bonuses could be applied to such broad groups.

What I want to know is if any of this can be implemented in Python. I suspect this is not doable with Python and that the SDK will be necessary.
 
Ok, now that the SDK is out, could any of the C++ wizards clue me in as to where is the code that controls whether or not a unit is invisible?

I'm guessing there must be some code that checks both, the "invisible" and the "seeinvisible" flags. The invisibility is determined based on this. If both are 0 then the unit is visible. If both are 1 the unit is also visible. If seeinvisible=0 and invisible=1 then it's invisible, and so on and so forth.
 
Back
Top Bottom