Results 1 to 3 of 3

Thread: Balance Guidelines Project - The Theory Behind XAI-friendly Design

  1. #1
    Achilla's Avatar Vicarius
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    2,577

    Default Balance Guidelines Project - The Theory Behind XAI-friendly Design

    Balance Guidelines Project

    What is it?


    It's a treatise on how to design your mod or re-adjust it for XAI integration, in order to achieve very decent and solid Battle AI performance. It also contains few advices concerning the campaign.

    Why the previous documentation was so messed up and without sufficient reasoning behind integration priorities?


    For many reasons. Originally it started as my own project and remains as such to this day, however I've been benchmarking the performance with the entire team. At the original time of writing, I've had mainly kingdoms-based mods in mind, without any non-standard animations for soldiers or very weird battle balance design.

    Now, I decided it was the right time to summarise most important and universal bits, as well as reduce the amount of text in general, making it easier to read and understand, with clearer priorities on what is important.

    This time around, I will dedicate a whole next post to theoretical background (as I deem understanding the point & assumptions of the whole research important), and the last post - to create a list of advices technical in nature, acting as a short summary of the theory essay.

    Now, prepare for a bit of reading!

    The Theory - Introduction


    XAI since very beginning was an advanced project, willing to reach far and achieve a lot. It become especially relevant once campaign AI started to play an important role in the entire "Core Game Renovation Project", and naturally the performance of seemingly separate entities such as Campaign AI and Battle AI started to become less important from the perspective of individual parts, as it was clear and evident that what makes or destroys the campaign was a combined effort of decent BAI and CAI. How you lose and win your battles ultimately affects your economical and political standing on the campaign map, just like your diplomatic and military opportunities based on how other factions interact with you dictate what kind of battles and how often you fight, often deciding the result.

    Thus, as a new team member, I decided to search for ways outside the AI itself, to improve it's performance - and that meant analysing the entire mod design. I decided to focus on battle mechanics, because this area in the whole modding has been given least attention, as far as the gameplay goes - on a side note, I didn't want to interfere with the campaign design of another modders, as it wasn't my area of expertise, and mods tend to differ the most in this area.

    You can follow the continuation in the next post.

    The theory part is quite lengthy in nature, because I deemed it important to explain the whole background and design philosophy of my project. However, no kind of information there is unnecessary or obsolete, and overall should be a good read if the topic is in relevance of your interest.
    Last edited by Achilla; April 18, 2010 at 12:40 PM.
    Man is but a shadow of his former self, encased in feverish delusions of grandeur.
    Ignorance is your shield, knowledge is your weapon.
    Heart without reason is stupid, reason without heart is blind.


  2. #2
    Achilla's Avatar Vicarius
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    2,577

    Default Re: Balance Guidelines Project - The Theory Behind XAI-friendly Design

    The Theory - Mod Design

    Since the beginning of my modding career, I've had very clear goals and priorities in my mind, as far as mod design goes. The most basic principle consisted of high replayability value, stable and well-thought game mechanics as well as the history/realism factor, which was equally contributing to the enjoyment of the mod but only after the core gameplay needs have been sufficiently addressed. In another words, it's a matter of balancing on a thin line, between gameplay and realism, however gameplay always comes first in modding, because we lack the tools and means to completely redesign the game engine to satisfy our far-reaching dreams, and have to adjust our design to fit well within the 'hardcoded core' instead.

    Now, the list of most important points, which every mod designer ought to think about in the case of not just integrating XAI, but building any mod around solid gameplay 'base', based on our findings:

    a) The study on hardcoded part of the Battle AI.

    Spoiler Alert, click show to read: 
    The study, concerned with most basic interaction between individual units forming an army body, suggests that the optimal performance - as far as the AI performance versus the player goes - is met, in the case of sufficiently big battles. How does one define a 'sufficiently big' battle? As a matter of taste, I'm inclined to lean towards AI army of 14-20 units (at least 12!), able to form at least a double line, as it seems to be most basic and key army formation to the whole game. This is macro scale.

    On the micro scale however, with few units, the core AI still thinks & acts in the 'macro' terms, as it wasn't designed to support typical RTSish design, where every individual unit is capable both of independent thinking or fighting in formation with other units. You don't see an individual unit to thoroughly analyse terrain, withdraw and run around the battlefield to make the player chase it and lose morale/stamina over time. It simply stands it's ground or advances forward, like the bigger army would do in a typical skirmish.

    The combined factors involved in this design easily explain why the player is able to severely damage the AI's troops in small-scale battles, making perfect use of wide, open battlefield, while in big-scale fights, where much more space is occupied by both armies and manoeuvring is noticeably more difficult, thus the player is more inclined to engage the AI in the same or similar way as the AI engages him.

    As a general rule, you want to play on highest unit size and push the individual unit sizes to the EDU limit (100), preserving the relative unit size multipliers between different unit types (e.g. 'standard' heavy cavalry of 24 knights, opposed to 48 dismounted archers/foot knights ... you can clearly see, cavalry is twice less numerous, and EDU unit sizes of 48/50 and 96/100 would be perfect for your purpose in this case, should you exclude usually more numerous spearmen from the equation). By doing so, you make the micro-scale less important for winning battles, in favour of the macro scale, and thus considerably boosting AI performance on the battlefield.

    For the campaign, you'd want to strike a fine deal between full stack spam and small, wandering bands of enemy faction - you want full and close to full stacks wandering around for optimal performance, however nobody wants to play a dozen battles each turn.

    b) Supplementing the 'macro' part of the theory, comes piece dealing with the army composition.

    Spoiler Alert, click show to read: 
    In general, the game core (provided with few AI and non-AI tweaks) is competent at handling different units at once. Diverse army, containing archers, footmen and bowmen creates not only more opportunity for the AI to show what it's capable of, but also makes the battle more interesting for the player as well. This design implies that the different unit types should be more powerful and capable when combined into single army. In another words, 20 pikemen units should be beaten by equal quality tier army composed of 10 footmen and 10 archers, or more extreme - 10 footmen and 10 cavalry units. On the other hand, 20 pikemen should beat 20 cavalrymen any day without much difficulties, save for few rare/obsolete exceptions. This kind of design raises an interesting question - how far can we go, before we derive into absurd clearly violating realism or history of warfare?

    The entire point here, is that different unit types not only allow for different set of tactics able to be used to beat the enemy, but also that stat differences and melee/charge/ranged performance benchmarks aren't completely extreme between individual groups. Easy example of violating this rule would be paper-rock-scissors game design, where cavalry is completely invincible to archer's missile fire and melee abilities, infantry is decimated to bits within blink of an eye by archers, while infantry is completely invincible to cavalry charge and melee abilities. However, following the streamlined design of different units doesn't mean that cavalry is no longer cavalry, or archers are no longer archers. It's a matter of proportions! It is perfectly fine for each unit to have it's own strong and weak sides, as long as they aren't extreme and totally off!


    c) Typical RTS design.

    Spoiler Alert, click show to read: 
    This part takes the point b) further, explaining how many differences and of what magnitude contribute to the AI performance and general gameplay value. Generally speaking, we've arrived at a conclusion, that no kind of unit should be inferior or superior by nature to any other unit. Thus, demi-god heavy cavalry or any other overpowered combination isn't an option.

    Another thing important to stress, is that it's crucial for the campaign's unit recruitment to further support creation of balanced army by the AI and the player. This combines both recruitment priorities from the EDU as well as how often and which units replenish at what kind of recruitment buildings in the campaign map. For slightly 'better than average' cavalry, confronted with average archers and average infantry - usually the 'golden mean' here is recruitment composed 20% of cavalry, 30-35% of archers and 45-50% of infantry, taking both field and siege battles in mind. All kinds of skirmishers with low range fluently blend between 'archer/crossbowmen' and 'infantry' category.


    d) 'Tiering' (hierarchy) design.

    Spoiler Alert, click show to read: 
    This one bit is pretty simple. As the campaign economy evolves, you want obsolete units to phase out, to make room for the better and more expensive units. Important point to raise - when you have hypothetically 3 unit quality tiers, concerning all unit types - tier 1 shouldn't be completely inferior to tier 2, and all of the balance principles should apply especially to units within the same tier, as far as the battlefield mechanics go. This means, that tier2 cavalry isn't suddenly more superior versus tier2 infantry, than tier1 cavalry was versus tier1 infantry. You can make few fine points, but always have AI performance in mind. It doesn't like extremes, because it wasn't taught to make use of them to it's own advantage, what makes streamlining even more important.


    e) Streamlined unit design, builds upon all of the previous points.


    Spoiler Alert, click show to read: 
    What this mysterious sentence actually means? I will show it on example battle mechanics scenario. For simplicity I will exclude pikemen, missile cavalry and other sub-types ... but before we start with the example, there are a few points below worth reading, to further your understanding of my research.

    Small reminder - unit 'tiering' is very important ... there is little to no room for extremes, like low, normal & disciplined morale trait range, within tier 2 or tier 3 cavalry, or no stamina bonus, good stamina & very good stamina within the same tier (however, all of particular faction's units could be one morale or stamina level higher, provided it was offset with well-thought drawback ... alternatively, you can have few elite units with very limited recruitment, slightly violating the tiering logic by being a bit better than their counterparts from the same tier).

    Lastly, very important point - the formation & unit size within unit type should be the same for all of it's units - same number of rows, same spacing between soldiers. It's very important, because it's the most practical execution of the 'macro scale' theory, heavily involved in the RTS design.

    The example battle mechanics (simplified, however they reflect very well what our own performance benchmark for the AI is)

    Spoiler Alert, click show to read: 
    Melee Infantry

    - moderately fast obliterates dismounted missile troops, quickly routing them
    - needs some time to kill enemy spearmen, but takes little casualties from them and wins in prolonged fight, tiring and routing them in the end
    - vulnerable to direct cavalry charge, 1-to-1 casualties in melee with enemy cavalry
    - has an upper hand in morale and stamina, compared to archers and spearmen

    Archers

    - missile fire creates important pressure on enemy infantry (melee infantry & spearmen) over time, allowing your cavalry, spearmen or dismounted missile troops to have an equal fight in melee versus them
    - however, missile fire isn't lethal enough to kill entire armies, it merely damages them making the enemy formations more vulnerable to flanking (and in return, more prone to morale shocks of all kinds)
    - slightly less efficient fire against enemy cavalry
    - sucks in melee, however they aren't completely useless when fighting damaged enemy spearmen or severely damaged melee infantry/cavalry

    Spearmen

    - nice defensive unit, more resistant to missile fire due to more men per unit, able to hold melee infantry for some time, however quite bad in kill ratio (e.g. 1-5 ratio)
    - has some resistance from frontal cavalry charges (20-40% fall dead), in melee kills enemy cavalry fast

    Cavalry

    - decent charge
    - lack of stamina bonus (to prevent charging enemy to death and other lame strategies going against diversified army design)
    - decent morale (on-par with melee infantry)
    - quite efficient in melee versus archers, can stand up a fair fight versus decimated melee infantry or severely decimated spearmen (however, prolonged fight is it's weakness)
    - slightly more resistant to non-ap missile fire than melee infantry, due to small armour bonus for barded/armoured horse (whenever applies)


    Such basic design is pretty much everything that there needs to be done about your battle mechanics mod design, as far as the general direction goes, save for few more technicalities and details.

    As a reminder, streamlined unit design also implies there aren't too extreme differences in unit attack/defense, morale and stamina stats, outside the 'unit type' design, which does introduce a few fine points. As a side note, don't overuse the AP weapon attribute, as it is very hard to balance, especially with multiple unit armour upgrades avaible to each unit.

    As a personal recommendation, don't use more than 1 armour upgrade for each unit (ideally, don't use any at all). It will make balancing easier and cut needed texturing & modelling resources to bring your mod to life, with not really much if any associated gameplay loss. Talking about melee AP weapons, it's wiser to simulate the effect by slightly higher attack, at the cost of worse attack delay/slower animation. For missile weapons it isn't much of a nuisance, as long as the numbers are reasonable.


    f) Streamlined battlefield.

    Spoiler Alert, click show to read: 

    This section will contain a handful of advices concerning this topic.

    1. Design strength of artillery versus walls, as well as walls strength and lethality of the fortifications to the besieger in such a way, that neither attacker nor defender is in absurdly privileged situation ... small bias for the defender is good, however it needs to be reasonable.

    2. Talking about settlement fortifications in more detail, when you adjust the missile rate of towers (which is in intervals between shots) - make the rate of fire 2.5x smaller (faster) on huge, than small scale for normal towers, to have the same killing power across all unit sizes ... for cannon/ballista towers you might want to not scale perfectly, otherwise they will become too decimating on large & huge unit sizes, due to bunched up besieger's units (balance around % kill rate over time across multiple unit size options) ... also, flaming bolts/cannon balls shouldn't scale at all with unit size, as they are used primary against siege equipment, which doesn't scale with the unit scale (save for number of crew, which isn't important).

    3. Concerning engines file, when you design chance to immolate a siege engine/ram/siege tower by flaming arrow/bolt/cannon ball, decide whether you lean towards balanced large/huge or small/normal unit scale, as archers placed on walls will be efficient to different degree, depending on number of their soldiers, even if the chance for immolation stays pretty much the same.

    4. Set all battlefield movement modifiers to 1.0 and don't mess with units speed in the EDU, otherwise individual units in the advancing AI army will lag behind/rush forward the formation line (however, it's fine, for whatever point you want to make - have all of particular faction's units & available mercenaries share the same movement modifier, provided the modifier isn't drastic, e.g. belongs to 0.9-1.1 range ... otherwise it will likely create a lack of balance, more benefiting the player!).


    Final Notes

    It's up to you how you design your mod. However, following common sense and advices from this thread will certainly help you create a decent gameplay with solid foundations for competitive XAI performance, should you ever decide to integrate it to your mod. If competitive AI and gameplay associated with AI aren't your priorities but you are instead more inclined to recreating particular lore/history background of your mod, as much as the game engine permits - then these advices won't help you much, however if you took the time to read and confront them with your own design philosophy - I'm more than certain it will help you, even if indirectly - in creating a good mod, no matter it's different design focus. After all we are in the same boat - we mod the same game on the same engine. The engine has set of preferential rules to build mods upon, and it is our choice whether we follow them or not. By no means I claim to have the ultimate knowledge on the subject and I'm open for debate.
    Man is but a shadow of his former self, encased in feverish delusions of grandeur.
    Ignorance is your shield, knowledge is your weapon.
    Heart without reason is stupid, reason without heart is blind.


  3. #3
    Achilla's Avatar Vicarius
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    2,577

    Default Re: Balance Guidelines Project - The Theory Behind XAI-friendly Design

    Technical Run-down (Summary)

    Basic Implementation

    - change 'ship' type of all naval boats to 'heavy warship' ... as for the campaign map, delete 'deep' water and replace it with shallow one, for much better navy pathfinding and more successful naval invasions (good speed of naval vessels over campaign map as well as reasonable distances between continents certainly influence the occurrence of invasions in a positive way)
    - adjust correct classes to individual units ('light' infantry/cavalry to melee infantry/cavalry unable to last for too long in prolonged melee, 'heavy' infantry/cavalry for the opposite, 'skirmish' for mounted & dismounted troops with small range e.g. <=100m, 'missile' for typical missile troops)
    - adjust correct attributes to individual units ('gunmen' and 'guncavalry' to dismounted/mounted firearm troops, 'crossbow' to all crossbow troops, 'can_formed_charge' to heavy cavalry units)
    - use the 'square' formation type for all units, and at all costs avoid using 'horde' (horde formation is unfinished and buggy piece by CA, it will cause crashes and other problems at random over many different mods and AIs)

    General Balance And Advice


    - maintain the same unit size and formation for individual troop classes (spearmen, light/heavy infantry, foot missile/skirmish, light/heavy cavalry, missile/skirmish cavalry)
    - maintain the standard (1.0) unit speed for all units (read the essay above for possible exceptions and their explanation)
    - you might want to add 'area' weapon attribute to heavy lance cavalry charge as well as missile attack of missile units, for better spread of the charge/projectiles
    - delete the 'wedge' formation from cavalry, as it is clearly useless in the game (and beyond our control from AI side ; thus, it will randomly enter the wedge, wasting time and not use it intelligently, if it happened to have a good use)
    - don't go overboard with effectiveness of passive settlement defences, such as towers & boiling oil
    - common sense in unit design (no individual unit is vastly overpowered compared to it's counterparts, balanced army is always more powerful than army composed of the same unit type, plus the stuff covered in essay above)
    Last edited by Achilla; April 24, 2010 at 10:55 AM.
    Man is but a shadow of his former self, encased in feverish delusions of grandeur.
    Ignorance is your shield, knowledge is your weapon.
    Heart without reason is stupid, reason without heart is blind.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •