Skip to content

Commit 68055c8

Browse files
committed
review
1 parent b462c4e commit 68055c8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

draft/use-cases/gaming-user-state.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ There are a few things to note about this document:
140140
character record means you don't have to perform a separate query
141141
to fetch item details necessary for display.
142142

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+
143149
Items
144150
`````
145151

@@ -189,6 +195,9 @@ attribute of the ``character`` documents. The application will use
189195
``location`` as the system of record for interactions between multiple
190196
characters or between characters and non-inventory items.
191197

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+
192201
Operations
193202
----------
194203

@@ -233,7 +242,7 @@ window, you need to merge the information from the ``armor`` and
233242
``weapons`` attributes with information from the ``inventory``
234243
attribute.
235244

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
237246
following Jinja2 template:
238247

239248
.. code-block:: html
@@ -391,6 +400,8 @@ and adds it to their inventory:
391400
{ '_id': character['location']['id'] },
392401
{ '$pull': { 'inventory': { 'id': item_id } } })
393402

403+
.. should not require the $pull from location.inventory
404+
394405
While the above code may be for a single-player game, if you allow
395406
multiple players, or non-player characters, to pick up items at the
396407
same time, you may introduce a problem when two characters attempt try
@@ -477,6 +488,10 @@ In this code, you:
477488
*in his own inventory*, update the character's inventory
478489
representation of the container.
479490

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+
480495
Moving the Character to a Different Room
481496
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
482497

@@ -507,6 +522,8 @@ location:
507522
This operation updates the old room, the new room, and the character
508523
document to reflect the new state.
509524

525+
.. this should not change the location document using earlier changes
526+
510527
Buying an Item
511528
~~~~~~~~~~~~~~
512529

0 commit comments

Comments
 (0)