Pazyryk
Deity
- Joined
- Jun 13, 2008
- Messages
- 3,584
Well, I compiled and tested my own CvGameCore_Expansion2.dll, so now it's time to get down to business...
I thought I'd lay out my dll plans so folks could give feedback. This is for my total conversion mod, Éa, so the dll itself is not meant to be useful to other modders, though I'm happy if the code is. I'll probably hard-code a few changes, particularly regarding civilian unit stacking. The only constraint is that I need to be able to test the dll in autoplay in an otherwise unmodded BNW game.
I'm new to C++, but program in a few different scripting languages. The model I'm following is Gedemon's RED, using his excellent GitHub page (have other dll modders done anything like this?). I'll eventually set up a similar page for Éa's dll. I've listed all the critical needs for the mod below. I'm most interested in starting with the civilian movement constraints. Breaking civilian 1upt is critical for the mod, but I also think it is an utterly pointless and downright annoying feature in base Civ5.
I've color coded by my current estimate of difficulty: Easy, Medium or Hard. Blue = Done!
Part 1: Civilizations
New GameEvents:
GameEvents.CanMeetTeam(iTeam, iTeam2) Prevents any contact; war state can't be changed.
GameEvents.CanContactMajorTeam(iTeam, iTeam2) Prevents most per turn interactions among AI civs (e.g., trade) and leader popup for human; DoW is possible (by unit move for human) but peace deal is not.
GameEvents.TechResearchMod(iPlayer, techID) Accumulator, so different effects can add/subtract. Expects signed integer, which is interpreted as percent research modifier.
New Lua methods:
void player:ChangeCivilizationType(civID) Runs PreGame.SetCivilization() and a full Traits reset
void player:ChangeLeaderType(leaderID) Runs PreGame.SetCivilization(), player:SetPersonalityType(), and a full Traits reset
Part 2: Civilian Stacking and Great People Changes
New GameEvents:
GameEvents.GPCanOccupyPlotWithEnemyUnit(iPlayer, iUnit, iEnemyPlayer, iEnemyUnit)
GameEvents.GPCanEnterForeignCityAtWar(iPlayer, iUnit, iCityOwner, iCity)
New Lua methods:
bool unit:CanEnterCity(city)
void unit:ChangeUnitCombat(iCombatStr, iRangedStr, iUnitCombat) --to make a GP into combat unit, then back to civilian with args 0, 0 ,-1.
Part 3: Miscellaneous
I thought I'd lay out my dll plans so folks could give feedback. This is for my total conversion mod, Éa, so the dll itself is not meant to be useful to other modders, though I'm happy if the code is. I'll probably hard-code a few changes, particularly regarding civilian unit stacking. The only constraint is that I need to be able to test the dll in autoplay in an otherwise unmodded BNW game.
I'm new to C++, but program in a few different scripting languages. The model I'm following is Gedemon's RED, using his excellent GitHub page (have other dll modders done anything like this?). I'll eventually set up a similar page for Éa's dll. I've listed all the critical needs for the mod below. I'm most interested in starting with the civilian movement constraints. Breaking civilian 1upt is critical for the mod, but I also think it is an utterly pointless and downright annoying feature in base Civ5.
I've color coded by my current estimate of difficulty: Easy, Medium or Hard. Blue = Done!
Part 1: Civilizations
- Add table Civilization_Traits that acts in conjunction with Leader_Traits. Works! Civs can have traits too!
- Change civilization type in-game. Using method below.
- Change leader type in-game. Using method below.
- Control of civ meeting and contact. Via two new GameEvents below.
- New column in Civilizations: FallbackCityListCivType. Needed because mod has >100 Civs, but uses primarily 3 very long city lists (1 per race). It's "fallback" so civ-specific city names will be used if provided.
- Modify research rate for Techs via GameEvents accumulator. Easy I guess because I can imitate the current city number effect.
New GameEvents:
GameEvents.CanMeetTeam(iTeam, iTeam2) Prevents any contact; war state can't be changed.
GameEvents.CanContactMajorTeam(iTeam, iTeam2) Prevents most per turn interactions among AI civs (e.g., trade) and leader popup for human; DoW is possible (by unit move for human) but peace deal is not.
GameEvents.TechResearchMod(iPlayer, techID) Accumulator, so different effects can add/subtract. Expects signed integer, which is interpreted as percent research modifier.
New Lua methods:
void player:ChangeCivilizationType(civID) Runs PreGame.SetCivilization() and a full Traits reset
void player:ChangeLeaderType(leaderID) Runs PreGame.SetCivilization(), player:SetPersonalityType(), and a full Traits reset
Part 2: Civilian Stacking and Great People Changes
--Hard-coded rule changes for civilian stacking:- All civilians can stack without limit on land, but only one can build on a plot at a time. --Done!
- Civilians can stack with units of other civs if not at war. --Done!
- Civilians can enter foreign cities if not at war --Done!
--GP-specific stuff - GPs can enter a plot with an enemy unit with a GameEvents check. --complicated capture issues
- GPs can enter an enemy city with a GameEvents check. --as above
- GPs can convert between non-combat and combat role by new Lua method
- GPs can stack with combat units even if they are combat units themselves (and both units can attack from same plot)
New GameEvents:
GameEvents.GPCanOccupyPlotWithEnemyUnit(iPlayer, iUnit, iEnemyPlayer, iEnemyUnit)
GameEvents.GPCanEnterForeignCityAtWar(iPlayer, iUnit, iCityOwner, iCity)
New Lua methods:
bool unit:CanEnterCity(city)
void unit:ChangeUnitCombat(iCombatStr, iRangedStr, iUnitCombat) --to make a GP into combat unit, then back to civilian with args 0, 0 ,-1.
Part 3: Miscellaneous
- Bypass leader scenes (mod supplies own images/framing via standard UI lua/xml modding) I'm 60% done with this but it is nighmareishly hard. Most communication between Dll and Lua is via UI (which we don't have) and that is where the leader scene gets triggered. So I have to rebuild all those lines of communication with new Lua methods (Lua->Dll) and GameEvents (Dll->Lua).
- Rivers allow internal city connection with a tech.
- GameEvents.OnUnitCapture(iCapturePlayer, iOriginalOwner, iUnitTypeID). Return of false prevents capture from happening.