Jump to content

Combined mod


Tycus

Recommended Posts

Yes, it is yet another of XCOM rebalance mods...

I've been lurking this forum for quite some time, and now I am asking for some help in implementantion of some features in my mod (as I am no advanced modder, was only changing values in functions/using someone else's code):

- Buildable items: smoke grenades, battlescanner, HEAT ammo (as item): (only those (and those exist only as items), for now; and yes, i have seen all relevant threads, and no, it doesn't make any clearer to me, how to do it clean and nice); also it is possible for item to give two smoke grenades (4 with grenadier)?

- Perks for aliens: as aliens cannot use new active abilities (can't they?), I'll stick with passive ones (for time being), just give selected types of aliens some perks (maybe one of those unused perks as well), thats all; hm, maybe DR on a few would be useful (maybe on Muton Berserker? melee units are in serious trouble in my mod); could it be damage specific resistance as well?

and no, currently I am not planning to add dynamic stat adjusment or consumable items to my mod;

 

Also could someone give me directions in AI tweaking (it may be required in my mod for aliens to fully utilize their new capabilities; even now their suppression needs some love).

 

As now mod exist in early closed beta stage, and is very WIP at the moment (just a bunch of fixes and features from here and there) and doesn't have a name yet. I can post full list of changes/features in my mod (if there is anyone interested).

 

And now I want to give my special thanks to johnnylump (for posting upk changes in his Longwar mod), Amineri (for keeping up good work), creator of web based perk tree generator Bertilsson (nice and easy to use), creator of ToolBoks bokauk (most helpful tool so far), and for all others, who have been contributing to this mod community.

 

(and sorry for my English (it is not my native language), feel free to correct me anytime :wink:)

Link to comment
Share on other sites

Welcome! Always glad to see a new face in the XCOM modding scene :)

 

The new items mod (which at least parts of are necessary to get the smoke grenades and battlescanners working as equipped items instead of as perks) is unfortunately still a bit messy. Definitely could use some feedback to help clean it up into a "standard" installable unit. It is very possible to make adjust the number of charges that items grant (so each small item smoke slot grants 2 charges), and to include smoke (and battlescanners if desired) into the Grenadier perk. I had a version of code back in early prototyping that did just that but ended up not using it.

 

----

 

AI tweaking primarily consists of adjusting the priority of the various actions.

 

In general each action gets scored based on 'offense', 'defense', and also receives an 'intangible' score. For example firing a weapon at a target gets an offense score based on the to-hit value, getting a bonus if the target is the VIP, a bonus if the attacking unit is mindmerged, and also a bonus for the targeted unit being wounded. Shooting a weapon can be a defensive action as well. A unit gets a bonus to the shot defense score if it is flanked by a unit, but a negative overall for being flanked at all. This creates a situation in which the AI will (if forced to shoot) only shoot at units that are flanking it.

 

Each ability is scored separately based on the various conditions. These priorities are then used as weights to randomly select which ability will be used first. If Firing has priority 84 and Moving has priority 27, then the Fire action will be picked 84 / (84+27), and the Move action will be picked 27 / (84+27) of the time.

 

In answer to your comment about Suppression :

Suppression always has an Offense score of 0 and an Intangible score of 0. If a unit has a "strong attack" (an attack with >50% chance to hit, I think) OR if the target unit is already being suppressed, then the Suppression defense score is 0. Otherwise the suppression defense score is a fixed value of 80. In general this means that Suppression has a fixed priority of 80, which competes against other action's priorities.

 

The likelihood of Suppression occuring could be accomplished through a combination of increasing the fixed priority suppression value, increasing the cutoff for the strong attack, or making the Suppression priority a more smooth function of the to-hit roll. Higher to-hit values already get a much higher priority, which implicitly reduces the chance for suppression, so this may not be necessary.

 

There are some exceptions to the above. At times various strategies will be decided upon at the pod level. This can force certain behaviors on individual units within the pod that they wouldn't otherwise take. The most common example I can think of is the "coordinated flanking attack". In this situation an alien can be forced to perform a flanking maneuver. It is one of the few occasions in which an alien is allowed to dash, in order to allow the alien a better chance to find a valid flanking position.

 

-----------

 

Finally, I'd be happy to see a full list of changes / features if you are willing to share.

Link to comment
Share on other sites

Welcome! I'll take on a piece of this. Some of what you want would probably require some moderate to major rescripting, so I encourage you try to learn how to do it yourself -- there just aren't enough active rescripters (I think there are two of us -- with at least one other who is learning) right now to handle all feature requests, so you may only get these if one of us really wants to pursue it.

 

 

- Perks for aliens: as aliens cannot use new active abilities (can't they?), I'll stick with passive ones (for time being), just give selected types of aliens some perks (maybe one of those unused perks as well), thats all; hm, maybe DR on a few would be useful (maybe on Muton Berserker? melee units are in serious trouble in my mod); could it be damage specific resistance as well?

 

Aliens cannot use active perks, and it would be a major and possibly fruitless undertaking to make them to do so, as it would require significant AI recoding for each one. We are fortunate that the vanilla code is robust enough to apply passive X-Com perks to aliens, all we have to do is assign them. Even then, the AI isn't smart enough to play in a way that maximizes the utility of these perks, but they aren't penalized by having them, at least.

 

Unless it made it in the latest Merciless Beta, Long War 1.9 Beta is the only mod I'm aware of that gives perks to aliens. This is handled in XComGame.upk >> XGUnit.DebugAnims(), and at the moment it is only for alien pod leaders. It requires mods to several other functions to work, but it's there if you'd like to look at it.

 

Both Merciless and Long War have Damage Reduction, but I think it is implemented in different ways. Long War's is implemented via changes to XGUnit.OnTakeDamage() and XGUnit.DebugShowOrientation(). I think Merciless' version was further developed by Amineri and is a lot easier to implement in other mods.

 

Good luck.

Link to comment
Share on other sites

Wow, great question regarding AI tweaking by Tycus (and welcome) and tantilising answers from Amineri.

 

Amn, where are these priorities handled?

 

--------

 

To add to JohnnyLump's comments, the Damage Reduction modlet (as well as Regeneration, upgrading over time etc which are all enabled by the same modlet) is well fleshed out on the wiki here:

 

http://wiki.tesnexus.com/index.php/Alien_Upgrades_Mod_-_XCOM:EU_2012

 

Be sure to look closely at the "Mod Configuration Specifics" section which refers to the BalanceMods entires in the DefaultGameCore.ini which you modify in order to activate the features the hex changes provide. You can just have damage reduction for a couple of units and nothing else, or you can give aliens increased damage resistance over time, you can give certain units regeneration or you can have them gain extra hitpoints over time too. You could give a certain species all of the above or none. It's very flexible.

 

It's an excellent modlet as it allows pretty painless end-designer customisation via the DGC.

Edited by Zybertryx
Link to comment
Share on other sites

Wow, great question regarding AI tweaking by Tycus (and welcome) and tantilising answers from Amineri.

 

Amn, where are these priorities handled?

 

 

There's a thread about various little AI improvements that I've made here : http://forums.nexusmods.com/index.php?/topic/989749-r-d-ai-improvements/

 

Just realized that I need to add the AI improvement that fixes the Hunker Down ability to that thread.

 

In general the tactical AI is implemented through three primary functions :

  • XGAIAbilityDM
  • XGAIAbilityRules
  • XGAIBehavior

XGAIBehavior is the base class for alien AI behavior. Each specific alien also has an extension of the class to add specific code / overwrite default functions in order to create distinct behaviors for each alien (e.g. XGAIBehavior_Sectoid).

 

There is also some team-attack code implemented through XGAIPlayer. The move scoring code (e.g. scoring each individual tile on the map for "goodness") is also done in XGAIPlayer -- the "goodness" map for tiles is set up so that it doesn't have to be re-computed for each unit, just updated as each unit moves.

Link to comment
Share on other sites

 

Unless it made it in the latest Merciless Beta, Long War 1.9 Beta is the only mod I'm aware of that gives perks to aliens. This is handled in XComGame.upk >> XGUnit.DebugAnims(), and at the moment it is only for alien pod leaders. It requires mods to several other functions to work, but it's there if you'd like to look at it.

 

 

The easiest way to get passive perks assigned to aliens is to take over the function XGUnit.DebugAnims (or another debug function) and call the function for every unit from XGUnit.Init.

 

This involves changing the lines :

    if(IsAI())
    {
        InitBehavior();
    }
    else
    {
        // End:0x1BF
        if(isHuman())
        {
        }
    }

to:

    if(IsAI())
    {
        InitBehavior();
        DebugAnims(none, none);
    }

This calls DebugAnims for every alien upon init. In DebugAnims the conditionals to check alien type and assign perks can be coded up.

 

Since DebugAnims is called individually for each alien unit as it is created, this allows for randomization of alien stats if desired. The dynamic progression mod adjusts all aliens of the same type at the base level, which is quite distinct.

 

----------

 

@ johnnylump

 

In the Long War 1.9 code DebugAnims is called for every spawned alien, but only the leader has the m_iSmokeGrenades set to a non-zero value. This allows you to set perks for non-leader aliens based on other conditions (e.g. all Sectoids get Low Profile after day 365)

Link to comment
Share on other sites

Wow, bunch of replies in quick succession.

 

 

The new items mod (which at least parts of are necessary to get the smoke grenades and battlescanners working as equipped items instead of as perks) is unfortunately still a bit messy. Definitely could use some feedback to help clean it up into a "standard" installable unit. It is very possible to make adjust the number of charges that items grant (so each small item smoke slot grants 2 charges), and to include smoke (and battlescanners if desired) into the Grenadier perk. I had a version of code back in early prototyping that did just that but ended up not using it.

Define "standart". And why not just use that code? I mean, I recall reading about that, and it seemed perfectly suited to do what I need.

 

Welcome! I'll take on a piece of this. Some of what you want would probably require some moderate to major rescripting, so I encourage you try to learn how to do it yourself -- there just aren't enough active rescripters (I think there are two of us -- with at least one other who is learning) right now to handle all feature requests, so you may only get these if one of us really wants to pursue it.

And how do you learn rescripting, exactly? I mean, I can understand, how to change one function, maybe rewrite parts of it - but writing something entirely new from scrap? It seems way over my head.

 

Damage reduction is low-priority (for now), unless it can be made damage specific (resistant to normal weapons, but vulnerable to explosives, something like that), but it is nothing critical.

 

Regarding AI:

At times various strategies will be decided upon at the pod level. This can force certain behaviors on individual units within the pod that they wouldn't otherwise take. The most common example I can think of is the "coordinated flanking attack". In this situation an alien can be forced to perform a flanking maneuver. It is one of the few occasions in which an alien is allowed to dash, in order to allow the alien a better chance to find a valid flanking position.

- I would really like to know more about that. Is it possible, for example, to assign behaviour to standard pod of aliens, such as one of them will suppress, next one shoot, and last one overwatch? Also, as I understand, setting are different for different pod types? If it is, can they be individually tweaked?

Regarding value-priority system:

While offense and defense seem pretty much self-explanatory, what does intangible score mean?

 

To add to JohnnyLump's comments, the Damage Reduction modlet (as well as Regeneration, upgrading over time etc which are all enabled by the same modlet) is well fleshed out on the wiki here:

 

http://wiki.tesnexus.com/index.php/Alien_Upgrades_Mod_-_XCOM:EU_2012

 

Be sure to look closely at the "Mod Configuration Specifics" section which refers to the BalanceMods entires in the DefaultGameCore.ini which you modify in order to activate the features the hex changes provide. You can just have damage reduction for a couple of units and nothing else, or you can give aliens increased damage resistance over time, you can give certain units regeneration or you can have them gain extra hitpoints over time too. You could give a certain species all of the above or none. It's very flexible.

 

It's an excellent modlet as it allows pretty painless end-designer customisation via the DGC.

Excellent, with tiny drawback of "This mod eliminates the normal function of the following entries in the DGC.ini", which I do already require for one of features in my mod. Anyway, Damage Reduction is meaningless without perks for aliens, that are supposed to go along with it.

 

And wiki right now is such a mess (not to mention lacking many entries), so I prefer to seek whatever I need on this very forum (even compiled checklist of potentially useful threads). Yes, I did read all threads in this forum (may have missed something somewhere).

 

Also, I will post all changes/features, that are implemented in my mod later, but it will come with some comentaries.

 

Also, as I was writing my reply, Amineri wrote a new post :huh:,

so could you give me example of HEX code, that I need to implement? (No dynamic stat adjusments, only predefined set of ablities for each type)

I also can post list of intended perks for aliens (would like to see some comentaries on which of them would work or which are redundant/could be implemented differently). Or better send them via PM?

Edited by Tycus
Link to comment
Share on other sites

The wiki has a lot of modding tutorials and other information to help get you going:

 

http://wiki.tesnexus.com/index.php/Modding_XCOM:EU_2012#Tutorials

That was really useful reply /sarcasm

Ok, so tutorials page definetely improved since last time I seen it, but what I really need is not to "get going", but a sample of very specific HEX code, that I can simply adjust and implement (as I'm no programmer myself, if it wasn't the case I would have done everything required already by myself, and would not be asking for help on this forum).

Link to comment
Share on other sites

 

 

Define "standart". And why not just use that code? I mean, I recall reading about that, and it seemed perfectly suited to do what I need.

 

By "standard" I mean that every alien on the map will have the same stats.

 

The original dynamic alien progression modlet hooks into the difficulty code to change the root characters from which all units draw their stats.

 

The dynamic progression certainly works well. Sorry if I'm throwing too many different options at you :)

 

 

 

 

And how do you learn rescripting, exactly? I mean, I can understand, how to change one function, maybe rewrite parts of it - but writing something entirely new from scrap? It seems way over my head.

 

Well, when I say "re-write" a function I mean that I'm completely replacing the original functionality with new functionality. For whatever reason the original function isn't needed, so I can "take it over" and use it for another purpose.

 

So far I haven't figure out at all how to actually add a new function to the upk -- as much as I'd very much like to.

 

It took me a while to learn about the hex. I started off with just looking at existing code and trying to understand what it did. Then tried editing single values to make a change. Then tried making small changes to single lines to alter an if statement or something (one of the first little mods I did was to make explosive damage random, which involved changing 1 line of code). Gradually I got more used to the structure of the game and the hex itself, and so got to the point of "writing code from scratch".

 

But I never could have jumped straight into it.

 

There is a bit of a gap on the wiki between making simple value hex edits and more significant code changes, but I haven't figured out how to structure a tutorial. I've been working with Zybertryx to try to explain some of the fundamentals, so I'm hoping that he'll take the materials I sent him and put together a wiki tutorial while the learning process is still fresh in his mind (*hint hint* ;) ).

 

 

 

I would really like to know more about that. Is it possible, for example, to assign behaviour to standard pod of aliens, such as one of them will suppress, next one shoot, and last one overwatch? Also, as I understand, setting are different for different pod types? If it is, can they be individually tweaked?

Regarding value-priority system:

While offense and defense seem pretty much self-explanatory, what does intangible score mean?

 

I must confess that I don't understand very well how the pod coordinated attacks work -- I'm just aware that they exist (not all of the behaviors are decided purely at the individual unit level). So I don't really know how difficult it would be to implement new pod behaviors.

 

Intangible is the name given to the an "extra" priority factor that the AI designer didn't feel fit with either offense or defense. Kind of a miscellaneous category.

 

For the standard shot, offense score is based on the to-hit value ... how likely is the shot going to hit and damage the enemy. Defense score is primarily about prioritizing shooting at flanking units -- shooting defensively. The standard shot intangible score does 2 things : (1) it applies a large penalty to shooting if the unit is flanked, isn't suppressed, and has 2 move actions remaining -- basically an attempt to force the unit to move, and (2) if the unit is not flanked, adds score based on crit chance.

 

 

 

 

Excellent, with tiny drawback of "This mod eliminates the normal function of the following entries in the DGC.ini", which I do already require for one of features in my mod. Anyway, Damage Reduction is meaningless without perks for aliens, that are supposed to go along with it.

 

Yes, I'm not happy with how the mod removes many of the difficulty settings.

 

I've been thinking about releasing an update that allows for adjustments for all difficulties as well as variable number of upgrades per alien (and more than 2). However, this requires stable installers that can force the game to load the DefaultGameCore.ini from the file instead of from the Resource Cache.

 

I'm pretty sure that dubiousintent and Yzaxtol got that working, but until it becomes "common practice" there's not much use in building a mod that depends on it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...