annotate orpg/dieroller/dieroller.txt @ 248:1df5912db00c beta tip

Traipse Beta 'OpenRPG' {101205-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Sun, 05 Dec 2010 10:53:30 -0600
parents 13054be69834
children
rev   line source
212
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
1 The New Dicing System: A Proposal for OpenRPG
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
2 ----------------------------------------------
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
3
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
4 The current dice system for OpenRPG has several limitations. Foremost
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
5 among these are the fact that adding a new, non-standard dicing mechanism
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
6 requires editing of the basic dice code. There are several secondary
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
7 limitations, such as the fact that while the dice system can handle math,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
8 it cannot be used as a calculator -- it will not allow expressions that do
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
9 not involve dice.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
10
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
11 This proposal is for a new dicing system to replace the current one in
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
12 OpenRPG. Since the dicing system is something that users will interact
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
13 with frequently, a new system needs to be considered carefully. This
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
14 document attempts to describe the new dicing system so that such
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
15 consideration can be given to it. It is expected that this document will
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
16 grow and change as it is scrutinized.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
17
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
18
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
19 Design goals for this dicing system:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
20
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
21 1. Should be easy for new users to get started with, based on knowing
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
22 standard RPG dice notation (NdX) and basic math.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
23
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
24 2. Should, as far as practical, maintain compatibility with existing
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
25 character sheets, etc., that use the current dice system.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
26
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
27 3. Should allow users to create new dice types and new ways of
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
28 counting dice. Ideally, this should not require programming, except
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
29 in exceptional cases.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
30
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
31 4. The dice system should be usable for doing basic math that does
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
32 not involve dice.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
33
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
34 5. The dice system should be able to handle most current RPG dicing
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
35 systems.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
36
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
37 Things this dicing system is designed to NOT do:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
38
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
39 1. Be a programming language. There are no facilities in it for
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
40 user input, output formatting, loops, if-then-else, or similar
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
41 things. If these are desired for something involving dice, an
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
42 appropriate node and nodehandler can be created.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
43
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
44 2. Handle all theoretically possible dicing systems without the
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
45 need for programming plugins. First off, this is impossible.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
46 Second, even making an attempt to would require supporting
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
47 dicing methods that don't actually turn up in any real game.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
48
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
49 3. Handle floating-point math. I don't know of any systems that
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
50 use it in their dice schemes right now. If there are some,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
51 we might have to consider adding it.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
52
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
53
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
54 Syntax Specification
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
55
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
56 What follows is a BNF specification for the proposed dicing system, with
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
57 explanatory text interleaved. At the end of this document is a copy of
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
58 the BNF with no explanations, for those who would like to look at it "all
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
59 together". Note that BNF describes only syntax, and not semantics; thus,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
60 while anything generated with this grammar should be syntactically correct,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
61 that doesn't mean it will make sense or be allowed.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
62
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
63
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
64 dice string ::= <expression>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
65 <expression> of <comparison> | <comparison>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
66
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
67 This is the top level. The major thing of note here is that comparisons
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
68 only occur at this level. This is intentional; the result of a comparison
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
69 is a boolean true/false flag rather than a number. Thus, it makes no
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
70 sense to allow people to perform further numerical operations on the
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
71 result of a comparison. Systems where dice are triggered by the results
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
72 of other dice are left for the realm of plugins.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
73
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
74
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
75 comparison ::= <expression> <relation> <expression>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
76
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
77 expression ::= <factor> | <factor> <low-op> <factor>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
78
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
79 The separation into "low-op" and "high-op" of the operators is to allow
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
80 order of operations to be handled more easily. Syntactically, it's not
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
81 really necessary, but it should be helpful in implementation.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
82
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
83
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
84 factor :: = <term> | <term> <high-op> <term> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
85 <multi-dice> | <multi-dice> <high-op> <term> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
86 <term> <high-op> <multi-dice>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
87
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
88 Here we start to hit some complication. The intent of the different
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
89 entries for multi-dice is that we don't want to allow things like
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
90 [3d6 each * 2d6 each]. We are *not* doing vector multiplication!
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
91 The "expression" level doesn't have any such limitation on syntax;
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
92 things like [3d6 each + 2d6 each] we'll have to either think of a
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
93 logical way to handle, or disallow on a semantic level. (Well... I
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
94 suppose it could be handled in the BNF, but I think it would get
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
95 kind of messy.)
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
96
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
97
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
98 term ::= <dice> | <unit>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
99
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
100 unit ::= <number> | ( <expression> )
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
101
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
102 Dice are not considered a unit. This means that things like [3d6d10] can't
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
103 be done without using parentheses. I consider that to be a win for
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
104 clarity.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
105
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
106
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
107 dice ::= <unit>d<unit> | <unit>d<name> | <dice> <flag> | lastroll
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
108
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
109 The <name> entry here allows for user-created dice (in the syntax, at
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
110 least...).
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
111
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
112
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
113 multi-dice ::= ( <dice>, <dice>+ ) | # (1d6,1d8)
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
114 <dice> each | # 3d6 each
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
115 ( <expression> of <expression> ) | # (3 of 2d6)
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
116 lastroll | # lastroll
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
117 <multi-dice> <flag> # (3 of 2d6) best 2
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
118
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
119 "lastroll" by itself can be either dice or multi-dice. I'm thinking that it
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
120
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
121 should be whatever type the last roll was.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
122
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
123
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
124 flag ::= reroll <condition> | # repeats
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
125 reroll <slice> | # once only
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
126 grow <condition> | # reroll and add
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
127 shrink <condition> | # reroll and subtract
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
128 drop <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
129 drop <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
130 take <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
131 take <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
132 <slice> | # implied "take"
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
133 <name> <condition> | # user-created
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
134 <name> # user-created
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
135
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
136 Technically, we don't need both "drop" and "take" -- one implies the
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
137 other. However, having both should make the language easier to use.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
138
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
139 "reroll" will work differently depending on whether a condition or a
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
140 slice is given. If a condition is given, it will reroll until none of
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
141 the dice in the set meet the reroll condition (or until it hits a maximum
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
142 allowed number of rerolls). If a slice is given, it will reroll those
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
143 dice once. IMHO, this behavior makes the most sense.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
144
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
145 The <name> entries here are to allow for user-created flags. Note that
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
146 as I've specified things right now, a user-created flag can have a
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
147 condition,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
148 but not a slice. That's mostly because I couldn't think of a case where
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
149 a slice would be useful... should we add it anyways?
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
150
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
151
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
152 slice ::= highest | lowest | highest <number> | lowest <number>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
153
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
154 "highest" and "lowest" without a number are equivalent to doing them with
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
155 1 as the number. This is to simplify things like [4d6 drop lowest].
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
156
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
157
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
158 condition ::= <relation> <unit>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
159
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
160 This is for conditions on flags. Note that it can take a unit, so you could
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
161
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
162 use dice in a condition; however, I think the unit should only be evaluated
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
163
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
164 once, to make things faster. Anyone for repetitive evaluation?
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
165
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
166
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
167 low-op ::= + | - | min | max
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
168
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
169 "min" takes two values and returns the highest of them, and "max"
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
170 returns the lowest of them. This might seem counterintuitive, but
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
171 it's meant to be used with dice, like so:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
172
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
173 3d6 min 8 - always returns 8 or higher
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
174
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
175 3d6 max 15 - always returns 15 or lower
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
176
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
177 I decided to put min and max as having the same precedence as + and -,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
178 because if they had higher precedence, then:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
179
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
180 3d6+2 min 10
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
181
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
182 would be equivalent to 3d6+10. (It would take the max of 2 and 10, then
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
183 add that to 3d6). One problem that does arise here is with multiplication
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
184 and division: [1d6 min 5 * 2] will be equivalent to [1d6 min 10], since
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
185 multiplication has higher precedence. We may just want to warn people
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
186 that min and max can be screwy unless you parenthesize, unless someone can
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
187 think of a better way to handle them.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
188
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
189
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
190 high-op ::= * | / | mod
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
191
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
192 The / is integer division, of course, since we're doing integer math.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
193
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
194
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
195 number ::= <digit>+ | -<digit>+
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
196
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
197 Positive and negative numbers are allowed. This means that, syntactically,
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
198 [-2d-4] is legal. Do we want to modify the BNF to disallow this, or handle
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
199 it on a semantic level?
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
200
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
201
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
202 name ::= <letter>[<letter>|<digit>]*
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
203
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
204 We may want to expand to allow underscores and dashes in user-created names.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
205
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
206
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
207
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
208 letter ::= A-Z | a-z
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
209
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
210 digit ::= 0-9
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
211
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
212 relation ::= < | > | <= | >= | => | =< | = | ==
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
213
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
214
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
215
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
216 Well, that's the BNF. Again, at the end is a copy without all the running
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
217 commentary.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
218
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
219
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
220 Thoughts on Implementation:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
221
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
222 First, I think a sort of "dice library" of common functions needs to be
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
223 created. This would include rolling a set of dice, getting the highest
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
224 of a group of dice, growing and shrinking dice from a set based on
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
225 conditions, and so on. These functions should be available for use by
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
226 custom-written dice types.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
227
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
228 Next, that library should be used as a tool in implementing a dice-string
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
229 interpreter. That will require creating a parser for the dice-string
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
230 'language'. This could be either a custom-written parser, or possibly
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
231 one created with some of the Python parser generators. A custom-written
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
232 parser may take longer to do and be a bit more finicky to maintain, but
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
233 it would remove a dependency from the code.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
234
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
235 User-created flags and dice types could be supported in two ways:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
236
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
237 - First, by allowing users to specify strings in the dice language
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
238 that the flags/expressions would expand to -- basically, allowing
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
239 dice macros.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
240
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
241 - Second, by adding hooks for python modules to be associated with
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
242 user-created dice or flag types. This is likely to be the more
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
243 complicated of the two solutions, but it would also be more
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
244 flexible.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
245
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
246 Personally, I think both are desirable -- the first, so that
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
247 non-programming users can create simple die and flag types. The
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
248 second, because by design, there are some things this dice system
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
249 just won't do.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
250
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
251
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
252 Further work needed:
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
253
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
254 - specs for the "dice library"
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
255
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
256 - specs on an interface for python modules meant to be dice and
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
257 flag types.
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
258
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
259 ----------------------------------------------------------------
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
260
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
261 start ::= <expression> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
262 <comparison>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
263
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
264 comparison ::= <expression> <condition>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
265
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
266 expression ::= <term> | <term> <low-op> <factor>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
267
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
268 term ::= <factor> | <factor> <high-op> <unit>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
269
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
270 factor ::= <atom> | <dice_set>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
271
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
272 atom ::= <number> | ( <expression> )
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
273
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
274 dice_set ::= <dice> <dice_set>, <dice> | <expr> of <dice> | <dice> each |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
275 lastroll
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
276
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
277 dice ::= <atom>d<atom> | <atom>d<name> | <dice> <flag>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
278
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
279 flag ::= reroll <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
280 reroll <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
281 grow <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
282 shrink <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
283 drop <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
284 drop <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
285 take <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
286 take <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
287 <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
288 <name> <condition> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
289 <name> <slice> |
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
290 <name>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
291
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
292 slice ::= highest | lowest | highest <number> | lowest <number>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
293
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
294 condition ::= <relation> <unit>
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
295
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
296 low-op ::= + | -
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
297
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
298 high-op ::= * | / | mod| max | min
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
299
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
300 number ::= <digit>+ | -<digit>+
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
301
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
302 name ::= <letter>[<letter>|<digit>]*
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
303
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
304 letter ::= A-Z | a-z
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
305
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
306 digit ::= 0-9
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
307
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
308 relation ::= < | > | <= | >= | => | =< | = | ==
13054be69834 Traipse Beta 'OpenRPG' {100428-00}
sirebral
parents:
diff changeset
309