Anonymous committed 40c2711

Added some design principles for the scripting language.

Comments (0)

Files changed (2)

 #!/usr/bin/env python
 # encoding: utf-8
-from textrpg import Char, story, ask, give_exp
+from textrpg import Char, story, ask
 from save import save
 name = ask("What's your name?")
 # First load the chars for better gameflow. 
     - Lazy loading modules, to be able to print stuff at once without having to print before the imports.
     - Add getting experience for groups and show the chars together (only one experience header instead of one per char). 
+Basic design principles for the scripting language: 
+    - The action is character centered wherever possible and useful. 
+       -> char.say(text) instead of dialog(char, text)
+    - Anything which affects only one character or any interaction between only a few characters which is initiated by one of them gets called from the character via char.action(). 
+       -> char.compete_skill(char2, skill_name) instead of competition_skill(char1, char2, skill_name)
+    - Anything which affects the whole scene, or a whole group of not necessarily interacting characters gets called as basic function via action() or as class in its own right via class.action(). 
+       -> save([char1, char2]) instead of
+    - The seperate class way should only be chosen, if the class can feel like a character in its own right and needs seperate states which may or may not be persistent over subsequent runs. 
+       -> For example AI.choose_the_way(players_answer) or music.action()
+    - Data should be stored inside the chars wherever possible. If a script gets started with the same character again, the situation should resemble the previous one as much as possible, except where dictated otherwise by the story. 
+       -> instead of 'on quit' store_char_data(char) + 'on start' load_char_data(char)
+    - Actions should be written as verb_noun or simply verb. 
+       -> char.say() and char.compete_skill() instead of char.text() and char.skill_compete()
 The code for the TextRPG can be found at U{}
 from textrpg_1d6.char import Char as ews_char
 def _(text):
-    '''String function to allow localizing later on)'''
+    '''String function to allow localizing later on. '''
     return str(text)
 class Char(ews_char):