Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  


The Goal: to use javascript for everything.

The Project: A javascript version of Space Trader. (mainly to determine feasibility of javascript for large projects)

The Snag: Data persistence between page visits.

Ideally, this should be client side, so that no server side login system needs to be developed.

the way it works on the palm is to save a big blob of data, and I have modeled a similar blob of data in the javascript version.

in order to serialize this data as a single blob, I am using JSON Strings. Everything was going along swimmingly. I can serialize objects to strings in a compact manner and vice versa.

the way i chose to serialize the data client side was through cookies, where I have run into my first disappointing problem.

cookies can only be 4k.

my data (blank data with all zeros and empty strings) is 24k, and is likely to be twice this size or more when it holds "real" data.

and there is really no way to get it less than 4k, period.

so, i figured, i'll split it up into strings that aren't too long, and store it that way. no problem.

but i have since done a little more digging. I have found out that only 300 cookies may be stored on a machine at a time, and only 20 cookies per domain, so , at best, I can have about 80k worth of data that I can serialize to cookies, and these cookies are in great danger of clobbering or getting clobbered by other cookies.

it's beginning to look like a login system. time will tell.
Sign in to follow this  

1 Comment

Recommended Comments

Well there's AIR, which exposes real file objects to javascript (as well as SQLite), but then you're outta the browser.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!