Quick Modding Questions Thread

[...] Despite having a fresh install and simply copying my mod from my PC to my laptop. Because the current cacophony of all 'religion-has-spread-to-a-city'-sounds playing immediately at once upon ending a turn is very annoying. And indeed, on my PC they play staggered, like what you describe.
And, without loading any mod, you haven't had this problem on your laptop? What DLL does your mod use? Figuring out how and why your hardware or OS might affect the timing of the audio is a scary task, so I'd sooner look at the differences between your mod and the original game (assuming that the original game works as it should).
I found a reference to AS3D-tags within the missionaries' _activate.kf-files, per the link from my post, but I don't think that does anything (or at least, nothing that I can discern). [...]
If I open that .kf file in a text editor, I see the strings SOUND:AS3D_UN_BUDDIST_MISS_ACTIVATE and SOUND:AS3D_UN_BUDDIST_AHH2 in there. Those probably refer to BuddistMissActivate.wav and BuddistAhh2.wav in the Sounds folder of the base game. I don't recall when I've heard those in the game, but it's not the chant that plays when Buddhism is spread – that's Sounds\BuildingsBuddhistDink.wav, the sound referenced by CvCity::setReligion (via Civ4ReligionInfo.xml, Audio2DScripts.xml and AudioDefines.xml). I guess the sounds in the kf play right before the chant when the human player activates the Spread mission on their turn.
 
And, without loading any mod, you haven't had this problem on your laptop? What DLL does your mod use? Figuring out how and why your hardware or OS might affect the timing of the audio is a scary task, so I'd sooner look at the differences between your mod and the original game (assuming that the original game works as it should).
As it turns out, vanilla Beyond the Sword immediately quits to desktop when I press 'play' (see attached ThemeParseLog, but I don't overtly care about that), but randomly loading the Charlemagne mod included in the base game does work, and there I immediately hear the religion sound when I spread Christianity into my cities.

My mod uses RevolutionDCM's DLL, as attached (it >might< be modified? Very unsure, I myself am not capable of doing so, but maybe someone else did it for me at some point? But again, the DLL wouldn't have changed between my PC and my laptop), and I simply copied the entire RevolutionDCM folder from my PC, to Google Drive, to my laptop, while installing Beyond the Sword through Steam (and opting into the unsupported 'beta' version, which is necessary to make the game properly display the state religion of a player on the list of players at the bottom right of the screen). I checked if the game found any patches, but no.
If I open that .kf file in a text editor, I see the strings SOUND:AS3D_UN_BUDDIST_MISS_ACTIVATE and SOUND:AS3D_UN_BUDDIST_AHH2 in there. Those probably refer to BuddistMissActivate.wav and BuddistAhh2.wav in the Sounds folder of the base game. I don't recall when I've heard those in the game, but it's not the chant that plays when Buddhism is spread – that's Sounds\BuildingsBuddhistDink.wav, the sound referenced by CvCity::setReligion (via Civ4ReligionInfo.xml, Audio2DScripts.xml and AudioDefines.xml). I guess the sounds in the kf play right before the chant when the human player activates the Spread mission on their turn.
This is fully correct on all counts - I replaced the references to refer to the Dink-sounds, but still didn't hear them the way I am used to.
 

Attachments

Well, this is incredibly curious - literally since going in-game of vanilla Beyond the Sword (I count Charlemagne as part of this), the sounds work normally. How can such an effect possibly happen?
 
Maybe some seemingly unrelated options difference? You have BUG, right? Stack Attack comes to my mind, but just an idea. Anyway, I'd compare those settings.
I do. I did initially get the errors of 'cannot locate settings folder' (or somesuch), and eventually got around to manually creating a UserSettings folder within my mod directory, after which I fiddled around with the BUG settings (Ctrl Alt O) to my liking.

I would assume that this did not fix my issue... But maybe if, after I did that, I went into Charlemagne, and after thàt, my problem was solved... Maybe. It could be. I can see if I can quickly figure it out when I am home again, I am curious now. I never let multiple missionaries spread their religion at once through stack attack, though, and also let them spread automatically to see if that maybe had different results. All of that didn't work - until I seemingly went into Charlemagne and back into my game (or, as such, maybe created the UserSettings folder and played around with the BUG settings).

At any rate, it works.
 
@need my speed: Apart from the BUG settings, the user profile (settings on the player options screen), CivilizationIV.ini and the XML/ file cache may differ between the two computers involved. I don't believe mods actually access the cache, and I don't see what setting in CivilizationIV.ini could've caused that audio issue. A BUG option or additional player option could, in theory, be responsible. I don't think RevDCM has such an option; in particular, looking at their latest source code, CvCity::setHasReligion does nothing unusual. But then, on that note, the DLL you've uploaded has a different size and more detailed file properties than the latest RevDCM DLL, so one can't be certain what your DLL does.
At any rate, it works.
:yup:
 
Civ 4 and Warlords came with scenarios like Desert War and Genghis Khan, is there any way to play these in BTS?
 
Thanks. It looks like for the rest of the Scenarios I'll just have play them in the expansion they came out for, thankfully OG Civ4 and Warlords are both on steam as standalone games.
Aye, it bummed me out to learn that unlike Civ3, the expansions aren't backwards-compatible. The game features were adopted by BtS, of course, but I often feel like Firaxis just kind of forgot about Warlords.
 
Is there a simple flag or switch to prevent/allow city building?
ie, something present (or can be added) to either a terrain, feature, or even improvement?

Put simply, I was thinking that if there was a simple fix to allow city building only on specific tiles, then i could (before starting the game proper) go through the map and preallocate all the city sites.
But I supposed the next question is whether this would even actually work for the AI? Would they still cuild their cities, on the allocated tiles, or would it just be ignored?
 
The source code of CvPlayer::canFound hints at the following possibilities:
• bNoCity in Civ4FeatureInfos.xml
• bFound [this one sounds promising for your purpose], bFoundCoast and bFoundFreshWater in Civ4TerrainInfos.xml
• Python callback (USE_CANNOT_FOUND_CITY_CALLBACK, cannotFoundCity) for arbitrary restrictions; could e.g. block specific plot coordinates or allowing founding only on Forts. Probably tricky to get this to work with a BUG-based mod.

The AI treats tiles where (according to CvPlayer::canFound) no cities can be founded as having a found-city value of 0. It should never place cities in such tiles.
 
Is there a simple flag or switch to prevent/allow city building?
ie, something present (or can be added) to either a terrain, feature, or even improvement?

Put simply, I was thinking that if there was a simple fix to allow city building only on specific tiles, then i could (before starting the game proper) go through the map and preallocate all the city sites.
But I supposed the next question is whether this would even actually work for the AI? Would they still cuild their cities, on the allocated tiles, or would it just be ignored?
If you search on posts of me in this thread, you will first find a few about adding a new religion, and then a few about exactly your question. I am not on my personal laptop, so I cannot give you the direct exact answers, but, they are there! If you have more questions, I can help. :)
 
Hi,

I've done some editting to the dll to allow different unitartstyles to be assigned to a civ/unit in different circumstances. The edits work (partially). The graphic in the bottom left of the screen correctly shows the alternative assigned unitartstyle. The unit in the game, however, continues to use the civ's default unitartstyle. This is the case, even if the unit is selected and moved. However, on saving and reloading the game the new alternative unitartstyle is correctly used by the units.

Is there some thing other than getUnitArtStyleType that needs to be reset/refreshed to make the graphics for the units refresh to use the newly assigned unitartstyles? If so, how do I do it?
 
@LPlate2: Don't know; maybe calling CvUnit::reloadEntity will help (when the conditions for using a different style become true). Or maybe some option on the Debug menu (Ctrl+D) will cause the graphics to be updated; then there'll still be the question of how to achieve the same effect programmatically.
If you search on posts of me in this thread, you will first find a few about adding a new religion, and then a few about exactly your question. I am not on my personal laptop, so I cannot give you the direct exact answers, but, they are there! If you have more questions, I can help. :)
Oh, I had already completely forgotten that – despite the rather lengthy back and forth; strange. Anyway, that's the Python approach, and it starts here:
https://forums.civfanatics.com/threads/quick-modding-questions-thread.351519/post-16173991
 
@LPlate2: Don't know; maybe calling CvUnit::reloadEntity will help (when the conditions for using a different style become true). Or maybe some option on the Debug menu (Ctrl+D) will cause the graphics to be updated; then there'll still be the question of how to achieve the same effect programmatically.
Thanks for the suggestions.
Tried the reloadEntity() and it didn't seem to be the answer. Had a look at the debug menu and could not see anything there to cause the graphics to be updated -The Unit Debug Menu just reemphasised that the incorrect art def is currently selected for the units in question.
 
Hi!
Do these logs tell anything about the reason of my game CTD?
At a certain point of the game it goes CTD at a given turn (Logs - CTD without anarchy). But if I change a civic and have an anarchy, the game goes on until I come out of anarchy and than it CTD (Logs - CTD after anarchy)
Any hints or suggestions? :confused:
 

Attachments

@LPlate2: For a quick test, I've now changed CvUnit::getArtInfo to this
Code:
const CvArtInfoUnit* CvUnit::getArtInfo(int i, EraTypes eEra) const
{
	UnitArtStyleTypes eStyle = (UnitArtStyleTypes)GC.getCivilizationInfo(getCivilizationType()).getUnitArtStyleType();
	if (GET_PLAYER(getOwner()).getCapitalCity() != NULL)
		eStyle = (UnitArtStyleTypes)0;
	return m_pUnitInfo->getArtInfo(i, eEra, eStyle);
}
and appended
Code:
int iIter;
for (CvUnit* pUnit = firstUnit(&iIter); pUnit != NULL; pUnit = nextUnit(&iIter))
	pUnit->reloadEntity();
to CvPlayer::setCapital. Then, if I start a new game as Shaka (whose BtS art style ID appears to be 3) and found a city, the 3D model of my starting Scout on the map changes to the "Asian" art style. Without the reloadEntity loop, nothing seems to change when I found my city; not on the map, not in the unit pane on the lower left. (Hiding and unhiding all unit entities through the Debug menu is no help either.) Are you sure that reloadEntity was called on your end (could set a breakpoint for the debugger to verify that)? Or maybe it only works in some circumstances. (And I've done my test with my own mod - for my own convenience. Shouldn't matter, but who knows.)

@<Nexus>: Without anarchy, the BBAI log for team 0 ends with
Player 45 (Romans Rep. of Neapolis) wary of French Provisional Government because of war memory 1
shortly after
Player 0 (Republic of Egypt) setTurnActive for turn 2376
and, with anarchy, that log ends with
Player 31 (Republic of Mali) wary of French Provisional Government because of war memory 1
shortly after
Player 0 (Egyptian Republic) setTurnActive for turn 2383
So both crashes appear to occur at the start of the human turn after updating AI strategies (CvPlayerAI::AI_getStrategyHash). But a lot of things could still happen, silently, in the DLL before the crash occurs; and it's not easy to tell when exactly the strategy update happens – because it's a cache that gets updated on demand. It might be feasible to narrow down the cause by inserting additional logging code, but, since you're able to compile a debug DLL, it should be much quicker for you to reproduce the crash with a debug DLL and the debugger attached (screenshot showing the config for that in VS). That should result in a break at the line of code (probably in the DLL) that causes the crash with the Call Stack window showing the function calls that lead there. Should only debug in windowed mode to avoid a freeze when a breakpoint is hit.
 
Do these logs tell anything about the reason of my game CTD?
Normally the best way to analyze a CTD is to debug with a savegame - it is the fastest and most reliable way to analyze a reproducable CTD.
So somebody would need to setup your code in Visual Studio, compile a debug DLL, attach to the running exe and load your savegame.

Analyzing CTDs with logs is often almost futile.
But with a debug DLL you can catch the CTD in action if it is reproducable with the save.

But of course it would need a programmer to be interested in the code and motivated to invest the effort to analyze.
Finding and fixing CTDs can still take hours - but having a savegame where it is reproducable really helps.
 
So both crashes appear to occur at the start of the human turn after updating AI strategies (CvPlayerAI::AI_getStrategyHash). But a lot of things could still happen, silently, in the DLL before the crash occurs; and it's not easy to tell when exactly the strategy update happens – because it's a cache that gets updated on demand. It might be feasible to narrow down the cause by inserting additional logging code, but, since you're able to compile a debug DLL, it should be much quicker for you to reproduce the crash with a debug DLL and the debugger attached (screenshot showing the config for that in VS). That should result in a break at the line of code (probably in the DLL) that causes the crash with the Call Stack window showing the function calls that lead there. Should only debug in windowed mode to avoid a freeze when a breakpoint is hit.
Thank you. I tried to run debug mode but I am so noob: I couldn't set it up properly, so it didn't even start. Your screenshot help me 1 step further but now I get this error:
1670964324604.png

and it loads BtS not CoM :confused:

BTW I tried googling on how to set up the debugger in VS properly but didn't find anything useful yet.

Analyzing CTDs with logs is often almost futile.
Thx, I didn't know that logs are that useless.
 
Back
Top Bottom