#### Topic: Game Mechanics Creation (WIP)

##### Game Mechanics Creation
1. Introduction

3. Fate Points

4. Rolling the Virtual Dice(11D)

5. Difficulty

6. Skills

7. Aspects

8. Stunts

9. Stats

10. Alignment

##### Introduction

When building a game the most important aspects of not only its play-ability but also its creation is that
it's fun and exciting, with that in mind what follows is a special game mechanic's creation engine
inspired by the “Fate Engine” that will aid you in accomplishing just that.

Most things in the system are rated according to the ladder below. The ladder operates on the
math.random(-5, 5) function and Returns a random number between a min and max (-5 or +5).

Lua Function

``print(math.random(-5, 5))``
• +5 Epic

• +4 Fantastic

• +3 Superb

• +2 Great

• +1 Good

• 0 Neutral

• -1 Fair

• -2 Average

• -3 Mediocre

• -4 Poor

• -5 Terrible

A Positive (+) result equals success, a Negative (-) results equals failure, and a Neutral (0) result might
equal a draw.

Positive Result Example:
Your character attempts to attack an enemy, and the result of the roll is +2 (Great) so the
amount of damage equals that of your characters hit points +2.

Negative Result
Could mean that not only did your character “Miss” when attempting to strike
his/her opponent but in the process they might have stumbled and injured them selfs. So not only did
they “Miss” but they took 2 points of damage, to there Health, Armor or possibly there Reputation.

Neutral Result

##### Fate Points

Character Hero's or Villon's push the very boundaries of what “normal” characters are capable of, and
as such, they tend to be Superb at whatever their central passion is. Because “special” characters exist
beyond the boundary's of what is considered normal, We have Fate Points. A Fate Point is used to skew
the “Ladder Result” so that we can raise them above what would be considered typical.

Fate Point Example
Your character attempts to attack another character, and the result of the roll is -2 (Average),
this character has failed at an attempt to attack his/her opponent and in doing so they stumble
and fall, injuring them selfs and take 2 points of damage to there armor. We then use a Fate
Point and reverse the “Ladder Result” making the outcome become +2 (Superb) and our
opponent is dealt an mount of damage equal to our characters hit points +2 additional points of
damage.

Earning and Losing Fate Points:
Fate Points can be earned and lost, several different ways.

1. Earned on a +5 and lost on a -5 result.

2. Completion or Failure of a difficult task.

3. Enchanted or Cursed objects

##### Virtual Dice (D11)

Last edited by zester (2013-10-05 20:56:57)

#### Re: Game Mechanics Creation (WIP)

I really like that dice system, however i think math.random function could possibly ruin everything.
I have read it is not working like a true dice (not so random.. at all) and from my test i can confirm it behave very weirdly.
for example, generate a number between 1 and 10, sometimes (pretty often even)  it looks like it's stuck on a given number for 5-6 times

#### Re: Game Mechanics Creation (WIP)

Vegas wrote:

I really like that dice system, however i think math.random function could possibly ruin everything.
I have read it is not working like a true dice (not so random.. at all) and from my test i can confirm it behave very weirdly.
for example, generate a number between 1 and 10, sometimes (pretty often even)  it looks like it's stuck on a given number for 5-6 times

You are correct math.random does not well lets just quote the lua docs ...

This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical properties.)

So there is no guarantees on its randomness, I am not exactly sure what to do about it. We could bind something a bit more high quality like Boton? Don't know but I am defiantly up for suggestions.

A Test I did.

``````> print(math.random(-5, 5))
4
> print(math.random(-5, 5))
-1
> print(math.random(-5, 5))
3
> print(math.random(-5, 5))
3
> print(math.random(-5, 5))
5
> print(math.random(-5, 5))
-3
> print(math.random(-5, 5))
-2
> print(math.random(-5, 5))
3
> print(math.random(-5, 5))
-2
> print(math.random(-5, 5))
1
> ``````

For the moment I am not going to really worry about it until I have something working I was going to write a GameMechanics class
in lua.

But I am also using math.random in a AI system I am writing.

Last edited by zester (2013-10-06 03:40:02)

#### Re: Game Mechanics Creation (WIP)

I just got finished watching 2 hours worth of videos on game mechanics at PAX.
Here is one of the videos:

There is so much that goes into game mechanics that is sorta tires me. haha. I mean, the most popular games today (I understand now) use very basic game mechanics if any.

It seems that if a mechanic doesn't have a specific purpose or intended outcome, then it is useless, or it can create another mechanic in and of itself.

One thing I have deduced from it all is that before any work goes into any sort of mechanic or anything, the overall PURPOSE of the game has to be established. Everything else has to be designed to fit the purpose.

I really don't play games myself, except for games that help me learn some skill I can use in real life.

Most modern games use lazy mechanics to make you feel you have accomplished something, but meanwhile in your actual life you can't even cook your own food. But that is the purpose of those games, so that they can get your money and your time. Etc.

After learning about game mechanics, I think the only type of game i could get some sort of satisfaction out of is one that is educational.

As far as RANDOM goes, i stumbled across something called randomseed() a while ago, because math.random wasn't actually behaving random enough:

http://twolivesleft.com/Codea/Talk/disc … it-work/p1

Last edited by Tutorial Doctor (2013-10-06 04:10:01)

#### Re: Game Mechanics Creation (WIP)

math.randomseed() is only useful for really large ranges of numbers. Besides I think the math.random problem only exists on Windows and Mac  on Linux it appears from that thread you posted it works fine.

I think if we switch over from standard Lua in Maratis to Luajit we can use the FFI interface and just bind c code directly.

No changes to maratis should be needed, except compiling against the luajit lib instead of the standard lua lib.

FFi Example

``````local ffi = require("ffi")
ffi.cdef[[
void Sleep(int ms);
int poll(struct pollfd *fds, unsigned long nfds, int timeout);
]]

local sleep
if ffi.os == "Windows" then
function sleep(s)
ffi.C.Sleep(s*1000)
end
else
function sleep(s)
ffi.C.poll(nil, 0, s*1000)
end
end

for i=1,160 do
io.write("."); io.flush()
sleep(0.01)
end
io.write("\n")``````

I will have to give it a try.

Last edited by zester (2013-10-06 05:30:42)