Mod-Modders Guide to Fall Further

Modular Python:

I put this one first because it isn't possible. It might be some day, but it isn't yet and I personally don't plan to make it possible any time too soon.

Is there much interest in this? I've looked at the code and it doesn't look that difficult to refactor CvEventManager to handle a modular approach. In fact, someone has already made an attempt, only you're not using it.

The biggest hurdle I foresee is adding new text keys to the xml. I suspect that needs dll work and invoking the unholy incantations of C is where I draw the line.

I'd need a list of strings that can be aggregated with modular loading. Like, for instance, the starting promotions of units; only strings.

With the spell system already being possible to abuse for modular loading, that should cover most of the of the use-cases for modding. The only thing I can think of that is left out is random events.
 
You don't need to use DLL to add Text Keys, plenty of the Lair Exploration features are already using TXT_KEYs which aren't referenced from anywhere else.

Not sure what you are saying about needing the list of strings to be honest.

Previous attempts to implement modular approaches to python have all been semi-modular, they had a single file which you had to place re-directs in or something along those lines. And each of them has been a fairly significant performance hit even when not used.

Spells and events are the most python heavy areas in general, but what modders find themselves wanting to use python for the most often is actually the numerous callbacks in EventManager (note, Events are done in RandomEventManager), or tweaks to screens, most notably CvMainInterface. If the approach doesn't offer access to changing or overriding those files as well, you still can't claim to have made python completely modular.


But yes, if you can figure out a method which makes at least SOME of python easier to mini-mod, that is not a significant hit to performance, it would be lovely.
 
I imported the relations symbols on the scorebox and when editing my Font something odd happened. My city screen displays the ATTITUDE_FURIOUS symbol instead of the UNHAPPY symbol if the city grows over the happy limit on the city bar.
 
[/QUOTE]

You don't need to use DLL to add Text Keys, plenty of the Lair Exploration features are already using TXT_KEYs which aren't referenced from anywhere else.

Not sure what you are saying about needing the list of strings to be honest.
Yes, I've noticed that TXT_KEYs can be added willy-nilly. But I need add one TXT_KEY_MODULAR_PYTHON in one module, and then add a TXT_KEY_MODULAR_PYTHON in another module, and of course there needs to be one, or a few, in base Fall Further as well.

I'd only be able to get at one of those strings, I need access to them all. In order of mod priority, so I can tell which mods are supposed to overwrite the other ones.

I suppose some sort of naming convention could be used, if there is a way to access all keys. I could get all TXT_KEYs, filter away any that don't start with TXT_KEY_MODULAR_PYTHON, take the ending digits as a priority and consider the middle part the name of the module.

Previous attempts to implement modular approaches to python have all been semi-modular, they had a single file which you had to place re-directs in or something along those lines. And each of them has been a fairly significant performance hit even when not used.

You do realize that you are not-using one of those attempts, right?

Anyway, yes if some file needs to be merged when installing mods, it's not modular.

Performance could be an issue, but I'm hoping to make up for some of that by avoiding the mass of if-elif-elif... statements. Or even worse, mutually exclusive if-s. No way to find out other than trying.

Spells and events are the most python heavy areas in general, but what modders find themselves wanting to use python for the most often is actually the numerous callbacks in EventManager (note, Events are done in RandomEventManager), or tweaks to screens, most notably CvMainInterface. If the approach doesn't offer access to changing or overriding those files as well, you still can't claim to have made python completely modular.

I'm looking at callbacks in the event manager. The whole point of events is nearly to make things modular in the first place.
 
Ok... I sort of see where you are going with the text key thing. Why not just add a string variable to the XML which is used specifically for your modular loading? Going through TXT_KEYs is a workaround, so by definition not a proper approach for the long-term.

Yes, I realize I am not using any of the previous attempts to make python modular, because none have succeeded yet, to a degree I am comfortable with at least.
 
Why not just add a string variable to the XML which is used specifically for your modular loading?

Because I've assumed it would require dll work. If you're telling me it doesn't, I can probably find out how to do it.

Yes, I realize I am not using any of the previous attempts to make python modular, because none have succeeded yet, to a degree I am comfortable with at least.

Maybe I'm not being clear. You are in fact using a modular event manager, but none of the code is written to benefit from it. You are still paying the fixed costs of CvCustomEventManager.

They're not great costs, just the price of iterating over a 1 length list.
 
No, adding a variable to the XML will require DLL work.

I see that we still have CustomEventManager now, I assume it is left over from when we had integrated BUG straight up. Far as I can tell we don't actually use it for anything except Civ4Lerts. Not that I am looking close right now though.
 
Do you know how to check in the python files whether a module has been loaded or not ?
I would to do as proposed by Xienwolf and add such condition before every part I modded so that it may later be incorporated in the main mod :) (for Dagda's Tear)
 
Check for a value which was added by your Module is the easiest way. Look at the bottom of the Spell Interface file for how I did that with Bannor Chain of Command. I run a check to see if gc.getInfoTypeFor('PROMOTION_CORPORAL') is non-negative. If so, that means there is a promotion called Corporal, which there shouldn't be unless my module is active.
 
Ok, I'll do so with the new race promo, it should do the trick. Thanks as always.
 
Hello, i don't understand function the passive training function. Someone has a link for explain me?
Thank you.
 
If a unit who has the proper UnitCombat type (Melee, Archery, Mounted...) stays in the city tile with one of those buildings, they will gain a small amount of XP each turn until they reach the limit stated on the building.
 
Thank you. For exemple, do you know the needed turns number to bring a warrior with no XP to the maximum XP trainable in a Training ground?
 
Ive made an Eidolon thats dwarf sized, basicly a (very badly) re-skinned palladin however im having trouble getting it working in game.
I tried this code in UnitArtStyleInfos
Code:
		<UnitArtStyleTypeInfo>
			<Type>UNIT_ARTSTYLE_KHAZAD</Type>
			<StyleUnits>
				<StyleUnit>
					<UnitType>UNIT_EIDOLON</UnitType>
					<UnitMeshGroup>
						<EarlyArtDefineTag>ART_DEF_UNIT_EIDOLON_KHAZAD</EarlyArtDefineTag>
						<LateArtDefineTag>ART_DEF_UNIT_EIDOLON_KHAZAD</LateArtDefineTag>
						<MiddleArtDefineTag>ART_DEF_UNIT_EIDOLON_KHAZAD</MiddleArtDefineTag>
					</UnitMeshGroup>
				</StyleUnit>
			</StyleUnits>
		</UnitArtStyleTypeInfo>
also swapping KHAZAD for LURCHIP and DWARF as well as all three but in game, either WBing them in or upgrading from a pre-existing unit, just gives the usual model.:confused: However if i change the race from demon to dwarf the new graphics appear.

The code in ArtDefines is:
Code:
        <UnitArtInfo>
            <Type>ART_DEF_UNIT_EIDOLON_KHAZAD</Type>
            <Button>Art/Interface/Buttons/Units/Eidolon.dds</Button>
            <fScale>0.35</fScale>
            <fInterfaceScale>1</fInterfaceScale>
            <bActAsLand>0</bActAsLand>
            <bActAsAir>0</bActAsAir>
            <NIF>Modules\NormalModules\Dans\DwarfEidolon.nif</NIF>
            <KFM>Art\Units\Unique_Sumeria_Vulture\Unique_Sumerian_Vulture blood.kfm</KFM>
            <ShadowDef>
                <ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>
                <ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
                <fShadowScale>1</fShadowScale>
            </ShadowDef>
                <fBattleDistance>0.35</fBattleDistance>
                <fRangedDeathTime>0.31</fRangedDeathTime>
                <bActAsRanged>0</bActAsRanged>
                <TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
            <AudioRunSounds>
                <AudioRunTypeLoop/>
                <AudioRunTypeEnd/>
            </AudioRunSounds>
            <SelectionSound>AS3D_DWARF_SELECT</SelectionSound>
            <ActionSound>AS3D_DWARF_ORDER</ActionSound>
        </UnitArtInfo>
    </UnitArtInfos>

Any ideas?
 
A dwarf sized eidolon doesn't make sense anyways. They're supposed to be demon lords from aeron's vault, if I recall correctly. Even if a dwarf became an eidolon, he probably wouldn't look dwarf sized when he came out.
 
It's entirely possible the question this post seeks to ask can be answered with a link to a previous post or thread, in that event forgive me please for not knowing it's location ahead of time.

That out of the way, to possibly begin a journey down the mod path, I believe it would help me to learn the jobs of the different coding.

When is -the oh so evil- python or -the benevolent and forgiving- XML used, and for what? Are they interchangeable in all/no/some situations? Does the Civilopedia exclusively use XML and combat mechanics exclusively use python? To tweak features here and there would I need to be fluent in both languages, or would a healthy knowledge of just one of the two allow domination over most of the possible modding?

Thanks, with many basket-fulls of health and happiness resources.
 
Well, you can do quite a bit with XML. New units, buildings, resources, etc. Python is needed for more advanced functions... Most spells, for example. You can get by on just XML, but eventually you'll want to do something needing Python, so I'd say knowledge of both is important.

Python is actually pretty easy to pick up, and ther's no shortage of people willing to answer questions you might have.
 
Top Bottom