-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNOTES.txt
152 lines (119 loc) · 4.82 KB
/
NOTES.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
BUILT IN COMMANDS
- reserved words - can't be used for any other elements
- make list in hashmap/hashset so can check?
- does this mean can't be used within commands, or can't be made
into actions, or both?
-
- graphs:
location ALWAYS first in entities file
paths ALWAYS after locations
NB: test files will ALWAYS be in a valid format
- command flexibility:
all commands are case insensitive
(incl entity names/locos/built in cmds/action triggers)
MUST CONTAIN TRIGGER && AT LEAST 1 SUBJECT
MUST cope w/ 'decorative' extra words
eg cmd 'chop tree with axe' === 'please chop the tree using the axe'
MUST cope w/ partial cmds
eg 'unlock door' 'unlock with key' === 'unlock door with key'
both give enough detail to try match action
CANNOT use extraneous entities (ie that don't belong)
action must match ALL subjects given in the command
ie can't 'open potion with hammer'
inappropriate subject always === NO match
ambiguous commands:
if >1 valid + performable action: do nothing
send warning
(eg 'there is more than one 'open' action available - which one would you like to perform?')
composite commands:
NOT supported (eg 'get axe and coin' 'get key and open door')
these are doing more than one thing - not allowed
but: can use two triggers for same exact action
- error msgs:
won't be tested for specific messages, just return sth sensible
- they will test by checking game state using cmds (look, inv etc)
testing will focus on 'fair and reasonable' inputs
so not so much pvp edges - more flexibility for valid, likely inputs
user must give enough info to uniquely ID the action
but still have flexibility about exact expression of cmd
ie focus on normal inputs, test cases
- CAN CREATE OTHER CONFIG FILES FOR TESTING
- location unique ID MUST follow 'goto'
- location descriptions:
- ONLY when in that location + do a 'look'
- don't need to display when in other locos
and do a look - just the name
- actions and entities:
only contain alphanumerics
action triggers can have spaces
no tests involving numbers
- actions
- CAN accept two triggers for same action
eg 'chop with axe to cut down tree'
both == same action so this is fine
- BUT NOT FOR BUILT IN CMDS - IF REPEATED
DON'T ACCEPT? BUT THIS ISNT TESTED
- Built in cmds are:
predefined, fixed, well understood
don't need any flexible trigger matching
=> 'look look' / 'goto cabin goto cabin'
aren't valid - 2 cmds in a sentence
- entities
locations / artefacts / furniture/ chars/ player (special kind of char)
entity names (defined in config) are unique
only single instance of an entity within game
- actions
have these elements:
1+ poss trigger phrases
any can be used to initiate action
1+ subject entities to act upon
ALL must be available b4 doing action
narration: human-readable explanation of what happened
(optional) set consumed entities
(optional) set of produced entities
being available means: must be in inv / in that location
== shortcut so can use entities in ur loco w/o picking up
subjects can be locos/chars/furniture which obv can't be picked up
trigger phrases NOT unique - can be multiple open actions
which act on diff entities
trigger phrases cannot contain entity names
(BUT overall cmds obv can)
when received:
- try match trigger phrase
remember trigger phrase can be same for diff actions
eg 'open trapdoor' 'open cellar' 'open treasure chest' etc
so each individ instance of an action is a GameAction
store in HashMap <String, HashSet<GameAction>>
ie < (trigger phrase) <((set of actions))>>
eg <'open', <'open door', 'open cellar'>>
so: 'cut' and 'chop' trigger maps can
both contain set containing 'chop down tree' action
DESIGN:
- get user input, tokenise(just split by whitespace?), match trigger phrase
- do i need to check for valid inputs?
- how does this actually work
- maybe just make it work for valid ones first ?
- action class:
vars for triggers/subjects/consumed/produced/narration (/location?)
method to check if valid based on current game state
method to execute action
use Factory pattern?
- locations:
paths to other locations / chars / artefacts / furniture
- storeroom
not in game world - no paths to/from it
contains all entities with no starting loco
these won't enter game until an action puts them in a loco
- multiple players:
ALL before ':' == name
ALL after ':' == command
valid names: upper/lower chars, spaces, apostrophes, hyphens
NO registration process for new players
ie if new user suddenly enters:
create them + place in start location
command MUST be applied to right player
==> some game state must be stored separately for players
eg current location, inventory - what else?
'look' command: SHOULD show other players in the description of a loco
(but not yourself)
- 'cut tree chop down tree' - this is allowed as same action