annotate orpg/dieroller/dieroller.txt @ 155:bf799efe7a8a alpha

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