Skip to content
mpetrovic edited this page May 12, 2011 · 5 revisions

Extension

Stores all raw data, as well as provides mechanism for loading data on the fly.

Properties:

  • data -- a plain JS object. Data should be broken up by types first, then by a unique-ish machine name identifier. Example:
    • data.npc.soldier_01.all_his_stats
    • data.background.level_01a.some_stuff
    • data.music.city_central.some_stuff
  • url -- where your store is located externally. will be loaded with ajax. or ajaj. or ajah if you really want. I would suggest the server result be JSON, though.
Methods:
  • prepare(type, id, url) -- starts loading data from the server. url is optional.
  • process(type, id) -- callback. takes the result of prepare and puts it into the cache
  • get(type, id) -- gets data from the local cache
  • create(type, id) -- creates an entity of the given type and id. alias for get?
TODO: find some way to store this permanently, so future sessions don't require hitting the server so much? TODO: automate loading such that the game is in a constant state of loading, during gameplay, until it's all there?
Clone this wiki locally