Saturday, October 23, 2010

On the Prototype to be programmed

Once again, I think back to the blogs I have been writing and I realize that I am not the best communicator. The last couple blogs are like sketches of tiny pieces of a great technical schematic, with little mention of what the schematic is for. This blog is attempt to remedy that. To give some kind of goal to what all those little sketches are for. For the programmers, after reading this, all of you can mention off a complete, ideal, and clear list of details that you need before you start programming.

The very first thing to be programmed, tested, and got "right" is a basic combat protype. The goal of this is to get the heart of the game fluid, balanced, workable. This is where players will be spending most of their time. When we get this part right, a solid third of the work on the game will be complete.

GUIThe Basic Combat Prototype needs a very limited GUI. The GUI will be for testers to create and customize characters. There will need to be a character creation screen, and a combat screen. In the character creation testers can 1)set levels, class and race. 2)set the fab-five attributes 3)set armor/weapons appropriate to their level. Experience points are not needed for the basic combat prototype. In the combat screen, the testers will be able to see 1)their character's mana, health, attack and def ratings. 2)the same for their opponents. 3) Buffs and de-buffs on all characters. 4) a way to pick what actions the characters will do during the round of combat. 5) color coded text, at the end of combat, indicated combat resolution.

Remember, combat in this game is entirely turned based. Just like the squaresoft games. The important difference is that no selected action resolves until all characters have chosen an action for a particular round.

Classes The details of each class are yet to be determined. For the sake of the BCP, we will create Fighters, Rangers, Rouges, and Mages. The classes will relate to each other in rock-paper-scissors relationship. Fighters will have the advantage against Rangers, Rangers against Rouges, Rouges against mages, and mages against fighters.

Priests will be excluded for now since healing is an imbalancing force. Hybrid classes (Druid, Paladin etc) will also be introduced later.

Vanilla Abilities/Calcualtions. There will, of course, be vanilla abilities that are needed in combat. Here they are: Damage(melee weapon), chance to hit/crit(melee weapon), initiative, damage(ranged weapon), chance to hit/crit(ranged weapon), damage(spell), chance to hit/crit(spell), chance to evade, chance to block

How all of this is determined is the subject of another blog.

Special abilities These are the class specific abilities like a wizard spell or a heavy strike with a weapon. All of this will be determined later. These abilities are important because they will help determine how the classes have advantages on each other.

Weapons and Armor Levels will limit what types of weapons characters can use. Like wise with weapons. Armor will be classified as cloth, light leather, heavy leather, and metal. Armor will have a numerical rating. When the rating is compared in a ratio of cloth : light leather : heavy leather : metal will be 1 : 1.5 : 2 : 3. For instance, if a level 1 wizard has armor that gives him a rating of ~10, than a warrior (wearing metal) will have armor rating of ~30. Higher levels will have access to stronger and strong armor, but the rating will always be in the same ratio. Armor will affect 1)chance to hit, 2)damage absorbed.

Weapons will be much easier. Thing of D&D 2.0 rules. All weapons have damage, speed, and type. we don't even need to worry about type of damage. All we need to list is that "Long sword deals 1-8 base points of damage." The base is multiplied by a character attribute. This will be discussed in another blog.

Initiative This is probably the most tricky part of the Basic Combat Prototype. Initiative will *not* determine what order a player chooses what he will do in a around. Rather initiative will determine a chain of events that resolve at the end of a round of combat.

Initiative will be first decided by a random roll between 1-20. Higher numbers, mean that the character's actions resolve first. Weapon speeds subtract numbers. Casting time subtract numbers. Speed potions add numbers. Magical buffs add numbers. Here's an example of how it works:

GoodRouge1, GoodFighter1 and Goodfighter2 are in a battle with Evilmage1 Evilmage2 and Evilranger1. All characters choose actions:

Goodrouge1 -> Attack(Evilmage2)
GoodFighter1 -> Cast KnockOutPunch(EvilRanger1)
GoodFighter2 -> Attack(EvilMage2)

EvilMage1 -> Cast FrostBolt(Goodfigther2)
EvilMage2 -> Cast PoisonCloud(GoodRouge1)
EvilRanger1 -> Attack(Goodfighter2)


Now that every has chosen their action, initiative is decided. The order is based on random rolls, weapon speeds, and casting times. After the rolls are decided, the order looks like this:
1. GoodFighter1 -> Cast KnockOutPunch(EvilRanger1)
2. EvilMage1 -> Cast FrostBolt(Goodfigther2)
3. EvilRanger1 -> Attack(Goodfighter2)
4. GoodFighter2 -> Attack(EvilMage2)
5. Evil Mage 2 -> Cast PoisonCloud(GoodRouge1)
6. Goodrouge1 -> Attack(Evilmage2)


Each step fully resolve before the rest of the chain. So GoodFighter1 -> Cast KnockOutPunch(EvilRanger1) resolves first. The Knock Out punch suceeds. The ranger is now unconsious for x rounds, and his actions this round are negated. The order now looks like this:

1. GoodFighter1 -> Cast KnockOutPunch(EvilRanger1) (Resolved)
2. EvilMage1 -> Cast FrostBolt(Goodfigther2)
3. EvilRanger1 -> Attack(Goodfighter2) (negated)
4. GoodFighter2 -> Attack(EvilMage2)
5. EvilMage2 -> Cast PoisonCloud(GoodRouge1)
6. Goodrouge1 -> Attack(Evilmage2)


Evilmage1 now cast frost bolt. It succeeds. Frost bolt does damage, and addition subtracts from all initiate rolls. In this case, the subtraction from initiative rolls. In this case, the subtraction from Goodfighter2's roll is enough that his original roll is now lower Evilmage2's roll, but still higher than Goodrouge1's roll. The new order looks like this.

1. GoodFighter1 -> Cast KnockOutPunch(EvilRanger1) (Resolved)
2. EvilMage1 -> Cast FrostBolt(Goodfigther2) (Resolved)
3. EvilRanger1 -> Attack(Goodfighter2) (negated)
4. EvilMage2 -> Cast PoisonCloud(GoodRouge1)
5. GoodFighter2 -> Attack(EvilMage2)
6. Goodrouge1 -> Attack(Evilmage2)


Evilmage2 casts PoisonCloud. The Rouge happens to have an item that makes him immune to poison. It fails. The next order looks like this.


1. GoodFighter1 -> Cast KnockOutPunch(EvilRanger1) (Resolved)
2. EvilMage1 -> Cast FrostBolt(Goodfigther2) (Resolved)
3. EvilRanger1 -> Attack(Goodfighter2) (negated)
4. EvilMage2 -> Cast PoisonCloud(GoodRouge1) (resolved)
5. GoodFighter2 -> Attack(EvilMage2)
6. Goodrouge1 -> Attack(Evilmage2)


You can see how this goes on and on. Now, the players will never actually see all this text as the chain resolves. That is just for the computer to work out for programmers to conceptually understand. Instead, they will only see the final result at the end of the round. The final output of this round of combat will look like this:

Goodfighter1 knocks out Evilranger1! for 233pts of damage
Evilmage1 fires Frostbolt at Goodfighter2 for 140pts of frost damage.
Evilranger1 is unconscious.
Evilmage2 casts Poison Cloud on EvilRouge1! Target is immune!
GoodFighter2 attacks EvilMage2 for 430pts of damage!
Goodrouge1 attacks evilmage1 for 230pts of damage!


The numbers for damage here are arbitrarily chosen, as this example was only meant to show how end-of-round combat resolution works with initiative. After this output, the players will again choose what their characters will do.

Fluidity One of the most important things in BCP is a sense of fluidity. Have you ever played a game where your character's NEVER hit their targets, and combat moves at a slow pace? That's annoying. Players need to feel that they are getting somewhere in combat, espeically PvP combat. Thus, no matter what kind of math we do to come to calculate formulas, the following things should be true between evenly matched characters.
1. Two evenly matched fighters should land hits against each other approx 60% of the time. Before armor de-buffs are considered.
2. A mage, when casting spells that have a chance to hit, (Frostbolts, fire bolts, magic missles) should hit evenly matched warriors approx 60% of the time, before armor de-buffs are considered.
3. Stealthed Rouges should have only a 10% chance getting spotted by a opposing character if the rouge's DEX matches the opposing character's PRC and they are of equivalent level.
4. Spells that do not use chance to hit (spells that do not act like thrown projectiles, such as a sleep or fear spell) should only be resisted approx 10% of the time among evenly matched characters.
5. Dueling between two evenly matched characters should not last aprrox 5-9 rounds, before healing is considered.

Wow. This turned out a lot longer than I expected. My hope is that all of you reading this will have a better understanding of what I am going for. I really want to give anyone who writes the program of this exactly what they need in order to understand how this program will be developed.

The Basic Combat Prototype will eventually be used to test, tweak, and just balance in the game. Before that happens though, I ask anyone to email me a list of things they need in order to write an algorithm, and eventually a program, that can run this.

This is goal of everything else posted in the blog for now. Lots of brainstorming and such will have to take place, and lots of feedback from programmers is needed before I can write up a final document.

Sunday, October 17, 2010

On Zynga's success,

I've read a few articles on Zynga's success that I think are worth sharing. For those of you who don't know (which is probably not many of you) Zynga is the big dog of big dogs when it comes to facebook games. They are the ones who gave the world Mafia Wars, Vampire Wars, and Farmville. This article covers the greatness and challenges that are Zynga.

Thus is given to us the potential greatness and expected obstacles.

According to this article, Zynga's April 2010 revenue was 50 Million. This is good news for anyone creating a facebook game. Because, while the industry is "block buster driven" most of us will be satisfied if we ever become one tenth of one percent as good as Zynga is. That would be 50 thousand in one month, by the way.

The article is a bit dated, but it is here for your enlightenment.
Zynga creates, launches, and manages games better than any other company. Games are a hit-driven business and have become more like Hollywood blockbusters in their heavy development costs and large marketing budgets. It is not inconceivable for EA to spend many years and $100 million to create and market a new game.

Zynga does this at a fraction of the time and cost. For example, the company took just 5 months and 25 people to launch CafĂ© World, which now boasts close to 30 million players. The company did this for likely under $10 million in development and $20 million – $30 million in marketing. So it has both a development and marketing cost advantage over EA and other traditional gaming companies.


There is one other article. Such as the complicated relationship between Zynga and Facebook, which can be found here. Facebook, is moving over to facebook credits. This might a be a huge adjustment for facebook gamers.
Facebook could force Zynga to adjust its math. More than 90% of the company's revenues come from users converting real cash into proprietary virtual currency. FarmVille, for example, has Farm Coins. Say you buy a tractor for 5,000 Farm Coins, which equals about $3.30. Typically the company pays less than 10% of that to a third-party transaction handler such as PayPal and keeps the rest. (In March, PayPal said Zynga was its second-largest merchant after eBay.)

Facebook is testing a service called Facebook Credits that would offer a single virtual currency for use on many different apps. If the social network forces app makers to use Facebook Credits, as some developers expect will happen this year, Zynga would have to pay the company up to 30% of every transaction. "If Credits become pervasive, I don't think Pincus can stop it. It's going to hit the margin," says Peter Relan, executive chairman of CrowdStar, one of Zynga's many competitors.


I invite everyone's thoughts. Specifically, if you were to monetize a facebook, how comfortable are you with "facebook credits" and what would you need to know? Furthermore, on a shoe-string budget, how do you think a game might be promoted?

Of course, one need only really imitate the masters. However, there is always room for improvement.

Monday, October 11, 2010

Hit Points and levels.

Apparently, according to Adam, I actually do not need to come up with formulas. Nonetheless, I like formulas and will keep using them.

Formulas are my friends. So constant. So dependable.

Anyway, a few things need to be said before getting into hit point calculations. First, whenever a character levels up, the player will have the opportunity to raise one attribute by one point. So if a character has the following "fab five" basic attributes:
Str 13
Dex 14
Prc 9
Wil 12
Int 10

The player can raise the Str to 14 or the Prc to 10 or so on and so on. This helps fulfill two important aspects of gameplay: Players fill in control of their character's development and (in combat) there is a degree of data hidden to the player or "incomplete knowledge." So if you, the player, are fighting a warrior, you would not know if your opponent favored Dex or Str. You might guess he didn't emphasize Wil, but you would never know. Knowing everything about the the other character's stats is little bit like playing poker where everyone has an open hand.

The important Stat for this blog is Str. Str is used to determine overall hit points of a character. There are few things that I am trying to do when I calculate hit points.
1. Hit Points should raise with level, and raise in such away that we avoid "diminishing returns." If you're a level 2 warrior with 16 hit points, and you raise it by 8, that's great. If you're a level 20 warrior with 80 hitpoints, another 8 is not a great gain.
2. Hit points are dependent on Str, but not only Str. Each level should give you some extra hit points, and if you add to your Str, you will get even more.
3. Warriors should have the most HP, Rogues the Second most, and Mages the least. These differences should become more and more pronounced as the levels increase.

I think many people might come up with a better formula, but here's how I have thought it up.

h = Str * b
h = total hit points. This will range from 320 - 4000 depending on class, level, etc.

b = the base hit points. The base hit points increase at a constant rate based on class and level. Str is not yet applied.


Base hit points will be calculated using the compounding interest formula. This will avoid diminishing returns.

b = p(1 + r)l

p = equals "principle" hit points (sorry, can't think of a better term!) which will be different for each class.
r = the rate of increase each level, also different for each class.
l = character level.


"p" for warriors, rogues, and wizards will be 42, 40, and 38 respectively. "r" for warriors, rogues, and wizards will be .055, .05, and .045 (or 5.5%, 5% 4.5%) respectively.

When all this is put together, we get a nice graph that reflects the range and progression of hit points. A "strong" character is one in which the player increase Str every fourth level. A "weak" character is one in which the player increases Str every sixth.



Obviously, this does not reflect the full range of hit points. It is possible to have a warrior who has 40 Str and around 8000 Hp, but he would be clumsy with his weapon (low Dex), vulnerable to all kinds of spells (Low Wil and Int) and would never catch that Rogue sneaking up right under his nose (Low prc). He'd basically be brute idiot. Much like "dim" in "A Clockwork Orange."

Now here's the real challenge. These numbers do not mean a whole lot unless they are compared with how much damage can be dealt in a single round. Obviously, "balance" is hard thing to master. However, I think that if something like Hit Point scaling remains constant, then there is a reference point for all else to adjust to.

Of course, this part of the game is not set in stone and can be changed.

How does this look?

Sunday, October 10, 2010

Saving Thorws part II

Hello friends.

After much discussion with James Shewey, I feel that I need to do another post on game mechanics. Specifically "ability checks." The biggest challenge of this project is for me to really learn how to communicate, so I really value all the feedback I get from programmer types. There are few things that should bedisccued first. Here's the goes.

First terminology: what I am describing is no longer called an "ability check." Ability check will get to confusing. This will hence forth called "saving throws." This is because (as will become clear later) what the throw is against will be more important than what ability is used.

Secondly, all the saving throws are character versus character, rather than character versus environment. In this blog I am dealing with "saving throw to catch stealth" "saving throw to resist fear" "saving throw to escape entanglement" etc.

Third, there are goals. These are guidelines, for expected gameplay, that any way of setting up saving throws should conform to:
Guideline 1: If character is making a saving throw against an ability of another character of equivalent level and equivalent relevant attribute (str, prc, etc) than the chance of success should be about 8-10%. This is for sake of player enjoyment, and a sense of action in battle. Players will become frustrated if their abilities work only 50% of the time, or even fail 25% of the time. In sum: success of saving throws should be fairly rare among even matched characters.

Guideline 2: If the defender's level > attacker's level that should increase the chance of a successful saving throw. The inverse is also true.

Guideline 3: If the defender's ability > attacker's ability that should increase the chance of a successful saving throw. The inverse is also true.

Guideline 4: Unequal levels and unequal abilities will affect probability of a save, as above, but it should be very difficult for the probability to ever reach 1 or fall to 0. For instance a defending player is only two lower, and his ability is two lower, than he should still have a chance to save (though it will be lower than 10%). This is because of a bit challenge in game play: it should be hard to have your spells never fail or your defending player always resist.

Guideline 5: Items, buffs, may increase the chance of the saving throw, but not the ability that the saving throw uses.

Okay, so hopefully that should serve as a guide. Keep in mind, gameplay and good gameplay is the goal of all the game mechanics.

The basic function (object? class? I don't speak programmer) is a very simple formula:
Probability to save = (ad-p+b)/ad
ad = relevant ability of defending player.
p = the penalty. This must always be greater than 0.
b = the bonus to saving throw. This comes from equipment or spell buffs. The details of those things are for another blog.


The variable "a" will be whatever relevant ability is used in the saving throw. "p" is where all the work is done. How "p" is calculated will depend on the type of saving throw.

So the function for saving throw is (ad-p+b)/ad. What kind kind of saving throw determines both a and p.

So if the saving throw is "catch stealth" then:
p=sa+(aa-ad)+(la-ld)
a = defender or attackers ability
l = defender or attacker level
sa = stealth rating of attacker. How this will be calculated will be subject of another blog.


If the saving throw is "resist fear" then:
p=ma+(aa-ad)+(la-ld)
a = defender or attackers ability
l = defender or attacker level
ma = power of fear spell. Like stealth, how it is calculated will be for another blog.


Now right here, I think I need to slow down. I am not a programmer, and I need to explain my ideas to programmers.

So, am I on the right track? Is this way of handling saving throws making sense in programmer mindset?

Wednesday, October 6, 2010

Ability Checks... you know like a saving throw.

I've been lax in posting updates recently. I have been doing a lot of thinking. So much that's keeping me excited. There's been some things that I have had people help me work through. The question of abilities, I think is settled for now after much discussion with James and Stu. Here are the "fab five" attributes that all spells, hit points, mana points, and abilities will be based on:
Strength (Str)
Dexterity (Dex)
Perception (Prc)
Will Power (Wil)
Intelligence (Int)


Players rating can expect to vary between five to twenty.

The first thing I propose needs discussion is the ability checks. [i]Ability checks[/i], as the name implies an ability check is the chance to perform an ability. These might be spotting a thief, resisting a spell, climbing a wall, etc. All ability checks depend on one of the fab five attributes.

Rather than following the D&D d20 checkes, ability checks will be based on this formula:


This very easily turns into a percentage. The numbers on the top -numerators for those of you remember math- is were all the work will be done. "a" will always be the player's attribute that is used for the check. The penalty, which will have to be at least '1' is the difficulty of the check. The higher the number, the greater the difficulty. The bonus, which will normally be zero, is something spell or item that gives the greater chance of sucess at this ability check ("break door") without affect the attribute that affects the particular check ("Str")

Example Galstaff, Sorcerer-of-Light, is trudging through a dungeon. He has a Perception (Prc) of 12 and is about to walk near a trap. Galstaff has no special equipment to catch traps. The trap is well hidden, so the penalty is 10. Galstaff's check to spot the trap is calculated like this:


Galstaff then has a 16.7 percent chance of spotting the trap. *Roll 2d10* Galstaff fails the check, springs the trap, and half a dozen scorpions fall comically on Galstaff, Sorcerer-of-Light's head.

The next Galstaff returns to the dungeon after learning a new spell called "foresight." Foresight gives Galstaff a +3 bonus to detect traps and stealth. Galstaff agains nears an undetected trap. This time his ability check looks like this.



Galstaff now has a 41.7 percent chance to detect the trap. *roll dice* Galstaff fails to detect the trap. He slips into pit trap, hurts his foot, and curses his crappy, public-school, magical education.


This is fairly simple check. This is a great way for an ability check is a character versus environment check. But in order to cover character versus character interaction, more things are needed. If defending player is attempting to resist or counter the ability of an opposing character, the difference between those two characters' level should be taken into account. Hence this formula:



Now obviously, when you calculate level-of-defender minus level-of-attacker you can get a negative number. The result then would be just further penalty.

Example He-man, a level 10 warrior, has Will Power of (Will) of 13. Skeletor, a level 8 Warlock, is attempting to cast "fear" on He-man. Skeletor is a half-wit wizard, so the penalty is only 5. The calculation is done this way:


He-man has a 76% chance of success. *roll dice* he does. Skeltor casts Fear on Cringer to feel better about himself.


A second character vs. character comparison is a comparison of the attributes of each character. The defending character is always the one who will make the check, but the following formula takes the difference between the defenders attribute and the attacker's attribute:


ExampleCheney, the hunter, has a Perception of 14 and is checking to catch a stealthed Rogue with a Dexterity of 17. (Since a rogue's stealth is depended on dexterity, that is that attribute compared) The penalty is 8. The forumla then looks like this:


Cheney has a 21.4 percent chance to notice the Rouge. *roll dice* fail. Cheney shoots a deer instead.


That then, is my introduction to Ability checks.

Concerns? Questions? Please, anyone who is confused, please let me know.