• 📚 A new project from the admin: Check out PictureBooks.io, an AI storyteller that lets you build custom picture books for kids in seconds. Let me know what you think here!

Attempt to give +2 Movement from a Civic in BtS (my painful path so far)

Baruna

Chieftain
Joined
Nov 4, 2024
Messages
10
Goal: Grant +2 max movement to units (initially Scouts, later all land units) when a specific civic (CIVIC_NOMADISM in the LEGAL category) is active.

1.- Python First Try
  • Learned quickly that XML alone cannot conditionally change unit movement based on a civic.
  • Tried Python in CvEventManager.py to adjust moves each turn.
    Ran into no-log issues: my CivilizationIV.ini in My Games\Beyond the Sword kept resetting and PythonDbg.log wasn’t generated.
  • Spent time toggling LoggingEnabled=1, HidePythonExceptions=0, etc., but the INI kept reverting. I paused Python debugging to attempt a DLL approach.
2.- VS 2008 Dead End
  • The community wisdom says: compile with VS 2008 / toolset v90 (or at least older toolsets like v141_xp).
  • I tried to obtain Visual C++ 2008 Express SP1 ISO:
    • Multiple official links now 404 or gone.
    • MSDN and mirrors were inaccessible or non-functional for me.
  • Considered VS 2013 alternatives, but I specifically needed VS 2008/v90 according to community wisdom.
3.- VS 2022 Toolset Hell
  • Installed Visual Studio 2022 Community and tried to build CvGameCoreDLL.
  • Boost and Python headers: hit errors like
    fatal error C1083: Cannot open include file: 'Python.h' and cannot open source file 'boost\python\object.hpp'.
    Fixed by placing Boost 1.32.0 correctly.
  • After that, hit template/STL errors:
    basic_ostream is not a template, etc.
    After a while, realised that this happens when using modern toolsets (v143) with very old code.
4.- Wrestling with VS 2022 Project Formats
  • My project opened as NMake (only showed General, Debugging, VC++ Directories, NMake).
    No C/C++, Linker, or Platform Toolset fields.
  • Created a new MSBuild C++ DLL project and imported .cpp/.h files.
    This finally exposed C/C++, Linker, etc.
  • Set up:
    • Includes: Boost-1.32.0, Python24\include, project dir.
    • Libs: Python24\libs; Additional Dependencies: python24.lib.
    • Runtime: /MT.
    • Defines: _MBCS, _CRT_SECURE_NO_DEPRECATE, _SCL_SECURE_NO_DEPRECATE, BOOST_NO_SCOPED_ENUMS, etc.
    • Tried to enforce Multi-Byte but no Character Set field visible in UI.
  • Still ran into compatibility issues because /std:c++98 isn’t exposed in v143, and Conformance Mode toggles werent available.
5.- Outcome

After hours of chasing toolset/version quirks (and dead VS2008 links), I parked the DLL approach. I’m now implementing a python workaround:
  • On game start: each turn, check if Nomadism is active.
  • For all land units: set baseMoves = vanillaMoves + 2 (and restore when civic changes), marking units to avoid stacking.
If anyone has a current source for VS 2008 or a toolset that compiles BtS 3.19 SDK on VS 2022, I’d love pointers. In the meantime, Python is keeping the project moving.
 
I recommend following this guide for compiling the DLL.

I am not sure if DLL is even needed to implement a feature like this. I would recommend:
  1. Creating a promotion to assign the extra movement, e.g. PROMOTION_NOMAD. Extra movement from promotions is already supported, e.g. the Morale promotion.
  2. Using event handlers: from what I can tell you need
    1. revolution(iPlayer): Check if CIVIC_NOMADISM is the current civic, if so assign the promotion to all units of the desired type. If not, remove the promotion from all units. This assumes that the promotion is only used to implement this civic effect
    2. unitBuilt(city, unit): Check if CIVIC_NOMADISM is the current civic of the unit owner, if so assign the promotion to it.
From how I understand it, that should give you all you need.
 
Back
Top Bottom