[MODCOMP] - XML Cleanup & Expansion

Yeah, I'll probably be too busy for modding for the rest of the term anyway. Still, you'd better have it ready in time for Vehem to incorporate it in Fall Further in time for me to download before August. :trouble: ;) I'm not sure what I'll do between the summer and fall terms (when I'll be stuck at home with dial-up) if I don't have a decent base for my modmod.
 
New version posted for patch L.

I have removed all the modcomps except for the Food from Animals (which is heavily modified from the original), and Bhruic's Tradefix.

No new fields, and no changes to previous fields. I do plan to go through and add some AI recognition of the value having these fields implies on each promotion. Seems that otherwise you need to set the iAIWeight or the computer will never take the promotion (unless you included normal tags too that is).

Re-formatted a few portions of the DLL so that WinMerge will recognize them as being new code, instead of heavily modified old code (which screws up the entire file beyond that point).

Comments are included for all changes in the XML in seperate text files. WorkerMod is included in this so that I have one less thing to keep updated on a regular basis :)
 
Version 1.11 posted.

Mostly it is adding Weights to the AI so that it will get Promotions that are appropriate without having to use Kael's iAIWeight field (brilliant, but doesn't allow for setting different weights based on the AI of the unit, so not quite perfect). I even added some weights for a few of his fields which I wanted to have the Worker Mod using already. I'll add in more weights as I get good ideas for precisely what value is appropriate, and tweak my own Weights as I decide my values and AI selections were inadequate.

New field added (well, finished up actually, it was already mostly done. Though I completely overhauled it in the end anyway). Now you can have a promotion make a unit cost their owner some gold per turn, or grant them bonus gold :) I think a great modification to the Khazad Worldspell would be adding this promotion to all current units for + 2 or 3 :gold: each :) Keep in mind that the field is MEANT to cost gold, so if you want to give gold back to the player, you need a negative value.


I also added some fields from previous versions to the first post. Seems I forgot to write up a couple of them. DurationAlter works like DurationChange, but cannot cause a permanent unit to gain a duration limit. EffectProm is something I initially wrote up as a lazy way of importing Promotion fields to the UnitInfos, but have only gotten halfway done with so far. Even at this halfway point though it works perfectly for many other uses which I have in mind (spell effects, Rituals, and the eventual Equipment Mod).
 
Turns out that the next 2 tags on my list were WAY too easy to implement, and that I didn't want to do the work I was supposed to be doing today. Thus I have posted 1.12 now as well.

CombatDmgCapBoost allows you to modify the damage limit of a unit a bit more flexibly than the current Promotion Tag. It could be nice to have a random chance for units from the Hall of Mirrors be capable of actually killing units, even though they are "just" illusions. Now that is possible.

iChanceMiscast can be positive or Negative. Thus you can have an anti-mage debuff (would be a nice addition to the Grigori to have a Building with a chance to apply this to any unit with Channeling or Divine in a certain radius), or you can have things like Metamagic 3 grant a guarantee of never miscasting a spell again.
 
So....care to look into making AirCombat strength be handled more like normal combat, where you can have different damage types and boost it by promotions?

And letting you change the cap with promotions?

And letting ranged units get some xp from their more successful attacks?

And getting this done in time for Vehem to add it to Fall Further before I get back to serious modding?

(I'm making Archers and siege units in my modmod use ranged attacks, and I'd really like to have promotions grant ranged Fire and Poison strength.)
 
:hmm: :undecide: Well, I still hope you add it eventually. I suspect that you can mostly just copy the code from normal combat, so it shouldn't be too hard (probably too hard for me though :dunno::help:)
 
Version 1.13 posted. No new toys this time, just new Shiny things.

Added a Game Option, it is posted AFTER all of Kael's hidden options, so it is very unlikely anyone else has a conflicting gameoption slot on another mod. It is visble and defaults to off, but I of course encourage that you turn it on and enjoy the new looks.

I will be refining the HUDs for each religion sometime, but for now I have discovered a new method for creating the pieces, and isolating new targets for conversion. Thus I am hoping to make these HUD changes far more complete than they are now, to include even changing the color of your Progress Bars.

I've also come across some code from Grey Fox which shows me how to update the screen based on mouse position, so I should be able to include buttons in the HUD changes in due time as well.

Anyone interested in making better HUDs, please let me know and I'll be quite happy to post the template I worked from for the re-coloring. It was almost a full day's work, but now with the grunt-work done I can change each HUD quite quickly/easily.

EDIT: Needed to relax before bed, so I colored the Tech Bars based on Religion as well. Remarkably simple as I expected it would be. Didn't define my own colors, and picked somewhat at random for now. I'll do something better at a future date, but these ones are passably decent. Re-uploaded under the same version number.
 
Couldn't sleep, made some HUDs. While I was working on it I decided to wait on posting them till the next major chunk of code so I could maybe get some feedback on the simpler models, but then I noticed that my new method of setting up the HUDs prevented manual selection of which tiles your city works.

So, new version posting now with that fixed and my new graphics. I am still sticking to the same shape as basic Civ HUD, so I hope it finds decent reception.
 
I really think you should look into adding making CIV4FeatureInfos.xml, CIV4TerrainInfos.xml, CIV4ImprovementInfos.xml, and CIV4BonusInfos.xml all have equivalent tags for everything that even remotely makes sense for them to have, just like you did with CIV4UnitInfos.xml and CIV4PromotionInfos.xml.



I think it would be really cool if tags like <iHealthPercent>0</iHealthPercent>, <iTurnDamage>0</iTurnDamage> (which would ideally be changed to allow different damage types), <PrereqStateReligion>NONE</PrereqStateReligion>, <RequireResist>NONE</RequireResist> (which would ideally be made so that you could require a different amount of resistance per feature, instead of always the same (20%) value found in GlobalDefinesAlt.xml), and <OnUnitChangeTo> were added to improvements, terrains, and bonuses, instead of just features. (<bFlamable> makes sense for improvements and bonuses too, although not terrains.) Also, features, improvements, and bonuses should get the equivalents of terrains' <iPlotCounterDown>0</iPlotCounterDown>, <TerrainDown>NONE</TerrainDown>, <iPlotCounterUp>9</iPlotCounterUp>, and <TerrainUp>TERRAIN_BROKEN_LANDS</TerrainUp> tags. Damage types (from affinity) should be defined where the affinity is defines for each unit/promotion, not always be the same for each resource. Bonuses, features, and maybe even base terrains should be able to spawn units. It would also be nice if you could set a list of possible units to spawn (maybe with different chances per spawn, and/or tech/AC requirements), and could set it not to spawn while within borders, or to spawn under the tile's owner's control. Lairs should really be made to not disappear automatically when entered. (You could still pillage them, or use the <OnUnitChangeTo> tag to remove them if that is what is wanted.) It would also be nice to add python (per turn, on OnUnitMove, ect) calls for improvements/bonuses/features/terrains. Oh, and in addition to the temporary terrain mechanism there should be similar mechanics that do the same thing for bonuses, features, and improvements. There also need to be a way for terraforming spells to stop these tiles from reverting to their original terrain.
 
How does flammable make sense for Wheat, but not for Grassland? IMO it makes perfect sense for Terrain as easily as the others. The main question would be which order of priority each should have (if one isn't flammable, and the other is, which wins? Or should there just be a NonFlammable Tag? Cause no Improvement is as flammable in Tundra as it is in Plains IMO).


It would be nice to work on them as well, but I already have enough work planned to last me a few years. It still just sounds like it is time for you to learn C++ :p


I don't think you'll ever sell me on adding a PyPerTurn to anything in all honesty. I just plain don't like Python. So unless I am attempting to manipulate graphics, I don't go there. I make a new field for the XML so that I can do things in the DLL.
 
Version 1.15 Uploaded.

I forgot to mention PreReqLevel when I added it on the last update of WorkerMod on the first page, it is mentioned now. In addition, setting the Level Prereq to be Negative will block a unit from being able to acquire the Promotion by normal means (thus TECH_NEVER no longer needs to be set as a Prereq)

New fields are PreReqAge (and I added the unit's age to the Mouseover information, right after the name. Aging is modified by gamespeed) & GoldCost (no level gained, no healing for gaining the Promotion either, need sufficient funds in the treasury to purchase it).


Main reason for the Update:

New Default Screen for FfH by seZereth!

You need to have Religious HUDs enabled to see Sez's wonderful new HUD.
 
Minor error in last upload. Forgot to include the new Python which enables seZ's HUD design as the default. Fixed now (would have ninja updated, but some folks downloaded the new version already). No new version number though, I just re-uploaded the file.
 
The main reason I didn't suggest making terrains flammable is I was thinking that such things would be removed once they catch fire, and I don;t think you can "remove" a terrain, only replace it.


You left the temporary feature, improvement, and bonus functions (modeled after tempTerrain) from my wish list. (I think I had actually gotten these to work on my own before I broke my modmod in some other bug way several versions back. Well, I hadn't tried for resources yet, and I didn't test thoroughly.)





I haven't had time to try out your recent versions (I may even just wait for vehem to include them in Fall Further), but I'm liking how it is going. I'm thinking I may replace a few spells I had planned with promotions with gold costs.


I'm kinda wondering about how the Aging works. Is it hard coded? Would adding new game speeds cause problems?


I'm glad that the level prereqs are in, but I think that a prereqUnitReligion tag really needs to be added soon. That is one of the tags I plan to use most often. I'd like Civic and Alignment prereqs too, but religion prereqs seem the most important.


I just downloaded and noticed there are some tags you haven't explained yet, e.g., iXPTransferRate and bStackEffect


Could you make a tag similar to <bEffectProm> that makes the promotions still show up to the unit's owner, but not to rivals? Or so that they appear to be different promotions to rivals? That would be quite useful with things like HN.


I'm still of the opinion that you should have the first entry in each file have the full fields instead of the last. I usually put all my additions at the end (sometimes you can get by with not breaking saves if you do it that way, and it is just easier to keep track of things), which makes finding your exemplar entry rather difficult.
 
Ok, no sooner does my head hit the pillow when I realize that I forgot to block the ability to acquire a <iGoldCost> promotion via XP. Thus you would be capable of sending yourself into Negative total gold Treasury.

New version uploaded with that fixed now. Version is now 1.15b

EDIT: Magister: Well, the Temporary tags are included in the blanket statement to make the fields be in each file. But I added a note about making Temporary become Permanent if changed while in Temp status.

Aging is done according to the GrowthPercent field of any gamespeed you use. So it is not hardcoded. I don't hardcode ANYTHING :)

Any tag not explained hasn't been implemented yet (it shows text, but doesn't do squat. Like your Territorial). I do that because you have to do a complete DLL compilation if you alter an .h file, but you only need to alter those when you define a new function or global variable. So I do them in large batches, then go through and do the code to make them do something (which will need debugging and multiple re-compiles) later. This saves me HOURS of waiting on Compiles (to be precise, approximately 20 minutes per field).

To make a field only show up to the Unit's Owner, you just have to remove the Python portion of EffectProm. Then it will still show up in the Unit Detail screen, but not in the mouseover information. I've been contemplating adding such a tag, but so far I haven't thought of a decent reason to bother (since you can hard-code exceptions into Python easily on a case-by-case basis). EffectProm & GoldCost are actually groundwork for the eventual Equipment Mod.

I use the last instead of the first because I don't want to see it. I might swap over though since that means when I am testing things I have to scroll all the way to the bottom of the Promotion Screen in World Builder to add Woodsman II. But it would cause issues if it was first as well since I list Races first and you cannot purchase those, so testing Pre-Req fields would take more work. Plus, I'd have to see all the extra crap each time I open the file.

To find the entry easily, just hit ALT + 3 in Notepad++, that collapses all the promotions and you only see my name labels, which includes a large note to indicate the Woodsman II entry with the template.
 
Temporary tags? Temporary terrain isn't (and temporary features, improvements, and bonuses probably wouldn't be) handled by tags. It is a python function handled mostly in CvPlot.cpp, for example:

Code:
pPlot.setTempTerrainType(iSnow, CyGame().getSorenRandNum(10, "Bob") + 10)

..............


//FfH: Added by Kael 10/13/2007
	m_eRealTerrainType = NO_TERRAIN;
    m_iMinLevel = 0;
    m_iPlotCounter = 0;
    m_iTempTerrainTimer = 0;
//FfH: End Add


....

//FfH: Added by Kael 11/02/2007
    if (getTempTerrainTimer() > 0)
    {
        changeTempTerrainTimer(-1);
        if (getTempTerrainTimer() == 0)
        {
            setTerrainType(getRealTerrainType(),true,true);
            setRealTerrainType(NO_TERRAIN);
        }
    }
//FfH: End Add
......

//FfH: Added by Kael 08/15/2007
	pStream->Read(&m_eRealTerrainType);
	pStream->Read(&m_iMinLevel);
	pStream->Read(&m_iPlotCounter);
	pStream->Read(&m_iTempTerrainTimer);
//FfH: End Add
......
//FfH: Added by Kael 08/15/2007
	pStream->Write(m_eRealTerrainType);
	pStream->Write(m_iMinLevel);
	pStream->Write(m_iPlotCounter);
	pStream->Write(m_iTempTerrainTimer);
//FfH: End Add

...............



TerrainTypes CvPlot::getRealTerrainType() const
{
	return (TerrainTypes)m_eRealTerrainType;
}

void CvPlot::setRealTerrainType(TerrainTypes eNewValue)
{
    m_eRealTerrainType = eNewValue;
}

void CvPlot::setTempTerrainType(TerrainTypes eNewValue, int iTimer)
{
    if (getTerrainType() != eNewValue)
    {
        if (getRealTerrainType() == NO_TERRAIN) //Dont overwrite the real terrain if we double temp
        {
            setRealTerrainType(getTerrainType());
        }
        changeTempTerrainTimer(iTimer);
        setTerrainType(eNewValue, true, true);
    }
}

int CvPlot::getTempTerrainTimer() const
{
    return m_iTempTerrainTimer;
}

void CvPlot::changeTempTerrainTimer(int iChange)
{
    if (iChange != 0)
    {
        m_iTempTerrainTimer += iChange;
    }
}
//FfH: End Add

I'm still a little confused about how EffectProm works. What is this python portion? (I thought you just plain don't like python :p) Would it still be possible to have some promotions show up only to the owner and others to no one? How about letting some promotions show up to players other than the owner? (I was just thinking it could be nice to add a spell that lets you use a rival unit against him. For instance, you could make a rival unit into a disease carrier who would spread disease to other units nearby (probably though a pyPerTurn effect), but the unit's owner would have no way of knowing what unit was to blame. It would be better if you could make it visible only to the civ that gave the promotion to the unit, but that sounds pretty impossible to code.)



I've found that Notepad++ often freezes up when handling larger files, so I'm mostly sticking to Notepad2. That rules out collapsing everything. I know I could search the file if I want (as I have often done), but that can be kind of a hassle, especially since I'd have to remember which entry came last in each file whose schema you changed, not just for promotions. It seems so much simpler and more logical to have the template be the first entry in each file.

You could easily just not put the races first. I personally think that placing equipment first makes the most sense, as they are first in CIV4UnitInfos.xml. You could also just create a dummy promotion for the template which you could use for testing things too. In case you forgot to remove something after testing, it would probably be better for your dummy promotion to have extra function than for woodsman II to have some strange effect. You wouldn't want all Treants to explode from combat or something, would you?
 
Hrm, didn't remember that all of Hell is a Python setup. Easily moved to a non-hardcode DLL modification though (I'll just add a field where you can specify TerrainNextPlotCount. If I figure out Arrays easily enough, I'll make it so that you can specify what Plot Counter Value the Terrain switches at even, and try to allow for multiple settings. Thus the land could slowly work it's way to pure Desert, THEN go to Hell Terrain (and since it is still based off the original Tile, that does not mean Burning Sands everywhere...))


Yes, I do loathe Python (with a vengeance). But the majority of the main HUD is handled in Python, and only in Python. There is a single line required for EffectProm in Python (an IF statement, thus easily added to) to prevent showing the larger icon in the UnitBox (the area that only shows you the highest Level Promotion for Series Promotions).


While in theory it sounds nice to let promotions be visible only to opponents, in practice how would that be used in any manner other than how EffectProm works? Either I gain control of the unit, and Visibility based on the location of him, or I shortly lose the unit in a stack of other units or the Fog of War, and probably don't much bother with Mouseover's to check which units I have "infected" and which I have not. Instead I would rely on the checks for my spell to see if there are valid targets to indicate when I have already hit someone.

Coding it would be very simple though, just add an IF statement to each of my EffectProm blocks so that it will ignore EffectProm when ActivePlayer != Owner.

It isn't that Notepad++ freezes (for me anyway), just that it takes a while to load the larger files. Once loaded though it runs quite fast. I can't imagine your computer is lower spec than my laptop, so you might need to increase your available Virtual Memory or something like that. If you do stick with searching, you could search for the word Template. I highly doubt that shows up anywhere else in any XML files except maybe Text, and you don't need one there :)




On a side note, I've been wondering this morning about making Wane require a set Age instead of XP value. Probably would be best if that Age requirement ramped up in the same manner as the Great People Thresholds as you settled more and more shades.

EDIT: Version c uploaded. Non-Transparent seZ HUD this time instead. Looks far better.
 
Hell is not all python. Python controls the actual changes of the plot counter and also handles change to bonuses ad Flames, but Terrains changing from the plot counter changes relies entirely on C++ and these tags: <iPlotCounterDown>0</iPlotCounterDown>, <TerrainDown>NONE</TerrainDown>, <iPlotCounterUp>9</iPlotCounterUp>, and <TerrainUp>TERRAIN_BROKEN_LANDS</TerrainUp>

It already works by letting you set what plot counter causes the switch. If you want, you could make a tile change for every change of the plot counter. You would of course need to create a lot of new terrains to do so.


Adding equivalent tags for features, improvements, and bonuses could be a good idea (it would let you eliminate half of the CustomFunctions.py's def doHellTerrain(self): funtcion), but it wasn't really what I was talking about when I mentioned temporary terrain/features/improvements/bonuses.


The Temporary Terrain is not related to hell. It is used in the End of Winter option, some constellation events, and the several of my spells. I really don't see a decent way to handle temporary terrain, features, improvements, or bonuses without python. The .setTempTerrainType works quite well for these spells, bu I'd really like to be able to temporarily create features like Ice and improvements like forts (making wall of stone useful outside of cities, but not permanently replacing whatever improvement was there before). Most of these spells need to loop through the tiles within the caster's range, so I don;t see how a non-python version of these functions could work.




I think I've figured out how EffectProm works now.
 
1.16 is finally up (lots of connection issues today).


Main reason for the update is the new non-religious HUD by seZereth. You need to have Religious HUDs enabled to see it, and of course not have a religion.


Added a Game Option to let the AI ignore Level Requirements for Building/Updading Units. It does not at this point also allow them to ignore Level requirements on Promotions, as none exist yet for me to decide if that is balanced (they are not allowed to ignore level requirements on Tiles, as that WOULD be unbalanced. They would have Brigit on turn 5 or so...)


Only 1 new tag. <bRequireCity>, this will make a promotion only selectable while a unit is in a City. I am thinking now of making <iGoldCost> allow promotions to be taken for free (no level gained) if they have a negative value. Combine that with the Require City and you could make Weapon Promotions still be free, but not be automatic (though nobody would want that... it's just an example).



If you are trying to work with my code, I urge you to brace yourself before you look at CvMainInterface.py. It is ugly in there for the moment. I am working on making the code cleaner so that people can work with it, but it'll be best to wait until I get all of the HUDs that are going to be submitted, or learn more Python :)


Also, if you use the lowest resolution setting, the Text will be blocked by the UI on the top of the screen. To solve this, change your resolution, then refuse to keep the new Resolution. This moves the text back to the front of the screen. Thus far I am not sure how to make this automatically happen when the game loads/starts.

EDIT: The GoldCost setup to get promotions for free sounded so good I went ahead and set it up. So version is now 1.16b.

Though now that I think more about it, maybe it would be better if you COULD gain gold from taking a promotion. You could have a promotion which has bad effects to simulate being "Hired" by someone (ie - Caravan Guard: Gain 100 :gold:, but Unit is now -50% :strength:). In that case I suppose I'll just make a different tag which is set to make a promotion not require XP. Afterall, someone might want a promotion to cost both XP AND Money...

Adding the other tag would require a complete re-compile, so that won't pop up suddenly today as a version 1.16c :D
 
Main reason for the update is the new non-religious HUD by seZereth. You need to have Religious HUDs enabled to see it, and of course not have a religion.

This is definitely getting better, but still not quite good enough for me to want to use the option. The writing and the burnt holes in the scrolls are nice touches. I'm not a fan of the old AC counter symbol in the lower left portion of the screen, or the "prize ribbon" you press to go to the next turn. I still personally think that the best place for the AC is where the clock, turn, and (formerly) the year is listed. That may be out of your control though. May I assume that you also can't control the tech bar? That detracts more than anything else, imho. It could be really cool if you could get rid of the bar and instead have the scroll gradually unravel to show how progress in going.


Added a Game Option to let the AI ignore Level Requirements for Building/Updading Units. It does not at this point also allow them to ignore Level requirements on Promotions, as none exist yet for me to decide if that is balanced (they are not allowed to ignore level requirements on Tiles, as that WOULD be unbalanced. They would have Brigit on turn 5 or so...)

Very nice. I'll have to try this. It could be quite unbalanced (especially in FF), but that's ok. I'm up for the challenge. I was about to suggest a seperate option for promotions to ignore level, but I think that may be too much. I don't think that having the same option let the AI ignore both would be a problem.


Only 1 new tag. <bRequireCity>, this will make a promotion only selectable while a unit is in a City. I am thinking now of making <iGoldCost> allow promotions to be taken for free (no level gained) if they have a negative value. Combine that with the Require City and you could make Weapon Promotions still be free, but not be automatic (though nobody would want that... it's just an example).

Also quite nice.

Can getting promotions also remove other promotions? I was thinking that weapon promotions would have costs anyway, and using these new mechanisms (plus requiring the already existing prereq bonus tag) would be a better way of handling that than spells, as the spells would probably have to involve python and the AI wouldn't understand it. (Does the AI understand when it would want these promotions?) Do <PromotionImmune1>, <PromotionImmune2>, and <PromotionImmune3> block purchasing promotions, or even work at all? I guess I could use those if they work, but I was wanting to add more weapon types that that would allow. It could be nice to change this to a list.

I also think it would be extremely useful if promotions could block you from getting other promotions.




Another tag that requires a certain terrain, features, or improvement could be quite nice too.

A tag that makes a promotion wear off when the unit moves could be very helpful. (A tag that adds certain promotions on move could be nice too.)


I was just thinking that it could be cool to add a tag that makes a unit automatically be granted if all its requirements (including the new ones I just suggested) are met.

Adding these tags would easily allow me to re-implement promotions like Forest Stealth, and would also get around having to add an actual pyOnMove tag/function. (You could have it grant a promotion on move, using only XML/SDK, and give that promotion a pyPerTurn function which would trigger immediately, and then remove the promotion)


I'm still really hoping for the ability to give a combat bonus based on the percent of the owner's culture on the tile. (And of course almost everything else I've suggested, but this one seems simple enough to go ahead and try soon.)


The tags I just suggested plus letting promotions apply certain promotions based on terrain/features/improvement/city, would make this simple. (That could also be a way to get around actually adding a pyOnMove tag, since it could add a promotions)




Have you looked into allowing python to block units from getting certain promotions yet? I know you don't like python, but this would be extremely versatile and helpful.
 
Back
Top Bottom