StendhalDesign: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
No edit summary
imported>Hendrik Brummermann
m Reverted edit of Eitdkesww, changed back to last version by Slady
 
(267 intermediate revisions by 8 users not shown)
Line 1: Line 1:
This small doc tries to make a contract agreement about what is stendhal and what it needs to include. It considers the existing [[http://arianne.sourceforge.net/wiki/index.php/StendhalObjectives#Roadmap Roadmap]] and tries to give a coherent vision of what we are trying to get.
This small doc tries to create an agreement on what stendhal is about and what it needs to include. It considers the existing [[StendhalObjectives#Roadmap Roadmap|]] and tries to give a coherent vision of what we are trying to create.


Consider using the Discussion tab to query about particular things or making suggestions.
Please use the Discussion tab (found in the menu at the top of the page) to query about things or make suggestions.


= Plot =
= Plot =
Stendhal's plot is to grow pigs by taking them with you to eat on the plains or the forest.<br>
Stendhal's plot is to grow Sheep by taking them with you to the plains or forest to graze.<br>
The task is not simple because you will have to look after them because hungry wolves will try to eat your pig. So be careful and protect your pig.
The task is not as simple as it may sound though, as you will have to protect them from hungry wolves! Use your skill, strength and wit to destroy the attackers.


Pigs must be bought when small at Farm, and sell later when you grow it at the Village. For each pig you sell when it has grow up, you will get an extra income.
Lambs must first be bought at a Farm and later sold at the Village when they are plump enough. For each Sheep you sell, when fully grown, you will get extra income.


You will need to spend money on getting new weapons and armors and healing potions.
You will need to spend your money on new weapons, armor and healing potions.


As you see Stendhal is a minigame that try to push everything related to RPG:
As you can see Stendhal is a minigame that will try to push and thus test everything related to a fully blown RPG:
* task
* task
* actions
* actions
* areas
* areas


If Arianne get Stendhal working, the problem is just scaling up the result. :)
If Arianne is a successful platform to get Stendhal working, the only issue is scaling up the result. :)


= Design =
= Design =
== Idea ==
== Idea ==
The whole game area would looks like:
The whole game area will look like:


http://arianne.sourceforge.net/wiki_images/Stendhal_Map.jpg
http://arianne.sourceforge.net/wiki_images/Stendhal_Map.jpg


It is split in 4 different areas to test the multizone feature.<br>
It is split in to 4 different areas to test the multizones feature of Arianne.<br>
Players need to change zone in order to accomplish their task.
Players need to change zone in order to accomplish their task.

Our world is made of several entities: players, wolves, rats, sheeps, NPC. By describing each entity with use cases we will simplify later the coding stage.


== Use cases description ==
== Use cases description ==
We need to use several use cases to describe our game.
We need to use several use cases to describe our game.

===Player's user case===
===Player's user case===
Player is an entity that play the game, it can move, chat, attack, heal.
* Player enter village in entry point
* Player moves to Farm zone
* Player talks with pig seller
<pre>
<pre>
Player: Hi
Player enter village in entry point
Player moves to Farm zone
Seller: Greetings! How may I help you?

Player: buy pig
Player talks with Sheep seller
Seller: Do you want to buy a pig for 50 coins?
Player: yes
Player: Hi
Seller: Thank you! Bye
Seller: Greetings! How may I help you?
Player: buy Sheep
Seller: Do you want to buy a Sheep for 50 coins?
Player: yes
Seller: Thank you! Bye

Player moves. Sheep follows Player.
Player moves to plains
Player moves around looking for food
Player protect Sheep of wolves attacks

When Sheep is big enough Player moves to Village
Player talks with Sheep buyer
Player: Hi
Buyer: Greetings! How may I help you?
Player: sell Sheep
Buyer: Do you want to sell this Sheep for 73 coins?
Player: yes
Buyer: Thank you! Bye

Player spend money in new Sheep and equipment
* Armor
* Weapon
* Healing potions
</pre>
</pre>
* Player moves. Pig follows Player.
* Player moves to plains
* Player moves around looking for food
* Player protect pig of wolves attacks
* When pig is big enough Player moves to Village
* Player talks with pig buyer
<pre>
Player: Hi
Buyer: Greetings! How may I help you?
Player: sell pig
Buyer: Do you want to sell this pig for 73 coins?
Player: yes
Buyer: Thank you! Bye
</pre>
* Player spend money in new pig and equipment
*# Armor
*# Weapon
*# Healing potions


===Pig seller's user case===
===Sheep seller's user case===
This seller is a NPC entity that will sell us a sheep to grow it up and make money.
<pre>
FOREVER do:
FOREVER do:
* Listen to Player
Listen to Player

* If listen "Hi":
If listen "Hi":
** Seller says "Greetings <Player>!"
* If listen "Buy pig" from Player:
Seller says "Greetings <Player>!"

** Seller says "Do you want to buy a pig for 50 coins?"
* If listen "yes" from Player:
If listen "Buy Sheep" from Player:
Seller says "Do you want to buy a Sheep for 50 coins?"
** If Player money - 50 > 0:

*** set Player money=Player money - 50
If listen "yes" from Player:
*** Duplicate Pig
*** Make Pig follows Player
If Player money - 50 > 0:
* Say bye to Player
set Player money=Player money - 50
Duplicate Sheep
Make Sheep follows Player
Say bye to Player
DONE
DONE
</pre>


===Pig buyer's user case===
===Sheep buyer's user case===
This buyer is a NPC entity that will buy us our sheep.
<pre>
FOREVER do:
FOREVER do:
* Listen to Player
Listen to Player

* If listen "Hi":
If listen "Hi":
** Seller says "Greetings <Player>!"
* If listen "Sell pig" from Player:
Seller says "Greetings <Player>!"

** Estimate pig value related to Pig weight
If listen "Sell Sheep" from Player:
** Seller says "Do you want to sell buy a pig for <estimated price> coins?"
Estimate Sheep value related to Sheep weight
* If listen "yes" from Player:
** set Player money=Player money + <estimated price>
Seller says "Do you want to sell your Sheep for <estimated price> coins?"
** Destroy Pig
* Say bye to Player
If listen "yes" from Player:
set Player money=Player money + <estimated price>
set Player XP=Player XP + 100 * Sheep Weight / 100
Destroy Sheep
Say bye to Player
DONE
DONE
</pre>


===Pig's user case===
===Sheep's user case===
Sheep is our key game concept. Sheeps must be grow up to earn money and buy stuff.
* Pig is in Farm
<pre>
* Player buys Pig
Sheep is in Farm
* Pig seller duplicates Pig
* Pig follows Player
Player buys Sheep
Sheep seller duplicates Sheep
* If Pig finds food:
Sheep follows Player
** Pig moves to food

** Pig eats food
If Sheep finds food:
** Pig gains weight
Sheep moves to food
* Player sells Pig
Sheep eats food
* Pig dissappear
Sheep gains weight

Player sells Sheep
Sheep dissappear
</pre>


===Wolf's user case===
===Wolf's user case===
Wolf is the compitive entity on Stendhal. They join to attack sheeps and often also players. They can kill a sheep in not a long time.
* Wolf moves
<pre>
* If Wolf sees Pig:
Wolf moves
** Wolf attacks Pig
* If Wolf is attacked:
If Wolf sees Sheep:
** Wolf attacks Attacker
Wolf attacks Sheep
If Wolf is attacked:
Wolf attacks Attacker
</pre>

===Rat's user case===
Rat and Cave rats are creatures that will attack player to make it harder to grow the sheep up.
<pre>
Rat moves
If Rat sees Player:
Rat attacks Player
If Rat is attacked:
Rat attacks Attacker
</pre>




== Entities ==
== Entities ==
The above user cases shows the next entities in our system:
The above user cases describe the need for the following entities in our system:
* Pig
* Sheep
* Pig seller
* Sheep seller
* Pig buyer
* Sheep buyer
* Wolf
* Wolf
* Rat
* Cave rat
* Player
* Player
* Food
* Food
Line 120: Line 164:
* Healing potion
* Healing potion


Let's describe each entity with its attributes and actions related.
Let's describe each entity and its attributes and actions.
=== Pig ===
=== Sheep ===
It has the following set of attributes:
A sheep has the following set of attributes:
* <b>x</b> is the x-position of the sheep
* x
* <b>y</b> is the y-position of the sheep
* y
* <b>dx</b> is the x-speed of the sheep
* dx
* <b>dy</b> is the y-speed of the sheep
* dy
* <b>hp</b> is the life indicator of the sheep, when it reach 0 the sheep dies.
* hp
* <b>atk</b> is the RP attack value. See [[StendhalDesign#RP|RP rules]]
* owner
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* weight
* <b>xp</b> is the RP experience value. See [[StendhalDesign#RP|RP rules]]
* <b>weight</b> is the weight indicator of the sheep, the more weight, the more expensive it is.


Pig tasks would be:
Sheep tasks should be:
* follow
* <b>follow</b>
* eat
* <b>eat</b>


Pig behaviour is mainly to follow owner and look for food.
The sheeps behaviour is mainly to follow its owner and look for food.<br>
If Pig finds food, it will eat.
If the Sheep finds food, it will eat.<br>
Pig will runaway if it is attacked by wolves.
Sheep will runaway if attacked.<br>


=== Wolf ===
=== Creatures: Wolf, rat and Cave rat ===
It has the following set of attributes:
Wolves, rats and cave rats have the following set of attributes:
* <b>x</b> is the x-position of the wolf
* x
* <b>y</b> is the y-position of the wolf
* y
* <b>dx</b> is the x-speed of the wolf
* dx
* <b>dy</b> is the y-speed of the wolf
* dy
* <b>hp</b> is the life indicator of the wolf, when it reach 0 the wolf dies.
* hp
* <b>atk</b> is the RP attack value. See [[StendhalDesign#RP|RP rules]]
* atk
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* <b>xp</b> is the RP experience value. See [[StendhalDesign#RP|RP rules]]


Wolf tasks would be:
Wolf ( and rat and cave rat ) tasks should be:
* <b>follow</b> means that wolf follows an object using the shortest way to reach it.
* follow
* <b>attack</b> means that wolf will try to damage the attacked object until its hp reach 0<br>Another action will cancel attack task.
* attack
* <b>patrol</b> means that wolf will move around a specified path.
* patrol
* <b>chat</b> means that wolf will start to shout 'auuuuuuu!'. Wolves will often understand this as a call.
* chat


Wolf behaviour consists in patrolling some assigned areas.
Wolf ( and rat and cave rat ) behaviour consists of patrolling some assigned areas.<br>
If Wolf finds Pig, it will attack Pig.
If the Wolf finds a Sheep, it will attack Sheep.<br>
If Wolf is attacked, Wolf attacks.
If the Wolf finds a Player, it will attack player.<br>
If Wolf is injured, Wolf will runaway.
If the Wolf is attacked, the Wolf returns the attacks.<br>
If the Wolf is severly injured, the Wolf will runaway.<br>


=== Pig seller and Pig buyer ===
=== Sheep seller, Sheep buyer, Beggar ===
It has the following set of attributes:
The buyer and seller have the following set of attributes:
* <b>x</b> is the x-position of the NPC
* x
* <b>y</b> is the y-position of the NPC
* y
* <b>dx</b> is the x-speed of the NPC
* dx
* <b>dy</b> is the y-speed of the NPC
* dy
* <b>hp</b> is the life indicator of the NPC, when it reach 0 it is reset back to full.
* atending
* <b>atk</b> is the RP attack value. See [[StendhalDesign#RP|RP rules]]
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* <b>xp</b> is the RP experience value. See [[StendhalDesign#RP|RP rules]]
* <b>attending</b> is the object_id of the player that is actually attending.


seller and buyer tasks would be:
seller, buyer and beggar tasks would be:
* <b>patrol</b> means that NPC will move around a specified path.
* patrol


NPC behaviour consists in listening to people near them.
NPC behaviour consists of listening to people near them.<br>
If person says "Hi", NPC faces person and generate conversation.
If person says "Hi", NPC faces person and generates conversation.<br>


=== Player===
=== Player===
It has the following set of attributes:
The player has the following set of attributes:
* <b>x</b> is the x-position of the player
* x
* <b>y</b> is the y-position of the player
* y
* <b>dx</b> is the x-speed of the player
* dx
* <b>dy</b> is the y-speed of the player
* dy
* <b>hp</b> is the life indicator of the Player, when it reach 0 the player dies. See [[StendhalDesign#Dead|Dead]]
* hp
* <b>atk</b> is the RP attack value. See [[StendhalDesign#RP|RP rules]]
* atk
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* pig
* <b>xp</b> is the RP experience value. See [[StendhalDesign#RP|RP rules]]
* money
* <b>money</b> is the quantity of money the player has.


It has three slots:
It has three slots:
* armor
* armor
* hand
* left hand
* right hand
* backpack
* backpack


Player tasks would be:
Player tasks should be:
* <b>move</b> means that player will change its dx, dy params to move.
* move
* <b>attack</b> means that player will try to damage the attacked object until its hp reach 0.<br>Another action will cancel attack task.
* attack
* <b>chat</b> means that player writes text to other players or NPCs
* chat


=== Food ===
=== Food ===
It has the following set of attributes:
Food has the following set of attributes:
* <b>x</b> is the x-position of the player
* x
* <b>y</b> is the y-position of the player
* y
* quantity
* <b>quantity</b> is the amount of food available

Food will be regenerated every X units of time.<br>

=== Armor ===
Armor is an item that player can ''wear'':
* <b>x</b> is the x-position of the armor when player doesn't wear it.
* <b>y</b> is the y-position of the armor when player doesn't wear it.
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* <b>weight</b> is the weight of the armor.

=== Shield ===
Shield is an item that player can ''wear'':
* <b>x</b> is the x-position of the shield when player doesn't wear it.
* <b>y</b> is the y-position of the shield when player doesn't wear it.
* <b>def</b> is the RP defense value. See [[StendhalDesign#RP|RP rules]]
* <b>weight</b> is the weight of the shield.

=== Weapon ===
Weapon is an item that player can ''wear'':
* <b>x</b> is the x-position of the weapon when player doesn't wear it.
* <b>y</b> is the y-position of the weapon when player doesn't wear it.
* <b>atk</b> is the RP attack value. See [[StendhalDesign#RP|RP rules]]
* <b>weight</b> is the weight of the weapon.

=== Healing potion ===
Healing potion is an item that player can ''wear'' inside the backpack:
* <b>x</b> is the x-position of the potion when player doesn't wear it.
* <b>y</b> is the y-position of the potion when player doesn't wear it.
* <b>heal</b> is the amount of HP the potion will heal.


== Actions ==
The key on making Stendhal moving is to add actions.
As we have seen each entity has a list of actions that can do. Let's see them and study they interact.
===Player===
Our main entity is Player, it is gamer's avatar in stendhal world and as such, it is able to do the next set of actions:

====Move====
Move action can be understand as two actions:
Move to left,right,up or down while key is down<br>This action allows controlling gamer's avatar using our keyboard that is the arcade/adventure game style like Nintendo Zelda.

This action should have the next set of attributes:
* '''dx''' horizontal speed of the avatar
* '''dy''' vertical speed of the avatar

We can have as many as we want of this action. The last action executed will be the only one that alters really dx and dy.

====Move to a position====
This action allows controlling game's avatar using a mouse, so we can click ( or double click ) to move to the position where the mouse clicked. This mode is great for a more relaxed adventure game style like Bioware Baldur's Gate.

This action should have the next set of attributes:
* '''x''' desired x coordinate of the avatar
* '''y''' desired y coordinate of the avatar

We can only have ONE action of this type and only the latest one will be considered valid. This action is cancelled by any other action like Move, Attack, Face, ...

Both move actions will have at each end of turn, moving the avatar if it is possible dx units in the x axis and dy units in the y axis.
If avatar collides with something while moving, dx and dy will become 0.

====Face====
This action is useful as a extra for the social side of the game; when you are talking it is often good to ''face'' the person you are talking too. So face action allows our character to look at the direction we tell it: left, right, up or down.

====Chat====
This action is the base of any social game like a MORPG.

This action should have the next set of attributes:
* '''text''' text that the player is going to say

Due to Arianne framework it is not possible to create a yell or whisper action, when you talk, you talk for everybody in the area, that is why area design is *VERY* important to achieve a good gameplay.

====Attack====
This action is the core of the gameplay for lots of gamers to consider the game fun. All the combat is ruled by the RP game system explained in the RP section of this page.

There are some limitations for combat right now:
* No PvP ( Player versus Player )
* Can't attack yourself
* Can't attack NPC

We want to preserve a nice game experience so we have removed player vs player combat.
We can have only ONE attack action, so choose wisely your target, and this action is cancelled by any other action but '''Chat''' and '''Heal'''.

This action should have the next set of attributes:
* '''target''' the object.ID of the player that we are attacking.

This action require that the target of the action is ''near'' our avatar. Near means that target's avatar have to be colliding with our avatar.

The attack action has the implicit meaning of following the target.

====Equipment and Inventory====
This action is very important as it handles most of the complexity and the fun of a RPG: getting new stuff and use items to solve quests.

'''TODO'''

=RP=
Role playing games are based in a set of rules. There are many set of rules: AD&D, GURPS, Warhammer,...<br>
Stendhal defines a new ''typical'' set of rules, that has in common simplicity and ease of computing.

The system is based around 3 ideas:
* Randomness using 1D6
* Risk evaluation
* Creativity

Risk evaluation gives the DM the power to weight up an action that a player wishes to perform against things like how experienced the player is in that type of action and the situation the player is in.

DM stands for ''Dungeon Master''. In Stendhal our task is to design the DM, as it rules the game.

== Attributes ==
Each player has a set of attributes that are:
* <b>attack</b> - this value is used to resolve attack situations.
* <b>defense</b> - this value is used to resolve situations where the player is attacked.
* <b>hp</b> - this value stored the live points available.

* <b>level</b> - this starts off as zero when the character is created and will increase related to experience
* <b>experience</b> - this is the amount of experience gained at the current level

===Entity Attribute values===
The hardest part of any RP is to give balance to the values different entities has.

We need to give RP(atk, def and hp) values to:
====Player====
Let's make our starting player to be:
* <b>ATK</b> - 2
* <b>DEF</b> - 2
* <b>HP</b> - 100

These values have been set randomly.

====Sheep====
A sheep can't attack, so it has to be weaker than player.
* <b>ATK</b> - 0
* <b>DEF</b> - 1
* <b>HP</b> - 30

These values have alse been set randomly according to player values.
Killing a sheep won't report you any experience.

====Rat====
A rat is the simplest enemy you can find in Stendhal, so it has to be simple enought for a Level 1 player to kill.
* <b>ATK</b> - 3
* <b>DEF</b> - 2
* <b>XP</b> - 5
* <b>HP</b> - 10

To set these values we have run a simulation until we have get the right look in the graphs.<br>
http://arianne.sourceforge.net/wiki_images/rat.gif

====Cave Rat====
A cave rat is a stronger version of a rat, so it has to be simple enought for a Level 2-3 player to kill.
* <b>ATK</b> - 6
* <b>DEF</b> - 2
* <b>XP</b> - 10
* <b>HP</b> - 20

To set these values we have run a simulation until we have get the right look in the graphs.<br>
http://arianne.sourceforge.net/wiki_images/caverat.gif

====Wolf====
A wolf is a common creature on plains and forest, it has to be simple enought for a Level 4-5 player to kill.
* <b>ATK</b> - 6
* <b>DEF</b> - 4
* <b>XP</b> - 18
* <b>HP</b> - 35

To set these values we have run a simulation until we have get the right look in the graphs.<br>
http://arianne.sourceforge.net/wiki_images/wolf.gif

== Experience and levels ==
All of the attributes can be increased during the game through gaining experience and levels.
Experience is awarded by DM for several reasons:
* good roleplaying
* use of skills
* combats

Experience can't be gained by training.

When you gain a level you can increase one of the attributes.
To reach a level you need to reach the next experience points:

<table border=1 align=center>
<tr bgcolor=black><td><font color=white>Level</font></td><td><font color=white>Experience needed</font></td><td>HP value</td></tr>
<tr><td>0</td><td>0</td><td>100</td></tr>
<tr><td>1</td><td>100</td><td>110</td></tr>
<tr><td>2</td><td>128</td><td>120</td></tr>
<tr><td>3</td><td>384</td><td>130</td></tr>
<tr><td>4</td><td>768</td><td>140</td></tr>
<tr><td>5</td><td>1408</td><td>150</td></tr>
<tr><td>6</td><td>2432</td><td>160</td></tr>
<tr><td>7</td><td>3712</td><td>170</td></tr>
<tr><td>8</td><td>5504</td><td>180</td></tr>
<tr><td>9</td><td>7808</td><td>190</td></tr>
<tr><td>10</td><td>10624</td><td>200</td></tr>
</table>

As you can deduce the HP grows at a rate of 10 per level, and ATK and DEF values are increased one on each new level.
The formula to calculate XP is:
exp = (10*level+5*level^2+10*level^3+80)

== Combat ==
Combat is a fight between two or more players.

The combat is round based. Each round takes 5 turns.

The risk to strike a player can be written as:
<pre>
Attacker.attack VS Defender.defense/6 + 1D6
</pre>

If player is hit we need to compute the wound that has been done:
<pre>
result = Attacker.attack/6 + 1D6 VS Defender.defense
if result > 0:
Defender.hp = Defender.hp - result
end if
</pre>

Death happens when hp reachs 0.

A critical hit happens when both die rolls are 6. And the damage is equal to Attacker.attack

===Shields===
The shield rating adds to your defense skill:
<table border=1 align=center>
<tr bgcolor=black><td><font color=white>Shield</font></td><td><font color=white>Rating</font></td></tr>
<tr><td>Buckler shield</td><td>+1</td></tr>
<tr><td>Small shield</td><td>+2</td></tr>
<tr><td>Medium shield</td><td>+3</td></tr>
<tr><td>Large shield</td><td>+4</td></tr>
<tr><td>Tower shield</td><td>+5</td></tr>
<tr><td>Green Scale shield</td><td>+6</td></tr>
<tr><td>Black Scale shield</td><td>+7</td></tr>
</table>
* black/green scale shields are dropped from the black/green dragon.

===Armour===
Armour helps you absorb damage.
<table border=1 align=center>
<tr bgcolor=black><td><font color=white>Armour</font></td><td><font color=white>Rating</font></td></tr>
<tr><td>Leather armour</td><td>+1</td></tr>
<tr><td>Studded leather armour</td><td>+2</td></tr>
<tr><td>Scale mail armour</td><td>+3</td></tr>
<tr><td>Chain mail armour</td><td>+4</td></tr>
<tr><td>Plate mail armour</td><td>+5</td></tr>
<tr><td>Field plate armour</td><td>+6</td></tr>
<tr><td>Full plate armour</td><td>+7</td></tr>
<tr><td>Green Scaled armour</td><td>+8</td></tr>
<tr><td>Black Scaled armour</td><td>+9</td></tr>
</table>
* black/green scaled armour are dropped from the black/green dragon.

===Weapon===
Weapon helps you to kill :)
<table border=1 align=center>
<tr bgcolor=black><td><font color=white>Weapon</font></td><td><font color=white>Rating</font></td></tr>
<tr><td>Knife</td><td>+2</td></tr>
<tr><td>Club</td><td>+3</td></tr>
<tr><td>Spear</td><td>+4</td></tr>
<tr><td>Axe</td><td>+5</td></tr>
<tr><td>Long sword</td><td>+6</td></tr>
<tr><td>Two hand sword</td><td>+7</td></tr>
<tr><td>Green Scaled sword</td><td>+8</td></tr>
<tr><td>Black Scaled sword</td><td>+9</td></tr>
</table>
* black/green scaled swords are dropped from the black/green dragon.

== Dead ==
The result of combat is usually dead.

When you kill a creature a corpse will appear. If you open it, you will be able to get whatever it has inside, usually food, gold, weapons, shields or armors.<br>
Each time you kill a monster you are rewarded XP.


When you are killed you reappear on city and you lose your sheep if you have one.<br>
Food will regenerated each X units of time.
Also to penalize dead, you are remove 10% of exp points and if it is the case you are removed HP, ATK and DEF increases because of level up.