views:

72

answers:

4

Are there any tutorials on how to calculate 'outcomes' for events in a game, based on inputs like character strength, weapers, etc.

Also, how do you go about making things progresively harder and challenging.

I'm not looking for math for things like graphic rendering, visual objects moving around etc.

This is for figuring out if e.g. a character beat the 'bad guy' based on characteristics of the character like strength, level, training, weaponar, etc.

Hope this makes sense.

+1  A: 

I don't know of any tutorials, but the concept isn't all that difficult. Each character (the player and the NPC in your case) have certain characteristics. Each one of the values for the characteristics is used as part of an equation to calculate a value for the character. The character with the greatest value wins the fight.

Those equations can become increasingly complex as you add characteristics, but the concept remains the same.

As for making things more difficult, you can increase the values of the characteristics for your NPCs (making them harder to beat). You could also add more NPCs to the world which means the player encounters more fights, thus taking more damage, thus making the game harder.

Justin Niessner
+1  A: 

You can simulate the battle. Run the simulation, for example 100 times, and count the number of times the good guy wins. You now have a number that you can use to estimate the strength of an encounter.

Gamecat
+2  A: 

For player p, let their score be S_p where

S_p = C_1 x w_1 + C_2 x w_2 + ... + C_n x w_n

where C_i = characteristic score i for the character (e.g. strength) and where w_i is the weight of the characteristic

To normalize, it's probable easiest to have w_1 + w_2 + ... + w_n = 1

For a simple outcome simply compute the score for both players and compare - larger wins.

For something more complicated, you could do some sort of random draw to add a bit of randomness into the equation (i.e. the weaker one could be having a good day and visa-versa, allowing the weaker player to triumph).

To make the characters stronger, you simply increase their character scores. You can extend this as much as you'd like - if you really wanted, you could start randomizing the character scores a little (i.e. the character feels particularly strong that day), etc.


An example: Say we're working of three characteristics, each weighted the same (1/3). PlayerA has scores: 10, 8, 20. PlayerB has scores: 11, 8, 4.

  • S_A = 1/3 x (10 + 8 + 20) = 38/3
  • S_B = 1/3 x (11 + 8 + 4) = 23/3

So using the simple scoring, PlayerA wins easily. Even with randomization, he's pretty sure to win against this PlayerB, but hopefully you get the idea.

cristobalito
+1  A: 

There is a lot of imformation in AI Game Development: Synthetic Creatures with Learning and Reactive Behaviors

Lior Kogan