Dynamic difficulty in campaigns

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
blob
Posts: 22
Joined: January 17th, 2009, 12:33 pm

Dynamic difficulty in campaigns

Post by blob »

I just read a couple of threads in the User's forum that once again raised a relatively old issue. I admit that I went through the same when I first started playing Wesnoth, and while I think it's less an issue now that I have more experience, I still think that there is a fundamental problem in the way difficulty manifests in campaigns, particularly longer ones.

The problem is that if you play a scenario for the first time, you never know in advance what kind of units you will need, or how many you will need. In the best case, you'll recruit the wrong units or underestimate the opponent by recuiting too few units hoping you'll get more carryover. It's the best case because you'll lose the scenario and have to play it again immediately. In the worst case, you'll recruit the right units, and too many of them, leaving you with wasted money on level one units that you won't bother to recall in the next scenario.

Ultimately, there are two things that can happen during a campaign, and both have an aggravating effect: If a scenario is too hard (not per se, just because of the choices you made in an earlier scenario), you'll likely ending up with many killed units and too few money for the next scenario. In turn, the next scenario will be even harder up to the point where you can't beat the campaign and are stuck. You'll hear this kind of complaint a lot, particularly from novice users. However, it's also possible the other way round. If you recruit the right amount of units and the right units, if you capture all villages on the map, and if you outsmart the opponent, you'll likely ending up with goods amount of gold for the next scenario and a couple of leveled up units. Consequently, you might find the next scenario to be a little too easy. A couple of scenarios further, and you'll just walk through the maps with ease given too much gold and too many veterans. This makes longer campains unstable and is often why campaign designers create gold-eater scenarios or find other ways of "resetting" the army to some common denominator.

I think a potential solution would be an adaptive level of difficulty, carried out by varying the amount of gold the AI starts with depending on your own starting gold and depending on your own recall list.

Assuming you had no recalls, then giving you and the AI the same amount of starting gold should theoretically make the scenario relatively balanced, provided that the AI actually played well (which it doesn't so much compared to a human player), and given that the forces that both sides can recruit are relatively balanced (e.g. like the multiplayer factions). A problem arises when the player is able to recall any higher level unit for a plain 20 gold. If you had a recall list with level twos or higher, then giving you and the opponent the same amount of starting gold will unbalance the scenario in your favor. That's why campaign designers adjust the amount of starting gold for the opponent depending on what they expect you to have in terms of gold and veterans. If you have less than expected by the developer, one scenario after the other will become more difficult till impossible, and if you have more than expected, one scenario after the other will become easier till the point where it's boring to finish the campaign at all.

Consider a level two Swordsman. It is assigned a price of 25g in the Wesnoth Units database. Given 100 starting gold, the AI could buy such a unit for 25g each and get 4 units. You, however, could recall each one for 20g, giving you 5 units for the same gold. This means that if the AI had 125 starting gold and you 100, things would balance out again. Consequently, my idea is that at the beginning of each scenario, your gold and your army should be assessed and translated into a gold equivalent. This could work as follows.

Give the AI the same amount of starting gold as yourself. Now, inspect the recall list. Ignore every unit whose list price is less than or equal to 20g. Sort the remaining units by their list price (e.g. 25g for the Swordsman, 43g for the Royal Guard) in descending order. Now assume the player would just recall all units possible for 20g each until the starting gold runs out. In order to give the AI an equivalent amount of gold to recruit equivalent forces, go through the sorted list and give the AI more gold based on the difference of the list price and 20g. Do that for each unit the player would have gold for to recall. Example:

Recall list: 2x Royal Guard, 4x Swordsman
Starting gold: 100g

Recall list sorted by price:
43g - Royal Guard
43g - Royal Guard
25g - Swordsman
25g - Swordsman
25g - Swordsman
25g - Swordsman

Additional gold the AI gets for each unit (in parantheses: cumulative player's recall gold, cumulative AI's additional gold):
43g - Royal Guard: 23g (20g, 23g)
43g - Royal Guard: 23g (40g, 46g)
25g - Swordsman: 5g (60g, 51g)
25g - Swordsman: 5g (80g, 56g)
25g - Swordsman: 5g (100g, 61g)
25g - Swordsman: 0g (100g, 61g)

In this example, the AI gets an additional 61g on top of the common starting gold of 100g (which may vary depending on what gold the player carried over from the previous scenario). With the 5th unit in this list, the player would have spent all their money on just recalling, meaning the sixth unit (another Swordsman) couldn't be recalled anymore. Naturally, you might have more units in your recall list than you could actually recall because of lack of money. Thus, we ignore this and all following units. So, you'll start this scenario with 100g and your recall list (of which you could still vary the recalls or not recall them at all), while the AI gets 161g but has to rely on recruiting only. Of course, the scenario can be set so that the AI may directly recruit level 2 or level 3 units, but it would have to pay the full price, and this way, your recall list advantage is accounted for in the AI's starting gold. In order for a develope to make a particular scenario easier or harder (or the entire campaign), the AI's starting gold could now be multiplied by some desired factor. Also, in order to make the effect of my idea itself less dramatic, the additional gold the AI gets could be multiplied by a factor, not the entire gold.

Applying such a system in one or the other way could mean that the two directions of aggravation be less of an issue. If you don't have your units leveled up far enough, the opponent will have that reflected by having less starting gold so that the scenario is not impossible any longer, and if you have plenty of recalls and money, the enemy will have that reflected as well so that the scenario is less easy. Overall, it should balance the campaign out more.

Of course, the danger of this system is that it might counteract the idea of leveling up units altogether. Thus, this is an idea, and if deemed interesting would still require some polishing. The idea isn't that the effect of having veterans be less dramatic, but rather that scenarios one, two or three shouldn't decide the fate of scenario 10 and the rest of the campaign. Again, a bad choice in one scenario should eventually even out somehow, while you would also want to have some challenge left later if things are going too well for you now.
The Cost Of Living (1.8): main thread, feedback thread
User avatar
Pentarctagon
Project Manager
Posts: 5732
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Dynamic difficulty in campaigns

Post by Pentarctagon »

isn't this more something that is up to the campaign designer to do with WML?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: Dynamic difficulty in campaigns

Post by Zachron »

I like and/or dislike dynamic difficulty, and which one it is, depends on how it is implemented, and what context it is done so in. Multi-priced recall list... not something I would like. Everyone who ever seems to propose a change to the recall mechanic always suggests something drastic. 43 gold to recall a level 3? That's even worse than the 10 gold per level idea. Costs 3 gold more than the 10 gold + 10 gold per level idea. Why not something as slight as, 15+5 gold per level, or a function of 25% the recruit cost if it's higher than 20 gold. Something this slight would not require massive rebalancing of campaigns like the more drastic measures would.

On the subject of altering the enemy's gold based off player's performance, there should definitely be a ceiling to this. If there is not a ceiling, one could find oneself in a situation whereby having too much money makes a scenario impossible to complete in the confines of the turn limit. (Striking down entire lines of enemies every turn, only to have them immediately replaced by never-ending recruits, can stop an advance in it's tracks)
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
Post Reply