Crafting with multiple inputs

Consider a game with a crafting system. Imagine that crafting an object requires several inputs.

  1. Crafter skill level
  2. Input A
  3. Input B
  4. Input C

The qualities of these inputs may be variable.

  • The crafter's skill level varies as the crafter gains experience.
  • Metals: how well refined it is
  • Food product: age and suitability
  • ... etc ...

Imagine that any input can have a quality rating from 0 to 100%. The quality of the inputs can affect the quality of the resulting product. To implement this, we must create a function to determine the output quality. Let us call our inputs [A,B,C,D], each ranging from 0-1, and create some example functions.

  • Multiplication: q = A * B * C * D
  • Summation: q = (A + B + C + D)/n where n is the number of inputs
  • Sum of squares: q = (A^2 + B^2 + C^2 + D^2)/n
  • sqrt(Sum of squares)

The multiplication function emphasizes differences from 1.0, the netural position. The addition of flawed components will create greater flaws in the result.

The summation function minimizes the effect of flawed components on the end result. The addition of perfect components will even out the result toward 1.

The sum-of-squares function will produce results somewhere in the middle of these two extremes. Taking its square root will push the quality value toward 1.

The choice of function is up to the game designer. It will help to throw several functions and examples into a spreadsheet and see what ranges of results you feel are appropriate for your game.

Crafting with weighted inputs

How about weighting the inputs so that some will matter more than the others? You will need to rewrite your algorithm.

Rules for weighting:

  • Inputs with a larger weight will have more influence on the result than inputs with a smaller weight.
  • If all weights are equal, the result should be the same as the unweighted algorithm.
  • If one weight approaches infinity while the others hold still, the result should be as if all other weights are zero.

Let us call the inputs [A,B,C,D] and their weights [Z,X,Y,W].

Helper functions

It may help to calculate how much any weight differs from the mean average weight of all objects in the set. For input weights of [5, 1, 4, 2.8], this produces [1.5625, 0.3125, 1.25, 0.875].

  • f(Z) = Z/(Z+Y+X+W) * n where n is the number of weights

It may also help to adjust the values of the weights relative to the largest weight. For the same inputs, this produces [1, 0.2, 0.8, 0.56].

  • g(Z) = Z / max(Z, Y, X, W)

Function redesign

The multiplication function (q = A * B * C * D) emphasizes the input's difference from 1.0 and compounds these differences as more inputs are added. We can create a helper function m(input, weight) to adjust this difference relative to the weight. For weights [5, 1, 4, 2.8] and all inputs 0.9, this produces [0.9, 0.98, 0.92, 0.944].

  • m(A,Z) = 1 - (1-A)*g(Z)

An analogue to the multiplication function becomes:

  • q = m(A,Z) * m(B,Y) * m(C,X) * m(D,W)

The summation function is easily modified by multiplying each input by its weight, then dividing by the sum of weights.

  • q = AZ + BY + CX + DZ / (Z+Y+X+W)

The sum of squares function can be modified similarly to the summation function.

  • q = (A^2*Z + B^2*Y + C^2*X + D^2*W) / (Z + Y + X + W)


Here is some bonus math that I was working on the other day. Imagine that you have three different crafting functions Z,X,Y that take inputs A, B, and C.

  • Z = A + 2B
  • Y = 0.5A + 2B + C
  • X = B + 3C

Now imagine that you have volumes of A, B, and C in storage; let's say 40A, 80B, 20C. How does one maximize production? This is a solved linear algebra problem so you should go looking for the appropriate method in your language's math libraries.

In Python, you lay out the functions like this:

a = [
        [1.0, 0.5, 0.0],
        [2.0, 2.0, 0.0],
        [0.0, 1.0, 3.0]
]
r = [40,80,20]

print scipy.optimize.linprog(c=(-1,-1,-1), A_ub=a, b_ub=r )

optimize.linprog() is used because linalg.solve() will give you negative numbers.

What if you want to weight the functions so that one is more valuable than another? I'm still working on it.

In most RPGs, health does not replenish between battles. You have to go to an Inn.

Getting ground down over a large number of battles, with enemies taking a small amount of HP at a time, is boring. A solution to the boredom problem is to have a smaller number of battles where the enemies do more damage. This now poses another gameplay problem: normal enemies will tear you apart unless you have healing items, so it is possible for part of the game to be impossible if you are one health potion short. The solution to that problem is to make it easy to reheal to full health between battles by making healing spells cheap and putting healing areas in dungeons. Some game developers threw up their hands and let your party automatically restore to full health between battles. We also have a conceptual change in that HP no longer represents fatigue. If you restore to full health all of the time, you are no longer getting ground down.

Let's split the middle.

First, we will make the combat attributes - HP, MP, Mental State, etc - the final result of a multi-stage process where one stage draws energy from the previous stage over game-time.

Core -> Reserve -> Immediate

  • Your Core energy is a huge stockpile that represents all of your energy for the day.
  • Your Reserve energy is refilled from your Core energy at a relatively low rate. That is basically its purpose, to prevent Core from being drained in a single encounter.
  • Your Immediate energy is what you use in battle. You cast magic using MP. You swing a sledgehammer using physical energy. Your Immediate energy is refilled from your Reservoir at a relatively high rate. You can get tired by fighting too many things at once, but if you get away and rest a while, you can recover.

The result is a system where your HP will normally refill between battles, but will not be refilled all the way if you immediately run into a second battle on the next square.

Now let's extend the idea. You can fiddle with the transfer functions. Maybe they work slower as Core goes down. Maybe they work slower as the target reservoir fills up. Maybe there is an external variable that pushes down your maximum refill over time. The result now is a system where you might restore back to full health after twenty steps, but five battles later, going twenty steps may refill you back to 80% health. Ten battles latter, twenty steps may refill you back to 60% health. Your dungeon divers are now getting ground down over time, and there is a logical and gameable system behind it.

If you need energy RIGHT NOW, you could cast a spell to refill the Reserve by burning a significant chunk of Core. You might be healthy again but your health will not restore as quickly as the other party members. Suddenly there is a downside to casting those cheap healing spells.

Your spoony bard and spoiled princess may run low on Core energy and start falling over before the hardier blacksmith, ranger, and solider. The energetic attacker whose skills go all-out may run out of steam before the others. You might be encouraged to swap out the active members of your party to let the members with low Reserve recharge.

This system could work well in action RPGs or any RPG with a day/night cycle that tries to represent the passage of time.

The conventional handling of technology upgrades in a video game is fairly simple:

  • Item stats go up
  • Cost of next upgrade goes up

The better games will open up new branches of gameplay possiblities, but let's leave that out of the discussion.

I've been playing a game where the tech upgrades often produce surprisingly large leaps in power. The game makes the player choose between replacing items with the newer technology (which costs a limited supply of money) or waiting for the next upgrade (which may be either a minor upgrade or a huge upgrade). These upgrades appear to be hardcoded. What if they were randomized?

It is common for modern roguelike games to have categories of upgrades. Upgrades only start with the classical D&D +1, +2, +3 system. Then there is a category of upgrades that upgrade one stat, a "rare" category that upgrades two stats, and a "legendary" category that upgrades three or more stats. The upgrade categories are usually color-coded for your convenience.

Let us consider a game where the player pours resources into research, and imagine possiblities of different outcomes.

  • Complete failure. The scientists shamefully report that the plan didn't work and they have to go back to the drawing board. However, there is an increased chance of succeeding in the next research attempt. This was used in the DOS game Stellar Conquest 2469 (stelcon).
  • Two steps forward, one step back. Two (or more) stats are upgraded, while one (or more) other stats are downgraded. This reflects the TANSTAAFL principle.
  • Technology branch. A new branch of research is opened for this type of item. This may involve a downgrade of the item stats. However, because this is a new and unexplored branch of research, the cost of advancement is reduced. This can be considered a subcategory of "two steps forward, one step back".

In a game where different item choices require different gameplay styles, the optimal choice of items may become different for each time the game is played. Imagine a space combat game where missiles got cheap and powerful in one playthrough while their range and reloading speed improved in another playthrough. Imagine an RTS where in one playthrough your ranged units get increased range while in another playthough they get increased hit points. Imagine an RPG where in one playthrough your healer gets reduced cost and casting time of your healing spell while in another playthrough only the healing power improved significantly. The behavior of the game components may change just enough to make the player choose a different strategy, increasing replay value.

This is starting to sound like removing the upgrade tree from player control. My intended vision was for randomized upgrade paths resembling organic evolution, where each upgrade is the starting point for the next upgrade. Imagine that a crafter develops a new technique which requires more time and resources but produces a more resilient product; you can continue using the old technique or refine the new technique.

Counter-thought: the Dragon Warrior series randomized the values of upgraded stats when a player gained a level. It barely affected the game because the characters were different enough in their skillsets that the trivial differences in stats did not matter; the stat upgrades were guided by weights for each character class; and the randomness approached a mean average over enough levels. If the upgrades are expected to be different enough to affect gameplay when the game is replayed, these normalizing factors need to be overcome.

One of my game ideas that I'll never get around to developing is a multi-generational RPG where the initial party of heroes fights some battle against the stereotypical evil force, then their kids fight the next part of the battle, and then their kids finally defeat the evil, where this is driven by a game engine and not a written script. How would this work?

1. The player must be enticed to retire the party.

Possible mechanisms:

  • The party defeats the local evil that they see and misses the big picture. With no remaining quests, the party automatically retires.
  • In-game full party wipe. Survivors flee.
  • Randomly throw romantic encounters at the player until the player accepts the option to marry and settle down, or a limit is reached where the character automatically chooses this option.
  • Randomly cause events that cause fighters to leave the party until the player is left with so few fighters that the party is guaranteed to get wiped out if they keep attacking, leaving the player to decide that retiring is the better choice.

2. The next party should have the potential of being stronger than the last.

This follows naturally from the retirement of fighters being a game. Children should have traits similar to those of their parents, plus a little bonus for having been raised by heroes.

3. The evil force regrows strength between generations.

There must be low-level targets for your kids to beat their swords against before they go into the final dungeon. The game engine will randomly generate a series of local villains, missions, and travel mechanisms between continents that open up when previous missions are completed.

4. The game environment changes between generations. Towns grow. Buildings fall into disrepair and are replaced. NPCs have children, get old, and die.

Drawbacks

While the idea is intriguing, there are drawbacks.

Randomly generated content is not as interesting as well-written scripts. If the characters are randomly generated and the mission engine pulls random events out of a bag of tricks, the dialogue cannot be written toward specific characters. The game cannot have all of the little things that make a good RPG stand out from rpgmaker amateur hour.

If the player gets a different randomly generated set of kids on each playthrough, there is no emotional attachment. There will be an emotional backlash on additional playthroughs when the player's kids are different from the ones on their first playthrough, as someone who remembers the adventures of their daughter Sara may be a bit grumpy when they get a son named Fred.

Characters cannot be used as points of reference from which to talk to other players about the game. "You know that character...." they don't know that character. At best, the game can keep a log of events and players can share logs.

Abstraction

There is a freeware flash game called Idle Monster Slayers that is basically Cow Clicker with an implementation of generational improvement. The game's rules are:

  1. Gold is produced over time.
  2. Click the button to trade gold for an increase in the rate of gold production.
  3. Soul Orbs are produced over time at high levels, and increase the rate of gold production when the game is reset.
  4. Click the reset button to collect Soul Orbs and zero out the rest of the game.

During any single playthrough:

  1. Player strength rises linearly over playing time.
  2. Difficulty rises geometrically or exponentially over the length of game content that the player completes.

There eventually reaches a point where it takes more and more playing time to gain the slightest advantage, and the marginal gain of additional leveling up approaches worthlessness. The player may choose to give up at this point, and the game provides a mechanism where giving up will produce a bonus on the next playthrough.

Player strength is modified by a bonus that increases in each generation, allowing the player to reach a further point in the game before gains are stymied.

Many good video games have a feature that I call "novelty progression". As the player advances through the game, they are continuously introduced to new experiences that are outside of the core game experience. One form of novelty progression is "feature progression" in which the novelties will change the core game experience.

As an example of a game with novelty and feature progression, consider Starcraft's single-player campaigns. You begin the campaign with a small number of units available to you and new units with new abilities are unlocked as as you progress through the game. You continuously encounter new environments and new enemies, and you are given an unfolding story with new characters and new twists. Furthermore, every stage has something different from the core game in terms of gameplay. There are scripted events, a timer, hero units with spoken dialogue, allied units to rescue. Several missions only give you a small tactical squad and no base with which to produce additional units. None of these changes to the gameplay are overdone to the point of being considered a normal part of the game. Once you beat all of the missions and become used to one of the races, you start over with a second and then a third race whose strategies are different.

What makes novelty progression work? First, there must be a solid game core that is fun to play without the novelties. The novelties must be new and not something previously seen with a different skin. Also, with so many games having been produced, novelties must not be the same thing that the player has seen before in many different games unless it is done well in a new way. A desert level or an ice level might have been awesome in its own right in the 1980s, but today you will have to add something special.

What makes feature progression work? The new features must be useful, so that you can use them in more than one place. They must be more than keycards. Also, new features must not break the game unless they are added near the end.

The Metroidvania category of games are based on feature progression. Get the item that makes you jump higher and you can reach the next cave. Get the item that lets you swing around and you can reach the next cave. Get the item that lets you blow up barriers and you can reach the next cave. As already mentioned, feature progression works best when you can use these features in normal gameplay.

The Legend of Zelda is worth mentioning in terms of feature progression. Of the many items you get, you can use many of them in normal gameplay but generally half of them are not very useful outside of the one place where you need them. However, very few of the items are totally useless in normal gameplay. In the original LoZ, the fire, arrow, and bomb were usable in normal gameplay but had enough drawbacks to not be worth using. The programmers got around this drawback by providing enough places to use these limited-use items to make them seem more useful to the player.

There have been some experimental Flash games that are based on feature progression (or progressive feature removal). One that comes to mind is Tower of Heaven.

RPGs are based on novelty progression with their storylines, environments, NPCs, and enemies. They also have some feature progression in that as the game progresses you get new abilities with new effects that may change your decisions in battle. This feature progression has tended not to work well even in big-name games because the new features either are game breakers or are degraded to the point of uselessness to prevent them from becoming game breakers. Game developers also have a tendency to introduce all of the classes, elements, and status effects early in the game or by the midpoint rather than progressively introducing them a bit at a time throughout the game. This may be justified by certain features of RPGs being subtle enough, with calculations based on many factors, that the player might not notice some of these features unless an early tutorial introduces them.

What happens when a game has a good core but does not have novelty progression? You get the RPG trope "You must collect ten blue ratsasses" where you keep getting assigned the same task with a trivial difference. You get the Arkandian game series in which there's a very nice RPG engine but every event is the same and you've played out the game in fifteen minutes, after which you're only raising numbers for the next ten hours until you reach the end of the scripted content. You get bored, and that is the ultimate condemnation of a video game.

Page generated Sep. 20th, 2017 04:24 pm
Powered by Dreamwidth Studios