SacredSkull / untitled-incremental

Some kind of vague incremental clicker...
1 stars 0 forks source link

Create save database (or add new tables to current database) #35

Open SacredSkull opened 9 years ago

SacredSkull commented 9 years ago

The save database contains player/game information. Basically it serializes your completed research and projects (ID), your parts inventory (ID, quantity) and your current employees (ID, name, avatar, stats). There will eventually be (much) more than that, but basics for now.

Full read and write support is required on these tables, so more work than the others will be necessary. This first iteration will include a much smaller subset of data, meaning that the database schema is likely to change in the future.

There are two options:

I personally feel that adding another database, whilst increasing complexity, is the better option. We'll eventually need to test the saving functionality, and this approach would mean simply deleting or copying over the save.db file instead of fiddling with SQL.

This would also allow us the option of storing many saves! In the menu all you'd need to do is select a save and the game would load the relevant database, which sounds beautiful to me.

SacredSkull commented 9 years ago

After some research, I've found that writing to files (such as the save database) under the Web Player environment is not possible. http://unity3d.com/support/documentation/Manual/Unity%20Web%20Player%20and%20browser%20communication.html

The only way to load data is through javascript, whether that is in turn through HTML5 local storage (https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API) or cookies (not recommended).

SacredSkull commented 9 years ago

I think that the IndexedDB specification will be the right choice