annotate orpg/dieroller/dieroller.txt @ 228:24769389a7ba alpha

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