Final Frontier (Plus) Starbase Missile-Spawn Removal

Shnoof

Chieftain
Joined
Apr 22, 2010
Messages
13
I want to remove the ability starbases have that allow them to spawn missiles every 15 turns. I find it very irritating as they keep waking up my starbases and clutter up my unit lists. Plus they are almost useless (unless in huge quantities). I have searched through all the XML files, but have found nothing related to that. Would it be in the DLL files?
 
It is done in Python, actually.

In CvFinalFrontierEvents.py is a function called updateAllStarbases, starting on line 489 of the file. This function not only causes the missile production, it is also involved in the starbases' territory claiming feature.

There are a variety of things you can do to sabotage the function so that missiles will not be produced. Here is a simple one.

Lines 508-514 look like this:
Code:
			for iUnitLoop in aiPossibleUnitList:
				
				pUnitInfo = gc.getUnitInfo(iUnitLoop)
				iNeededTech = pUnitInfo.getPrereqAndTech()
				
				if (pTeam.isHasTech(iNeededTech)):
					iUnitToCreate = iUnitLoop
You can just comment out all these lines, so that they look like this (just adding a # character at the beginning of each line):
Code:
#			for iUnitLoop in aiPossibleUnitList:
#				pUnitInfo = gc.getUnitInfo(iUnitLoop)
#				iNeededTech = pUnitInfo.getPrereqAndTech()
#				
#				if (pTeam.isHasTech(iNeededTech)):
#					iUnitToCreate = iUnitLoop
Quick and easy to do. It will also actually make the starbase updates run slightly faster (almost certainly not noticeable though).

Or, if you prefer, here is a completely "cleaned" version of the function. It removes all the various pieces of code related to producing the missiles. Remove the old version of the function and put this much shorter version of the function in its place. This also has the advantage of running even a little faster that the other change (still probably not noticeable even if there are a lot of starbases).

Code:
	def updateAllStarbases(self):
		
		# Update Starbase culture
		# List made to preserve culture of units built first
		aaiStarbaseList = []
		
		for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):
			pyPlayer = PyPlayer(iPlayerLoop)
			
			apUnitList = pyPlayer.getUnitList()
			for pUnitLoop in apUnitList:
				if (pUnitLoop.isStarbase()):
					aaiStarbaseList.append([pUnitLoop.getGameTurnCreated(), iPlayerLoop, pUnitLoop.getX(), pUnitLoop.getY()])
					
#		printd("\n\nXXX: There are %d Starbases on the map" %(len(aaiStarbaseList)))
#		printd(aaiStarbaseList)
			
		if (len(aaiStarbaseList) > 0):
			
			# Make order such that units built first get culture preference
			aaiStarbaseList.sort()
#			aaiStarbaseList.reverse()
			
			for iStarbaseLoop in range(len(aaiStarbaseList)):
				self.updateStarbaseCulture(aaiStarbaseList[iStarbaseLoop][1], aaiStarbaseList[iStarbaseLoop][2], aaiStarbaseList[iStarbaseLoop][3])

Although I must disagree somewhat with you about how useful missile are. They are not great, but a single missile can cause around 15% damage to a unit that is not in a city (or even one that is, especially if the squadron defense network is not present in the system - it doesn't say so, but it reduces missile damage just like it does squadron and nuke damage), give or take. That is not bad. Even 3 or 4% is not bad - it is certainly better than nothing, and it can shift your odds significantly. Using a few free missiles is better than loosing any other ship if you want to keep your fleet moving forward. I like to include at least one cruiser with my invasion fleets (typically with Upgraded Repair Staff and and Upgraded Storage Bay or 2) - missiles (like squadrons) can be rebased to units anywhere, including in enemy space, so a cruiser can fire it's missiles and then be replenished on the same turn and ready to launch a full load again on the next turn. With the AstroTech Destroyer class UU, the Missile Frigate, you may not even need the cruiser. You can avoid the support related costs for them by using them (when you are not at war, you can use them against pirate ships - this is especially useful when the pirates start showing up with delta destroyers and you haven't even researched a prereq tech for the one that lets you build them yourself, which happens to me fairly often).
 
I'll add this as a gameoption to the next version of FF+ (a "No Starbase Missiles" option)- even though I agree with God-Emperor that missiles are useful, if you did want to stop them from spawning you'd need to edit Python files to do it.
 
Well, I've only ever played against the AI in FF+. Usually I amass 40-50 missiles before war breaks out, a few on each base. Seeing how my starbases are on the frontier and the first line of defense, I can only use whats at each base (can't rebase missiles to starbases, only planets). Since the AI stacks the attack force, it's not very useful lobbing 5-6 missiles at 7-10 battleships doing 11% damage without collateral. Compared to bomber squadrons which do collateral damage, they are very weak. I guess they are a little bonus to defenses, but the constant pressing of 'f' all the time gets a little annoying.

This is the only mod I've played where an item is made for free periodically. Perhaps you can make missiles buildable by the starbase (aka worker builds an improvement style) that takes 15 turns to complete. This way you still have the option to make missiles every 15 turns if you want.
 
You wouldn't happen to be playing on Marathon speed would you?

The starbase missile production does not scale with game speed. I'm thinking that it should.
 
This is the only mod I've played where an item is made for free periodically. Perhaps you can make missiles buildable by the starbase (aka worker builds an improvement style) that takes 15 turns to complete. This way you still have the option to make missiles every 15 turns if you want.

No, as I said, I'm going to make it be a gameoption. If you don't like it, turn it off when starting a game. Because if anything, manual construction of missiles would be even more micromanagement for the people that like them.

You wouldn't happen to be playing on Marathon speed would you?

The starbase missile production does not scale with game speed. I'm thinking that it should.

Yes, it should. Will be done in the next version.
 
Yes, it should. Will be done in the next version.

The code for this is pretty simple, as I expect you already know.

All in CvFinalFrontierEvents.py:

In the initValues add a line that looks like this:
Code:
		self.iStarbaseMissileTurns = (15 * gc.getGameSpeedInfo(gc.getGame().getGameSpeedType()).getTrainPercent() + 99) / 100
This uses the iTrainPercent value from CIV4GameSpeedInfo.xml, which is the game speed scaling for unit building, and rounds all fractions up. This keeps standard speed at 15, quick uses 11, epic uses 23, and marathon uses 30. Due to rounding up, quick and epic are effectively slightly slower than proportionate.

In updateAllStarbases change these lines
Code:
							# Produce Missile every 15 turns
							if (iTurnsSinceCreation % 15 == 0):
to this
Code:
							# Produce Missile every self.iStarbaseMissileTurns turns
							if (iTurnsSinceCreation % self.iStarbaseMissileTurns == 0):

Your game option to turn this off will need to be checked and applied in updateAllStarbases as well.
 
Back
Top Bottom