The 3.19 patch and what it means for SDK modders

Dom Pedro II

Modder For Life
Joined
Apr 3, 2002
Messages
6,811
Location
Exit 16, New Jersey
Friends, the Firaxis gods have smiled upon us and graced us with another patch! This one, like others, has given us new code exposed to the DLL.

The tyranny of the Gamefonts file is finally over! Yes, you'll still have to use it, but we now have a lot more control over it from within the SDK.

My overall impressions is that there's a lot of new functionality for modifying game sounds, some new functionality for messing with the interface, but nothing particularly earth-shattering beyond that. That said, given how much we've already got, I'm not sure we NEEDED anything earth-shattering.

Here's a more comprehensive list of the stuff that's been moved to the DLL (if anybody in the know thinks I missed something big or got something wrong, feel free to post it):

CvCity

getBuildingArtInfo
getBuildingVisibilityPriority

These two give you greater control over how cities look. Haven't really thought of any great applications for them... will probably be mod-specific.

getMusicScriptId
getSoundscapeScriptId

These affect city sounds. I'd like to tweak these myself because I want there to be a distinction between the sounds of coastal and inland cities. When you open a coastal city screen, you might hear seagulls, a boat horn, etc.

getBuildQueue

Not sure why you'd want to mess with this, but there it is.

CvPlayer

getIntroMusicScriptId
getMusicScriptId

With these two, I think you could actually now have different music play under different circumstances. It already does it based on peace/war and era, but you could make it so that it'll play different music based on the other player's state religion, civic, or anything else you can think of. Maybe not extremely useful in the standard game, but could be interesting for specialized mods.

getGlobeLayerColors
getTradeLayerColors
getUnitLayerColors
getResourceLayerColors
getReligionLayerColors
getCultureLayerColors

Controls the colors for different things on the maps.. Not sure why you'd want to mess with this, but there it is anyway.

getUnitArtInfo

This'll provide a fairly easy and straightforward way to have units look different based on religion or civics among other things.

CvPlot

getSoundScriptId

Controls the tile's sound. Takes the improvement sound first, if there's none, goes to feature, if no feature, it goes to terrain. Could be modified to have culture-specific sounds I guess.

get3DAudioScriptFootstepIndex

You can use this to set conditions for what kind of footstep noises should play.

getAqueductSourceWeight

Tweaking this would make the aqueduct appear in more rational or more insane positions I think

shouldDisplayBridge

Pretty self-explanatory. The only reason why I might think one would want to mess with this is if you wanted to make bridges something that had to be specifically built and thus open to targetting by pillaging, bombing or sabotage. I'm seriously considering it ;)

checkLateEra

This is obviously some kind of graphical display thing. It might be used to control the appearance of improvements?

CvUnit

getSelectionSoundScript

Want your Roman unit to shout in Latin when you click on him in the ancient era and in Italian when you click on him in the modern era? This is where you'd code that.

getLayerAnimationPaths

The greatest unexploited feature in BtS... the Layer Animation Paths. No Unit Maker that I know of has ever actually made units to take advantage of this fantastic feature. Previously, changing the layer animation paths was strictly reserved for promotions, but with this function exposed you can have it based on virtually any criteria you want.

isCombatVisible

Basically controls quick combat. Could use it to have certain types of units skip battle scenes even if the Quick Combat option isn't turned on

CvDLLInterfaceIFaceBase

setInterfaceMode
getInterfaceMode
getShowInterface
getMouseOverPlot

There some potential for some good interface changes with these... Being able to get the plot the mouse is currently over can be quite handy. I've already got some ideas about what I might do with this.

CvGameInterface

This file and the CvGameTextMgr have most changes made to them, and has potentially the most interesting new functionality.

getGlobeLayers
startFlyoutMenu
applyFlyoutMenu

Not sure, but I think the flyout menu concerns the bottom part of the screen... so the list of stuff you can build, draft buttons, hurry buttons, selecting units, etc.

getNewHighlightPlot
getPlotHighlightColor

More map stuff

getWidgetShow
There's two of these. One determines if a model should be shown in the civilopedia for a particular resource (prevents Hit Singles, Movies, etc. from showing on terrain). And the second determines if a water improvement is to be shown in water.

nextActivePlayer
Moves the next player in line to be the new active player.

getNextSoundtrack
getSoundtrackSpace
isSoundtrackOverride

More sound control

initSelection

Picks which unit to select first such as at the start of a new turn

shouldDisplayFlag

Controls when your player flag should appear at the bottom of the screen.

shouldDisplayUnitModel

Controls when your selected unit's model should appear at the bottom of the screen

shouldShowResearchButtons

Controls when your research options should appear at the top (like when you've finished research a tech)

shouldCenterMinimap

Controls when the map should be centered.

handleCityScreenPlotPicked
handleCityScreenPlotDoublePicked
handleCityScreenPlotRightPicked
handleMiddleMouse

This deals with mouse clicks on plots when the city screen is up. For me, this is very handy since I plan to make changes to how players manage their cities. Just how useful these functions will be I haven't determined yet.

handleDiplomacySetAIComment

Concerns diplomacy... not sure why you'd mess with this

CvGameTextMgr

getFontSymbols
assignFontIds

This is the meat and potatoes of the gamefont changes. If you want to add new stuff that will have a little icon associated with it that you want to appear in text, this is where you're going to mod it in. This does not pertain to adding new religions, corporations, yields, commerces, or general buttons like :strength:, :move:, or :gp:. That you've always been able to do. These functions would only need to be modified if you wanted totally new stuff like civilization languages, or political ideologies, or something along those lines.

getPlotHelp
getRebasePlotHelp
getNukePlotHelp

This provides a bit more flexibility for modders in determining what text they want to appear on the left-hand side of the screen when a player mouses over a plot. THis could be very useful if you want to provide more info to players when they're using interface modes (such as when you select an air mission and you see the air range and the target cursor appear). So if you wanted to, you could program it to tell you the odds of being intercepted on that particular tile if you wanted.

getInterfaceCenterText

This controls the text that appears in the middle of the screen when a player wins.

getTurnTimerText

Looks like this controls the game turn info? Thought that was done in python...

There's also a bunch of functions controlling text when in Advanced Start mode or World Builder, but I decided not to list them all.
 

Tholish

Emperor
Joined
Jul 5, 2002
Messages
1,344
Location
Japan
No DRM means it will become the standard on the appeal of that alone, so nothing for it but to upgrade.

Initially I just was going to post stating that while a lot of these new things are IN a couple of files are OUT, as in I couldn't find what looked like files that functions were calling for. It may just be my ignorance, though. First I tried to use winmerge to merge file by file from a copy of the new stuff into a copy of my old dll building folder, transferring anything that wasn't clearly marked for Revolutions or one of the minor changes I had made. The ultimate failure of this process led me to believe there were files missing from those provided...however, I took an old CvGameCoreDLL folder that worked for 3.17 and copied in all the files and it compiled and linked almost instantly. Mighty fishy. Made a mod with just ModFolder/Assets/DLL. Crash.

Started from scratch, took a copy of the new source files and followed Refars instructions for 3.17 and used his makefile for 3.17 just as I did for 3.17.

Got this:

1>CvArea.cpp
1>c:\Users\Tholish\Desktop\CvGameCoreDLL\CvGameCoreDLL.h(17) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
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:\Users\Tholish\Desktop\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========.


Sorry, didn't mean to change the subject from new features to how to recompile.
 

Dom Pedro II

Modder For Life
Joined
Apr 3, 2002
Messages
6,811
Location
Exit 16, New Jersey
Just try compiling the files that are in the Beyond the Sword folder and see if it works. If those don't compile, then they forgot something. I would except my computer has become infected with a virus and running Windows is a bit touch and go...
 

Tholish

Emperor
Joined
Jul 5, 2002
Messages
1,344
Location
Japan
I tried it. I copied the entire folder. I made this attached makefile. Still the same thing, it wants win.h, which as I recall from class is like a standard thing, wonder why it can't find it.

The call to it is in two places: FDialogTemplate.h and CvGameCoreDLL.h

In the latter it looks like this:
Code:
#include <windows.h>	// This is needed just for the LPCSTR, DWORD, and WORD typedefs
						// As a rule, I hate including windows.h in headers

Anyway, here's a list of the files that are totally new:

CvDllPythonEvents.cpp
CvDllPythonEvents.h
CvDllTranslator.cpp
CvDLLUtilityIFaceBase.cpp NOTE: presumably this replaces CvUtilityIFaceBase from 3.17, which is gone
CvEventReporter.cpp
CvMessagveControl.cpp
CvMessageControl.h
CvMesssageData.cpp
CvMessageData.h
CvStatistics.cpp
CvStatistics.h
CyMessageControl.cpp
CyMessageControl.h
and
CyMessageControlInterface
 

Tholish

Emperor
Joined
Jul 5, 2002
Messages
1,344
Location
Japan
Microsift VisualC++Express2005, with the 2003 toolkit and platform SDK.
I even tried looking for a Windows.h in the Windows directories, found one, stuck it in there, and it didn't work. I tried cutting out the references to it, and that snowballed--I would have to find some substitute.

EDIT: I reinstalled 3.17, started working on my mod again. I made DLL changes so global warming would be a feature rather than a terrain. Works great, so I want to share it as a modcomp by making a new DLL with just that. So I copy the original source folder out of the Bts folder, set it up and try to build. Same message about Windows.h. I look in my functional 3.17 dll modification folder, and lo and behold the same includes are there. They are not new with 3.19, something has changed about my setup.

ANOTHER EDIT: I got it compiled.
 

Maniac

Apolyton Sage
Joined
Nov 27, 2004
Messages
5,588
Location
Gent, Belgium
CvCity

getBuildingArtInfo
getBuildingVisibilityPriority

These two give you greater control over how cities look. Haven't really thought of any great applications for them... will probably be mod-specific.

I just tried the following as an experiment:

Code:
const CvArtInfoBuilding* CvCity::getBuildingArtInfo(BuildingTypes eBuilding) const
{
	//return GC.getBuildingInfo(eBuilding).getArtInfo();
	return ARTFILEMGR.getBuildingArtInfo("ART_DEF_BUILDING_COMMAND_NEXUS");
}

I assumed this would have made all buildings appear as the Command Nexus graphic.
Howsver nothing happens: all buildings still look their old self. So I'm wondering: did I do anything wrong, or is this function not actually able to modify graphics? :(
 

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,773
Location
London, UK
getLayerAnimationPaths

The greatest unexploited feature in BtS... the Layer Animation Paths. No Unit Maker that I know of has ever actually made units to take advantage of this fantastic feature. Previously, changing the layer animation paths was strictly reserved for promotions, but with this function exposed you can have it based on virtually any criteria you want.

What sort of thing would you use this for? Could you give some examples? Is it making the unit look different in different circumstances?
 

Kael

Deity
Joined
May 6, 2002
Messages
17,401
Location
Ohio
What sort of thing would you use this for? Could you give some examples? Is it making the unit look different in different circumstances?

Layer animation paths is the function that allows the units in the Afterworld scenario to look different based on the promotions they have. If the unit has one promotion he has a gun in his hand, if he has a different promotion he has a sword in his hand.

The model is created with all the variations in it and the promotions decide which variation is displayed. Theoretically you could have a flame aura around units that were on fire, a change to sniper rifle for units that picked a certain promotion, or the addition of missiles to your helicopter if they have a given ability.

The process to do this hasn't been easily understood either by the model makers or the modders and without any documentation on how to do it the few mods that want to do things like this just swap the models out instead of displaying/hiding features (so they use 2 helicopter models, one with the missile and one without and just change the entire model).
 

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,773
Location
London, UK
So I'm guessing, in the absence of documentation, that the best way to investigate this would just be to look at some Afterworld units and see how they are put together...

Promotions would seem like the most obvious application of this, particularly when you have hero/super units (like in FFH2) where the highly promoted form is much more powerful than the fresh out the box unit.
 

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
Thanks to deliverator for pointing me to this thread. About a year ago, I added some code to Fury Road (sig below) which swaps unit art based on promotions. So this is a working example of the "old way". The ute unit ("utility truck") has about six different variants based on which promotions it has.

I would be interested in any new technology on this. Fury Road may be useful as a testbench since the art is all there. The unit swapping is in python, specifically onUnitPromoted in CvFuryRoadEvents.py.
 

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,773
Location
London, UK
Maybe a good excuse for you to make the jump into SDK coding david? ;)
 

CyberChrist

You caught my attention
Joined
Dec 6, 2001
Messages
1,426
Location
The Matrix
My overall impressions is that there's a lot of new functionality for modifying game sounds, some new functionality for messing with the interface, but nothing particularly earth-shattering beyond that. That said, given how much we've already got, I'm not sure we NEEDED anything earth-shattering.

...

There's also a bunch of functions controlling text when in Advanced Start mode or World Builder, but I decided not to list them all.

Hmm, does any of those unlisted functions have to do with handling the layout and functionality of the Custom Game menu?

If not then moving the controls for that menu from the EXE to the SDK is imo something that we could really have NEEDED, since the Custom Menu has been in serious need of an overhaul for a long time.
 

lordmarcus1st

Chieftain
Joined
Aug 26, 2009
Messages
6
getInterfaceCenterText

This controls the text that appears in the middle of the screen when a player wins.

Any one knows how to get rid of this? Won a game and want to carry on but there&#8217;s a massive message across the screen getting in the way.
 

General Tso

Panzer General
Joined
Oct 12, 2007
Messages
1,547
Location
U. S. of A.
Set the value of strText to "" within getInterfaceCenterText would probably do it.
 

lordmarcus1st

Chieftain
Joined
Aug 26, 2009
Messages
6
Code:
void CvGameTextMgr::getInterfaceCenterText(CvWString& strText)
{
	strText.clear();
	if (!gDLL->getInterfaceIFace()->isCityScreenUp())
	{
		if (GC.getGameINLINE().getWinner() != NO_TEAM)
		{
			strText = gDLL->getText("");
		}
		else if (!(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).isAlive()))
		{
			strText = gDLL->getText("");
		}
	}
}

Didn’t seem to work.

I even deleted it all but still it’s on the screen.
 
Top Bottom