[MOD] Privateers, Pirates, and Buccaneers

I think your idea about Pirate Hunters is good. We need a way to kill flotillas and squadrons in those cases where a colony can build one or more.

I haven't seen many Pirate Hunters in the current game, and my recollection is that I could sink them fairly easily. Is that incorrect?

I think Pirate Hunters should be kind of mirror images of Flotillas. You could even change the terminology and speak of Pirate Flotillas and Hunter Flotillas. Likewise with Squadrons.

Also, maybe depart from history and have the colony able to build its own Hunter Flotillas in much the same way that Pirate Flotillas are built. Maybe Hunters should recover loot on pirate ships.

Thinking about game balance is making my head hurt, it's so complex, and I don't want to make too long a post here. I see three major issues in the mod. The first is this Flotilla thing we're discussing here.

The second is the knife-edge balance of the early game, where a single incident can make the pirates or merchants get the upper hand for a very long time, or permanently.

The third is the victory conditions. The focus of the Privateers mod is really different from vanilla Colonization. I think the focus is the fight between colonies and between the Pirates and the Merchants; Europe really doesn't have that much to do with this. In regular Colonization the aim is to declare independence from Europe and win the resulting war. The Privateers in the mod--do they really add a help to a colony in this overall aim? Or are they more a distraction--something that makes it harder to win against Europe? Just that much more to do in the limited time available. If that's true, maybe the initial and victory conditions in the Privateers mod should differ from vanilla Colonization.

I don't want my post to be too long, or to discuss too many different areas. I will see if I can find something intelligent to say about issues two and three in separate posts.

I slowly have been working on the next update. I do believe I have upgraded the current Pirate Hunters if not I will be sure to do that so they will be something to fear.

I have been thinking of creating a leveling system for Naval Ships as well. But in the mean time I could add in a Pirate Hunter Promotion that you could give to your Navy ships. This promotion would greatly increase their chances vs Pirates. That one addition could balance things out perhaps.

Also, the Spanish currently don't have a Buccaneer Captain you can play as.. I was actually thinking of adding in the Pirate Hunter Pedro de Menendez de Avilles as a Leader for Spain. Sense Spain was mostly the target of pirates back in the day it would seem to fit to add an anti-pirate as a leader. Pedro would also seem to fit as he actually founded a colony named St. Augustine which he used as a base and routed (executed) the French pirate Huguenots at Fort Caroline. He would have bonuses vs Pirates of course.

And yes I been thinking on new Victory conditions for this Mod as well. One victory condition could be to amass a certain amount of pirated loot by a certain date. Also, similar to the Revolution but on a different theme you could seek to gain a certain amount of Pirate Affiliation before time expires. Once you do, one of the other kings could declare war on you and send his forces to wipe out your pirate empire. You then must survive the ensuing onslaught.

K, thanks for your feedback. Hopefully I can get an update finished this weekend or by the first of next week.
 
I finally got the next update uploaded, version 0.5f.


Changes for v 0.5f

-Fixed several bugs
-Freebooters now get a bonus to growing Sugar
-The Kings's Pirate Hunter has Combat Str of 10 and 100% bonus vs Pirates
-New Promotion for Naval units "Pirate Hunter" which gives 100% bonus vs Pirates

Play test this version and let me know if the changes help to balance things out please.
 
Patch V 0.5g
This patch fixes a bug where Privateersmen where getting double missions successful when attacking. Also, Missions successful should be award if a ship is captured. The changed source code is included. Just replace the old .dll with this new one in patch.

Patch Link: http://forums.civfanatics.com/attach...1&d=1261765861
 
Is the patch now part of the main dl or do i still need some sort a patch?
Looks like a great mod. Definatly going 2 dl.

Arrrrrrr!!! Me maity and There she blows. Harrharr. etc...
 
Hey Kailric,

I'll say this again: Definitly the most fun mod around!!

But... I've got some bugs to report. I've seen here some people have had CTDs when loading saved games, that and others happend to me too...

I first got a CTD when leaving a game to the main menu so I looked into the logs. You've got some audio errors there that should be easy to fix... Here are the details:
[74580.875] ERR: FAudioManager::GetAudioTagIndex(): Could not find string SND_GREAT_CAPTAIN of TagId 0
[74580.875] ERR: FAudioManager::GetAudioTagIndex(): Could not find string SND_REALLY_BAD_EGGS of TagId 0
[74583.296] ERR: FAudioManager::GetAudioTagIndex(): Could not find string ASSS_COASTAL_PIRATE_HAVEN of TagId 5
[74584.109] ERR: FAudioManager::GetAudioTagIndex(): Could not find string AS3D_OTTOMAN_SELECT of TagId 4
[74584.109] ERR: FAudioManager::GetAudioTagIndex(): Could not find string AS3D_OTTOMAN_ORDER of TagId 4
[74584.109] ERR: FAudioManager::GetAudioTagIndex(): Could not find string AS3D_OTTOMAN_SELECT of TagId 4
[74584.109] ERR: FAudioManager::GetAudioTagIndex(): Could not find string AS3D_OTTOMAN_ORDER of TagId 4
And there's also these errors in the logs:
RESMGR: Texture Environment_Light-1.dds failed to load
RESMGR: Texture Environment_Light-1.dds failed to load
RESMGR: Texture teamcolor.bmp failed to load
I played for a while, saved and came back later but couldn't load my save game. I fixed the audio errors but still couldn't load any save games so I compiled a debug dll and started debuging.

I got this first Assert msg while loading the game:
Assert Failed

File: CvGlobals.cpp
Line: 2685
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type UNIT_PLUNDERED_TREASURE not found, Current XML file is:

modules\privateermod\privateermod_civ4unitinfos.xml

Seems like that unit type is missing... I fixed that and started debuging again and got these msgs:
Assert Failed

File: CvPlayerAI.cpp
Line: 7891
Expression: false
Message:

Assert Failed

File: CvUnit.cpp
Line: 14927
Expression: false
Message: Unit can not have profession

Assert Failed

File: CvUnit.cpp
Line: 15896
Expression: pTransportUnit->cargoSpaceAvailable(getSpecialUnitType(), getDomainType()) > 0 || getYield() != NO_YIELD
Message: Cargo space is expected to be available

Assert Failed

File: c:\program files (x86)\2k games\firaxis games\sid meier's civilization iv colonization\mods\privateer_mod_v0.5g\cvgamecoredll\CvPlayerAI.h
Line: 24
Expression: ePlayer >= 0
Message: Player is not assigned a valid value

Assert Failed

File: CvInitCore.cpp
Line: 1456
Expression: eID < (32)
Message: Index in CvInitCore::getCiv expected to be < 32

I think you have some debuging left to do... BTW I'm playing v0.5g
 
Is the patch now part of the main dl or do i still need some sort a patch?
Looks like a great mod. Definatly going 2 dl.

Arrrrrrr!!! Me maity and There she blows. Harrharr. etc...

You need the patch at the moment.


@ Aymerick

Thanks for the debugging info. I need to get what you got and learn how to use it to help debug this stuff so what do you have and how do I get it :)

I'll look into all the bugs you reported and make the changes asap.
 
Ok thanks.
i lost my rar reader when my comp was rebuilt recently, so ill have to ask my dad what happened to it (and all my saves:sad:).
 
Hey Kailric,

Sorry I haven't kept the savegame, but every game I played ended the same way...

So for everyone's benefit here are some how-to's on logging and debugging:

Logs:
First open the "CivilizationIV.ini" in the "\Documents\My Games\Sid Meier's Civilization IV Colonization" folder, look for "LoggingEnabled" and set this to 1.

You may also want to change the CheatCode to "chipotle". Then by hitting the "~" key it'll open the console and there are many useful commands there. "Console.CreateDocumentation string fileName" will write all those in a file. I find the "Game.AIPlay int iNumTurns" the most useful.​
Debugging:
I saw that you made your own logging system there Kailric. In debug mode you won't need that since you can replace those and add your own assertion and they will popup if conditions aren't met.

I'm using Visual Studio 2008 pro (Express works the same...).

So, first download Makefile/Instructions BTS 3.17 SDK/Debugging and I'm posting the Makefile I've made here where you can put the link to your mod's folder so the the dll will be copied there automaticaly.

Follow those instructions on how the setup the project.

But for running the debugger I have a better way:
  1. Open the project's properties.
  2. Make sure you have the Configuration drop down menu set to debug.
  3. Goto "Configuration Properties/Debugging".
  4. Put those values in there:
    • Command: Path to the "Colonization.exe"
    • Command Arguments: mod=\Your mod folder
    • Working Directory: Path to the "Sid Meier's Civilization IV Colonization" folder
    • Attach: No
  5. Build your solution in Debug.
Once your solution is built, you can start the game directly from VS and add a Breakpoint anywhere you want the Debugger to stop. If a Assertion fails VS will break there.

Exemple:
  1. Open your CvDLLButtonPopup.cpp and go to the line #958, the "case BUTTONPOPUP_RETURN_HOME:" in the "OnOkClicked".
  2. Add a Breakpoint there (F9 or Debug menu/Toggle Breakpoint).
  3. Next Start Debugging (F5 or Debug menu/Start Debugging), the game will load so you can start a new game and play a little until you can hit the Return Home button for one of your unit.
  4. Once the Breakpoint has been hit the game freeze and you have VS taking over.
  5. In the menu, Debug/Windows/Locals. In this window you can see the values of the variables declared. You can also add a Watch to a specific variable you need to follow.
  6. When a Breakpoint is hit you have 3 options (that follows the yellow arrow) :
    • Step Over (F10), will follow the code one step at a time.
    • Step Into (F11), will step into the function called.
    • Step Out (Shift+F11), will step back so you can see where you came from or where the function was called.

I'll let you try this, let me know if you need help. I could also send you my project if you're having problems setting it up...

Aymerick
 

Attachments

  • Makefile_Col_1.01f.zip
    5.9 KB · Views: 134
Thanks Aymerick, I'll be working on installing and figureing this out over the next few days. Just wondering, I use CodeBlocks can that be used instead of Visual Studio 2005 Express?

I've never used CodeBlocks, but from what I know it should allow the same Debug as VS... I just don't now to get that to work, sorry...
 
Hey Kailric,

I think I found why I can't load savegames! It's the changes you made at the CvGameTextMgr::setYieldPriceHelp function...

The "else if (info.isCargo())" you added is hit by native players and the .getParent is invalid...

I made these changes and it seems to work fine:

Code:
void CvGameTextMgr::setYieldPriceHelp(CvWStringBuffer &szBuffer, PlayerTypes ePlayer, YieldTypes eYield, int iAmount)
{
	CvYieldInfo& info = GC.getYieldInfo(eYield);
	CvPlayer& kPlayer = GET_PLAYER(ePlayer);

	szBuffer.append(CvWString::format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), info.getDescription()));
	
	if (info.isCargo())
	{
		if (kPlayer.isYieldEuropeTradable(eYield))
		{
			CvPlayer& kParent = GET_PLAYER(kPlayer.getParent());
			szBuffer.append(NEWLINE);
			szBuffer.append(gDLL->getText("TXT_KEY_BUY_AND_SELL_YIELD", kParent.getYieldBuyPrice(eYield), kParent.getYieldSellPrice(eYield)));

			if (iAmount > 0)
			{
				szBuffer.append(NEWLINE);
				szBuffer.append(L"----------------------------");
				szBuffer.append(NEWLINE);
				CvWString szTempBuffer;
				int iTaxLoss = (iAmount * kParent.getYieldBuyPrice(eYield));
				iAmount = kPlayer.getSellToEuropeProfit(eYield, iAmount);
				szTempBuffer.Format(L" (%d%c)", iAmount, gDLL->getSymbolID(GOLD_CHAR));
				szBuffer.append(gDLL->getText("TXT_SELL_TO_EUROPE_PRICE") + L" ");
				szBuffer.append(szTempBuffer);
				szBuffer.append(NEWLINE);
				szBuffer.append(L"----------------------------");
				szBuffer.append(NEWLINE);
				iTaxLoss = (iTaxLoss * kPlayer.getTaxRate()) / 100;
				szBuffer.append(gDLL->getText("TXT_SELL_TO_EUROPE_TAX_RATE", iTaxLoss, kPlayer.getTaxRate()));
			}
		}
		else if (!kPlayer.isNative())
		{
			CvPlayer& kParent = GET_PLAYER(kPlayer.getParent());
			szBuffer.append(NEWLINE);
			szBuffer.append(gDLL->getText("TXT_KEY_CONTRABAND"));
			szBuffer.append(NEWLINE);
			szBuffer.append(gDLL->getText("TXT_KEY_BUY_AND_SELL_YIELD", kPlayer.getYieldBuyPrice(eYield), kPlayer.getYieldSellPrice(eYield)));
			if (iAmount > 0)
			{
				szBuffer.append(NEWLINE);
				szBuffer.append(L"----------------------------");
				szBuffer.append(NEWLINE);
				CvWString szTempBuffer;
				int iTaxLoss = (iAmount * kPlayer.getYieldBuyPrice(eYield));
				iAmount = iTaxLoss - ((iTaxLoss * kPlayer.getTaxRate()) / 100);
				iTaxLoss = (iTaxLoss * kPlayer.getTaxRate()) / 100;

				//iAmount = kPlayer.getSellToEuropeProfit(eYield, iAmount);
				szTempBuffer.Format(L" (%d%c)", iAmount, gDLL->getSymbolID(GOLD_CHAR));
				szBuffer.append(gDLL->getText("TXT_SELL_TO_EUROPE_PRICE") + L" ");
				szBuffer.append(szTempBuffer);
				szBuffer.append(NEWLINE);
				szBuffer.append(L"----------------------------");
				szBuffer.append(NEWLINE);

				szBuffer.append(gDLL->getText("TXT_SELL_TO_EUROPE_TAX_RATE", iTaxLoss, kPlayer.getTaxRate()));
			}
		}
	}

	szBuffer.append(ENDCOLR);
}

Also, the "case YIELD_MUG:" is missing in the "CvPlayerAI::AI_isYieldForSale" function...
 
Cool man, thanks. Yeah its tough when you are not the original coder trying to figure out all the extra rules that you may not realize is apparent. I am really busy with real life and other projects this week but soon I'll be finished up with most things and I'll be able to concentrate on this project and the Whaling project too.

Thanks again for the bug report and fix.
 
DLed still trying to get my rar reader to work.:crazyeye:
 
will do, thanks
 
...the Spanish currently don't have a Buccaneer Captain you can play as.. I was actually thinking of adding in the Pirate Hunter Pedro de Menendez de Avilles as a Leader for Spain.

Sounds good!

It does seem, tho, that since the Spanish were the most despicable colonizers, and pirate are despicable, the Spanish should have a big mean pirate-in-chief. It seems to be true historically, tho, that piracy was kinda fostered by government-sponsored privateering, and the English were the worst. Any serious historians able to set me straight on this? (Once, decades ago, I was a grad student in Medieval History--This is not my period.)
 
Top Bottom