Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-07-2010, 01:58 AM   #1 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Johanovski is on a distinguished road
Default Which is the best way to save game data?

Hi there!

I'm working in a game where I want to save each screen's data once they are completed. There will be about 50 levels and I want to save 2 variables for each level, a BOOL and an integer (this is about a maximum of 100 saved variables).

Which is the best way to do this? Should I use NSUserDefaults or it can't store that amount of data? If it's the case, how should NSUserDefaults be used?

I used to save game data on a file in my first game, but it's really slow to open and save a file each time I want to save / load data... It's an option to use SQLITE, or maybe it's unnecessary?

Thanks in advance!
Johanovski is offline   Reply With Quote
Old 05-07-2010, 10:04 PM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Location: Cincinnati, OH
Posts: 14
EverydayApps is on a distinguished road
Default

Quote:
Originally Posted by Johanovski View Post
Hi there!

I'm working in a game where I want to save each screen's data once they are completed. There will be about 50 levels and I want to save 2 variables for each level, a BOOL and an integer (this is about a maximum of 100 saved variables).

Which is the best way to do this? Should I use NSUserDefaults or it can't store that amount of data? If it's the case, how should NSUserDefaults be used?

I used to save game data on a file in my first game, but it's really slow to open and save a file each time I want to save / load data... It's an option to use SQLITE, or maybe it's unnecessary?

Thanks in advance!
That's not too much data. You could just store it in memory in a dictionary. If you need to write it to a file, because the user quits or something, just write the dictionary to a plist.
__________________
EverydayApps is offline   Reply With Quote
Reply

Bookmarks

Tags
files, load data, nsuserdefaults, save data, sqlite3

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 324
15 members and 309 guests
Abidullah, baja_yu, cgokey, Duncan C, Fstuff, gbenna, guusleijsten, jbro, mdpauley, n00b, newDev, Sami Gh, seokwon lee, stanny, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,877
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:42 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0