@@ -140,6 +140,12 @@ There are a few things to note about this document:
140
140
character record means you don't have to perform a separate query
141
141
to fetch item details necessary for display.
142
142
143
+ .. should note that using unbounded lists on items can be an issue, past 1000 entries should prob normalize.
144
+ Also if it ends up being much larger than core data itself, may want to split into own document, to better use RAM.
145
+
146
+ .. Dont understand why the whole location info is stored here: lots of duplication and consistency issues.
147
+ Should normalize here and just store location name / coordinates
148
+
143
149
Items
144
150
`````
145
151
@@ -189,6 +195,9 @@ attribute of the ``character`` documents. The application will use
189
195
``location`` as the system of record for interactions between multiple
190
196
characters or between characters and non-inventory items.
191
197
198
+ .. should avoid storing player information in list here, it may grow and get updated too often if it's MMO.
199
+ Instead rely on index on location on the user collection
200
+
192
201
Operations
193
202
----------
194
203
@@ -233,7 +242,7 @@ window, you need to merge the information from the ``armor`` and
233
242
``weapons`` attributes with information from the ``inventory``
234
243
attribute.
235
244
236
- Suppose, for instance, that your code is displays armor data using the
245
+ Suppose, for instance, that your code displays armor data using the
237
246
following Jinja2 template:
238
247
239
248
.. code-block:: html
@@ -391,6 +400,8 @@ and adds it to their inventory:
391
400
{ '_id': character['location']['id'] },
392
401
{ '$pull': { 'inventory': { 'id': item_id } } })
393
402
403
+ .. should not require the $pull from location.inventory
404
+
394
405
While the above code may be for a single-player game, if you allow
395
406
multiple players, or non-player characters, to pick up items at the
396
407
same time, you may introduce a problem when two characters attempt try
@@ -477,6 +488,10 @@ In this code, you:
477
488
*in his own inventory*, update the character's inventory
478
489
representation of the container.
479
490
491
+ .. I think that the item documents should be immutable, describing types of times in the game.
492
+ Instances of items exists either in a user or location documents.
493
+ A backpack can contain other items, but if player picks up backpack he just get the contained items in his inventory.
494
+
480
495
Moving the Character to a Different Room
481
496
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
482
497
@@ -507,6 +522,8 @@ location:
507
522
This operation updates the old room, the new room, and the character
508
523
document to reflect the new state.
509
524
525
+ .. this should not change the location document using earlier changes
526
+
510
527
Buying an Item
511
528
~~~~~~~~~~~~~~
512
529
0 commit comments