Skip to content

Local monster data storage

Freddie edited this page May 4, 2014 · 2 revisions

IDEA

Store monster data on the client instead of having a GIGANTIC data file (current size: 140,213 bytes).

WHY

  • Don't need to redownload the huge JS data for relatively small changes.
  • Mobile friendlier?

ISSUES

  • 'Monster' actually needs to mean 'a whole lot of types of data' - evolutions and active/leader skills being the biggest contributors after monsters.
  • Ensuring that versions get updated on every table could be interesting.

Steps (5 6 7 8)

  1. Update the Monster table to include 'version' column.
  2. Update the import_monsters management command to set any new/updated monsters to MAX(version) + 1.
  3. On initial site load, check for monster data in the load_usermonsters() helper function.
  • No data? Fetch full data from /some/uri/ THEN fetch userdata.
  • Have data but version is old? Fetch /some/uri/7/ (data newer than v7), update data.monsters.
  1. Save data.monsters to localStorage as serialized JSON.
Clone this wiki locally