Archids Slavery Mod

Archid

Warlord
Joined
Oct 30, 2009
Messages
296
Location
North Wales, UK
Archids Slavery Mod

Synopsis
Expands the slavery civic to allow slavers to go out and grab slaves from your rivals...or friends. The captured slaves can be put to work either in a city or in the fields around.

This mod started as moving the Slaver Promotion mod by frekk (http://forums.civfanatics.com/showthread.php?t=325513) into the SDK as I wanted to improve the slave AI so that its higher build rate wasn't wasted on things that could be built quickly by ordinary workers. Once started I then decided to expand on it somewhat so though the concept is pretty much the same the way it works is different.

Download
The file is available for download at CF here

Gameplay
A new Slaver combat type has been created so that not all units can capture slaves. There are 3 units of this type which are upgradable based on spearmen, macemen & infantry for the advancing eras. Each of the unit types is slighty less powerful than its base unit, but has the advantage that it is invisble to most other units, with Recon and other Slavers being the only ones who can see them. Slavers also have hidden nationality and can move into both enemy and friendly territory capturing slaves without starting a war.

Slaves are captured by either fighting another unit and winning, or being present in a stack that wins a battle. Capturing a slave does not immediately give you a slave unit, you need to take the slaver to a city with a slave market which must buy the slave first. Each slaver has a limited number of slaves that it can hold before it needs to offload some. There are promotions to increase the number of slaves that can be held and the more advanced slaver types have a higher base value. Animals and mechanical units cannot be enslaved.
Spoiler :

About to capture a Great Artist



The Slaver now has a captured slave



Take the Slaver to a city to sell your slave




Once a city has bought a slave it can either put it to work in the BFC in which case the unit will work at 500% the work rate of a normal worker, but will die once the improvement has been built. Alternatively the slave can be put to work in the city itself providing a boost to both food and production. If the slave was a Great Person before it was captured then they can be settled as a 'slave professional' where it is assumed that they assist similarly minded individuals, e.g. a Great Artist that was captured can be put to work in the city providing some culture, but less than a standard artist specialist. The exception to this is a captured Great General who would not typically help his acptors in military matters so can work as a normal slave. There is a configurable chance each turn that a slave working a city will die, with the chance for professional slaves being defined separately as they are more likely to be treated better. The chance of death scales with the game duration.
Spoiler :

Your new slave can now join the city as an enslaved artist



The city now has a new specialist




The cost of each slave to a city is configurable and increases by a configurable amount with each slave bought.

The number of slaves that can be settled in a city is configurable as a percentage of the city population, so for example you may need a city of size 2 before you can put a slave to work in the city itself. You can have any number of slaves working the BFC.

Slave markets are buildings that are available at Bronze Working and add a small production and happiness bonus to a city. They are also a pre-req for buying slaves from slavers. There is a National Slave Auction national wonder that provides a slave market in every city.

In order to build slavers, capture slaves with existing slavers, build slave mnarkets or for cities to buy slaves the civ must be running the Slavery civic. If you change out of this civic then slavers will refuse to move, only defending themselves and the slave markets will caese doing business with their happiness and production bonuses being lost. If you change back to the slavery civic then the slavers become happy again and the will markets start doing business again.
Spoiler :

Move out of Slavery civic



Change back to Slavery civic



AI
The AI knows how to use both slavers and slaves. For slavers it checks if it needs to offload slaves, or if it is in a city vicinity and is at least half full then it will offload them. It will pop goody huts if it finds them and hunts out slaves in a widening area. It will also join a stack that is hunting close by and will move a few places to join a stack that is going to attack a city. For slaves the AI will determine if there is a high-value improvement that needs to be built in the BFC and send the slave to do that otherwise it checks on whether to work the slave in a city in a similar way to the decision making around joining GPs. If it still can't find anything to do then it will be used in lower value improvments. Both units will retreat to a city if in danger.

Game Additions

Units
---------------
Slave - 500% worker work rate; can work in city or build improvement in BFC; dies after building improvement
Slaver - Based on spearman, can capture slaves, can hold 1 slave, invisible to normal units, visible to recon & slaver units
Slave Trader - Based on maceman, can capture slaves, can hold 2 slaves, invisible to normal units, visible to recon & slaver units
People Trafficker - Based on infantryman, can capture slaves, can hold 3 slaves, invisible to normal units, visible to recon & slaver units
Spoiler :

Slavers



Slave




Buildings
---------------
Slave market - +1 production, +1 happiness, can buy slaves from slavers, can put slaves to work in city
National Slave Auction - national wonder, slave market in every city

Promotions
----------------
Slaver I - Allows 1 extra slave, requires Combat I, only available to slavers
Slaver II - Allows 1 extra slave, can move on enemy roads, requires Slaver I, only available to slavers
Slaver III - Allows 1 extra slave, +1 movement, requires Slaver II, only available to slavers

Modders
Changed SDK files are included and commented with Archid

Added XML tags
-------------------
++ BuildingInfo
bSlaveMarket - true if this building acts as a slave market. Allows slaves to be bought in this city
PrereqAndCivics - All of these civics must be in use in order to construct the building.
PrereqOrCivics - One of these civics must be in use in order to construct the building.

++ CivicInfo
bAllowsSlavery - true for civics that allow slavers & slave markets to operate.

++ PromotionInfo
iEnslaveCountChange - Increases the number of slaves that a slaver may hold

++ UnitInfo
bSlave - true for slaves
bSingleBuild - true for units that die after they have built an improvement. Has no meaning if there are no <Builds> configured for the unit
iEnslaveCount - The number of slaves that a Slaver unit has captured ready to sell to a city
PrereqAndCivics - All of these civics must be in use in order to build the unit.
PrereqOrCivics - One of these civics must be in use in order to build the unit.
SlaveSpecialistType - the type of city specialist that is produced if this unit is captured by a slaver and sold as a slave

Credits

- frekk for the original mod idea, plus the buildings
- Little Red Point for the slave skins
- Sabotleigh for the slaver unit
- unit icon by the frenchman
- sell slave mission icon baseb on work by the frenchman
- SDK code from Afforess
 
Thanks for the comments guys

I have some more idea that I would like to incorporate such as following emancipation, or some other trigger, any slaves, both city and BFC varieties, are freed and will take one of 3 options:

1 - Settle in nearest city as citizens (city slaves convert to non-slave specialist variety)
2 - Become immigrants and move to settle in a another city
3 - Decide to leave your civ and disperse (die)

Not fully thought it out yet but I decided that I had enough implemented to make a worthwhile mod without this yet
 
Wow marking this for future use, slaves will play a big role in my fallout mod...if I ever fix this freaking code issues :p and this sounds like an awesome slaves component exactly the kind of thing that would work great for me!

have you thought about merging this with the specialist enhacement mod that allows speacilists to create happiness and heaalthy (and the negative opposite) so that slaves could generate unhappiness/unhealthiness, so you have to manage them carefully and apply mitigators in large slave cities, you could also create a slaver specialist that generates happiness (as an offset to the slaves) these are all elements I want to eventually add to my mod, but I thought they might work well with this too, and I could maybe pinch the code when it is done :p
 
Thanks for your comments, I am glad that someone may find this useful.

With regard to releasing a version merged with the specialist enhancement mod, I would prefer not to for a couple of reasons:
  1. I don't see slaves themselves as directly modifying the happiness/healthiness of a city. Citizens tend not to be unhappy when they don't need to do the unpleasant jobs themselves :) and any unhealthiness tends to come from the work being done rather than who actually does it.
  2. I packaged this as a full mod so that people can try out the functionality easily and it it really intended as a component in a larger mod. As such I would prefer to keep it as 'clean' as possible.

The '# of slaves / city size' settings should prevent cities from have too large populations of slaves. I have commented the Slavery_GlobalDefines.xml file with an example so hopefully it is clear how this setting works, let me know if it is not clear enough; the 'worked to death chance' setting should keep acquiring new slaves relevant.

Of course if you change these to allow unlimited slaves then there would need to be some form of external control mechanism for game balance. Maybe adjusting the likelihood of an event such as the the Slave Revolt to make it proportional to the number of slaves in a city could be used for this, and having a slave master specialist that reduces the chance of a revolt would also fit in here. I already have 11 creatable specialists on my main mod so I tend to shy away from creating any more as I would have no room to display my resources on the city screen !

Let me know what you think as I could probably add some of these ideas in a new version if it is going to be used by someone. As I am still working on my main mod I would prefer not to take the time out to implement and test these changes purely as an academic excercise though :)

In the main mod that I use I have implemented a version of the specialist enhancements mod so if you have any issues merging it let me know as I may be able to help.
 
RFC mods are moving towards using slavery alot. Perhaps guys like Leoreth and sprt could take a look at your work :dunno:
 
Am I right in thinking that your 'Great Specialist Slaves' are just contolled in xml?

So if I wanted to remove that feature it would just be a case of removing them from the specialistinfo and changing the great person slave tag in unitinfos to NONE? or would the none be changed to the 'generic slave' or is the generic slave (the one that provides food and production) not a specialist?

Is it instead a one off boost to food and production?
 
The UnitInfo <SlaveSpecialistType> tag is optional and if it does not exist the slave specialist type provided is defined in Assets\XML\Slavery_GlobalDefines.xml using the SLAVERY_DEFAULT_SLAVE_SPECIALIST value. The default for this is SPECIALIST_CITIZEN_SLAVE, which is the standard slave specialist. As a specialist it provides a food and production point each round until it dies.

The easist way to disable the Great Specialist Slaves is to remove the SlaveSpecialistType tag; to totally delete them you would also remove their entries from CIV4SpecialistInfos along with the referenced dds file. Make sure you don't accidentally delete the SPECIALIST_CITIZEN_SLAVE entry when you are removing the GP slaves as it appears in the file between the Artist & Engineer Slaves
 
what changes were made to the CvCityAI.cpp file?

I can't find any archid labels?

EDIT: I think something has gone weird with my search function, it is just not finding them now in files...it was working a minute ago grrr!! exploration continues :) ok fixed it!!

now I just have to figure out how I merge these two bits of code that want to overwrite each other hmmm. ok speed bump cleared (I hope!)
 
Hi, trying to merge this with K-Mod, just finished merging all the SDK files, but I get these error messages when compiling:

Spoiler :
1>CvCity.cpp
1>CvCity.cpp(52) : error C2065: 'm_pabDisabledBuilding' : undeclared identifier
1>CvCity.cpp(116) : error C2065: 'm_paiSettledSlaveCount' : undeclared identifier
1>CvCity.cpp(376) : error C3861: 'm_paiSettledSlaveCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(376) : error C2541: 'delete' : cannot delete objects that are not pointers
1>CvCity.cpp(376) : error C3861: 'm_paiSettledSlaveCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(376) : error C3861: 'm_paiSettledSlaveCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(389) : error C3861: 'm_pabDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(389) : error C2541: 'delete' : cannot delete objects that are not pointers
1>CvCity.cpp(389) : error C3861: 'm_pabDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(389) : error C3861: 'm_pabDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(534) : error C2065: 'm_iSlaveMarketCount' : undeclared identifier
1>CvCity.cpp(666) : error C3861: 'm_pabDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(687) : error C3861: 'm_pabDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(719) : error C3861: 'm_paiSettledSlaveCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(737) : error C3861: 'm_paiSettledSlaveCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(1071) : error C3861: 'doSlaveDeath': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(2133) : error C2039: 'isReplacedByBuildingClass' : is not a member of 'CvBuildingInfo'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvInfos.h(1565) : see declaration of 'CvBuildingInfo'
1>CvCity.cpp(4020) : error C3861: 'isDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(4058) : error C2039: 'isSlaveMarket' : is not a member of 'CvBuildingInfo'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvInfos.h(1565) : see declaration of 'CvBuildingInfo'
1>CvCity.cpp(4058) : error C3861: 'changeSlaveMarketCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(5315) : error C3861: 'isDisabledBuilding': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(11383) : error C2039: 'getSlaveMarketCount' : is not a member of 'CvCity'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvCity.h(29) : see declaration of 'CvCity'
1>CvCity.cpp(11384) : error C2270: 'getSlaveMarketCount' : modifiers not allowed on nonmember functions
1>CvCity.cpp(11385) : error C3861: 'm_iSlaveMarketCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(11389) : error C2039: 'changeSlaveMarketCount' : is not a member of 'CvCity'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvCity.h(29) : see declaration of 'CvCity'
1>CvCity.cpp(11390) : error C2365: 'changeSlaveMarketCount' : redefinition; previous definition was a 'formerly unknown identifier'
1>CvCity.cpp(11393) : error C3861: 'm_iSlaveMarketCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(11397) : error C2039: 'isSlaveMarket' : is not a member of 'CvCity'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvCity.h(29) : see declaration of 'CvCity'
1>CvCity.cpp(11398) : error C2270: 'isSlaveMarket' : modifiers not allowed on nonmember functions
1>CvCity.cpp(11398) : error C2365: 'isSlaveMarket' : redefinition; previous definition was a 'formerly unknown identifier'
1>CvCity.cpp(11399) : error C3861: 'm_iSlaveMarketCount': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(11402) : error C2039: 'canSettleSlave' : is not a member of 'CvCity'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvCity.h(29) : see declaration of 'CvCity'
1>CvCity.cpp(11403) : error C2270: 'canSettleSlave' : modifiers not allowed on nonmember functions
1>CvCity.cpp(11406) : error C3861: 'isSlaveMarket': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(11411) : error C2039: 'getSLAVERY_CITY_SLAVE_RATIO' : is not a member of 'CvGlobals'
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvGlobals.h(161) : see declaration of 'CvGlobals'
1>CvCity.cpp(11411) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 38 error(s), 0 warning(s)


Is this actually a problem in the Cvcity.cpp file, or will it be being caused by an error somewhere else?

I have checked through the file and cannot find anything that I have missed?

Any help on figuring this out would be much appreciated!
 
The undeclared identifier error usually means that the variable or method hasn't been declared in the associated .h file

The following block should be at the end of CvCity.h
Spoiler :

PHP:
/****************************************
 *  Archid Mod: 21 Apr 2012
 *  Functionality: Slavery - Archid
 *		Building provides slave market
 *	Source:
 *	  Archid
 *
 ****************************************/
public:
	int getSlaveMarketCount() const;
	void changeSlaveMarketCount(int iChange);
	bool isSlaveMarket() const;
	bool canSettleSlave() const;
	void changeSettledSlaveCount(SpecialistTypes eSlaveSpecialist, int iChange);
	int getSettledSlaveCount(SpecialistTypes eSlaveSpecialist) const;
	int getSettledSlaveCountTotal() const;
	int getSlaveCost(int iNumSlaves) const;
	void doSlaveDeath();

protected:
	int m_iSlaveMarketCount;
	int* m_paiSettledSlaveCount;
/**
 ** End: Slavery
 **/
 
Are you sure the code block is inside the class definition?

PHP:
...
	void doSlaveDeath();

protected:
	int m_iSlaveMarketCount;
	int* m_paiSettledSlaveCount;
/**
 ** End: Slavery
 **/

}; /* The code needs to be before this closing brace */

#endif
 
If you send me over your CvCity.h file I will have a look.

The other thing to check is that the changes to the CvCity.h file are being picked up. Have you tried to do a Clean before you do the build?
 
No I haven't done a clean, not sure how I would do that? Not certain what it is :-D

There are a bunch of .bak files appearing amongst the files which I have never seen happen before, like city.h.bak, could this be an issue? I have never seen it happen before with my other attempts at compiling a .dll

I attached all the cvcity files, as it was not much just incase it helps.

Thanks for taking the time to have a look for me, really appreciate it, this slavery mod will be great in my game I think :-D
 

Attachments

  • New WinRAR archive.rar
    292.5 KB · Views: 119
I don't know what you are using to compile the code, but in VC++ 2008 there is a Build->Clean Solution menu item that will do the job.

What is does is remove all the intermediate files forcing it to reread all the source code in order to recompile everything again.
 
Aha! that helped now we are down to just 3 errors!

Spoiler :
1>------ Build started: Project: CvGameCoreDLL, Configuration: Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> "C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /Og /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files\WindowsSDK/Include" /I"C:\Program Files\WindowsSDK/Include/mfc" /YcCvGameCoreDLL.h /Fo"Release\_precompile.obj" /c _precompile.cpp
1>_precompile.cpp
1>c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvGlobals.h(1382) : error C2535: 'int CvGlobals::getDefineINT(const char *,const int) const' : member function already defined or declared
1> c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\CvGlobals.h(1288) : see declaration of 'CvGlobals::getDefineINT'
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\K-Fallout\Assets\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I also attached the CvGlobals.h file as that seems to be the problem one now. I think I have added something a bit wrong, but I don't really know!

Again thanks for help!
 

Attachments

  • CvGlobals.rar
    9.5 KB · Views: 71
Top Bottom