Fable 3 or blogging … that has been my big choice lately in the mornings. I still do my tai chi, just not as much, and I’m feeling more pain in my back and bad leg as a result. However, like many here I’m a sucker for a good game. I actually lost about a month of my life to Fable 2 back in August 2009 when I was going to physical therapy twice a week for my low back and leg. It was rather difficult to go looking for work during that period so I let myself fall into gaming for a while.
Anyway, the Fable series is something I want to look at, along with the Elder Scrolls series, Dragon Age, and classic Dungeons and Dragons. But first, I just finished reading “Reality is Broken” and am now moving onto and am about halfway through a book called “The Drunkards Walk” by Leonard Mlodinow about probability theory. I’m not really a math geek, but I appreciate mathematics as a tool in the way that I appreciated a quality ratchet set when I worked as a mechanic and millwright. That is to say as long as I hold accounting apart from other forms of mathematics. I really can’t stand accounting, I barely know how to do it right, and the rule of credits and debit confuses the (*insert curses here*) out of me.
Because my wife’s candle making is taking off I’ve actually been having to do quite a bit of accounting type work lately to get her bookkeeping set up in MS Office since I can’t afford QuickBooks at the moment. Serious pain in the backside work to be sure but it has to get done. I personally believe I deserve at least 100 perseverance xp every time I get a supply order entered into the Access d-base I’m building for her. Data entry and accounting rate about as high on my personal satisfaction scale as the time I worked as the third shift corn cook in a tortilla factory. That job literally revolved around pressing a button every 15 minutes.
Probability on the other hand, is interesting and ties directly in with what I want to accomplish in game design and game building. Of course, probability theory walks hand in hand with statistics and I’m a firm believer in the famous Benjamin Disraeli quote “there are three kinds of lies: lies, damned lies, and statistics.” This quote being true only because like with probability theory most people don’t actually understand statistics very well. Don’t tell me the mean or the median income in the United States when I actually want to know the mode (most commonly reported figure) income in the United States.But what does all this have to do with gaming and game design?
Answer, a (*insert expletive here*) lot. AI works on probabilities. Reality works on probabilities. Probable randomness is likely the greatest factor in determining the course of a person’s life. Everything we do to affect our lives is simply the shifting of probabilities to try and get a more positive outcome. Going to college in my late thirties does not guarantee a job at Bethesda software (where I would really love to work, that or a job with the IFTF would be nice). It just increases my probability of finding work outside the trades I have worked in before. Being slightly older than the average college student and being mildly (very mildly) disabled decrease my probability of finding work.
When writing an AI for NPC characters in a game the algorithms to control behavior have to use probability. So what are the probabilities that govern behavior? I wish I knew those formulas, but I don’t think they actually exist so we just have to guess at them. This is where Fable, Dragon Age, Elder Scrolls, and D&D come into play.
There is a term in ethics “Phronesis” that refers to practical judgment. When to apply which ethics on which situation. Which makes it a critical thinking skill. But how do we program artificial critical thinking, how do we code phronesis? It seems to me that the first step is to look at character interaction. What the Fable game series excels in is showing physical interaction between the player character, and the NPC’s. What Dragon Age seems to excel in is conversational interaction. The interactions between PC’s and NPC’s have to make a shift in the probabilities on beneficial or detrimental actions by the NPC towards the PC. The formulas in Garth Sundem’s “Geek Logik” could possibly be used as a starting point for a new probabilistic AI. But to use them we need to record and quantify a lot of information.
This is where Elder Scrolls and classical D&D come into play. Elder Scrolls records both fame from completing most “good” quests and infamy from completing “evil” or unethical quests. Classical D&D uses alignment categories to help a person determine character behavior. I’ve always liked the D&D system of alignment because it was one of the first to popularize the notion that disorder (chaos) is not inherently evil and order (law) is not inherently good. It also helped spread the concept of ethic neutrality, which is where most people and animals fall. While many people tend to fall towards the “good” side of neutrality animals are ethically neutral.
To get NPC characters to behave as realistically as possible we can use these for examples to help determine the basic information that needs to be recorded: personal like or dislike (Fable, Dragon Age), fame and infamy (Elder Scrolls), tendencies towards good or evil (D&D), tendencies towards order or randomness in behavior (D&D), personal responsibility (Elder Scrolls), and I would like to add phronesis. As for how to quantify all of these factors – that is why I turning from mathematics to pseudo-mathematics as represented in the following video:
http://www.youtube.com/watch?v=c1hLzQPio_8
This is the so-called vortex mathematics. While I doubt many of the claims made by Randy Powell and Marko Rodin I have a feeling their work can be applied to building a new software engine for AI. I may be wrong, but what harm does it do to try and figure something out. The core technique they seem to be using is something called “Theosophic Reduction,” reducing a multiple digit number to a single digit by a process of repeated addition. This is a cryptographic technique to goes back at least to ancient Hebrew culture when letters also represented numbers and synonyms could be found using the numerical values of words made with those letters.
I don’t know if this can be used as a basis for a practical form of mathematics or even adapted to compute probabilities. However, I’m willing to try which is why I wrote the following code in the JustBASIC programming language:
‘program to perform doubling by iteration and theosophic redution of results
‘and then list the results in tabular format
‘Liam Boyle
‘CIS 120
‘Declarations
‘TotalIteration: Num
‘Iteration: Num
‘NumValue: Num
‘TheoReducValue: Num
‘Count: Num
‘NumValueString$: String
‘NumCharacterString$: String
‘ProcessingCount: Num
‘TempTheoReducValue: Num
‘TempTheoReducValueString$: String
‘SubCountA: Num
‘NumValueStringB$: String
‘NumCharacterStringB$: String
‘ProcessingCountB: Num
‘SubCountB: Num
‘ContinueAns$: String
[Start]
Print “Enter total number of doubling iterations”
Input TotalIteration
Dim Iteration(TotalIteration)
Dim NumValue(TotalIteration)
Dim TheoReducValue(TotalIteration)
Let NumValue(0) = 1
Let TheoReducValue(0) = 1
For Iteration = 1 to TotalIteration
NumValue(Iteration) = NumValue(Iteration – 1) * 2^Iteration
Gosub [TheosophicReductionCalculator]
Next
‘Data Table
Print “Numeric Value”, “Reduced Value”
For Count = 0 to TotalIteration
Print NumValue(Count),,TheoReducValue(Count)
Next
Print “Do you want to run again y/n?”
Input ContinueAns$
If ContinueAns$ = “y” Goto [Start]
End
[TheosophicReductionCalculator]
Let TempTheoReducValue = 0
If NumValue(Iteration) <= 9 Then
TheoReducValue(Iteration) = NumValue(Iteration)
Else
NumValueString$ = Str$(NumValue(Iteration))
ProcessingCount = Len(NumValueString$)
For SubCountA = 1 to ProcessingCount
NumCharacterString$ = Mid$(NumValueString$, SubCountA, 1)
TempTheoReducValue = TempTheoReducValue + Val(NumCharacterString$)
Next SubCountA
While TempTheoReducValue > 9
TempTheoReducValueString$ = “”
TempTheoReducValueString$ = Str$(TempTheoReducValue)
ProcessingCountB = Len(TempTheoReducValueString$)
TempTheoReducValue = 0
For SubCountB = 1 to ProcessingCountB
NumCharacterStringB$ = Mid$(TempTheoReducValueString$, SubCountB, 1)
TempTheoReducValue = TempTheoReducValue + Val(NumCharacterStringB$)
Next SubCountB
Wend
Let TheoReducValue(Iteration) = TempTheoReducValue
End If
Return
The key is in the subroutine that turn my number into a string and then splits to string into characters and then converts the characters back into numerical values to add them together in a theosophic reduction process. By taking my initial input as string and using a case statement series I could probably do the same for text values.
My though here is that by using the equations of probability theory and “Geek Logik” and then reducing the results, every step of a behavior can be reduced into nine options based on a mean of normal behavior determined by the initial equation to give NPC responses and actions a more natural and less arbitrary feel than what is found in most games. The phronesis score can then be used to help determine how often any given NPC chooses the “right” or “wrong” action in a situation.
That’s the end of today’s thoughts.
Liam B