最好的方式保存/加载iphone游戏数据 [英] best way to save/load iphone game data

查看:144
本文介绍了最好的方式保存/加载iphone游戏数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个益智游戏,游戏引擎拥有一个复杂的对象层次,从游戏角色到向量到过渡动画。根据游戏状态,它们可能从10增加到1000(在极端情况下)。我一直在拖延那一刻,直到我必须努力保存和加载所有的混乱,因为我没有这方面的经验,但现在我害怕的那一刻即将到来。

I'm working on a puzzle game, the game engine holds a complex hierarchy of objects, from game actors to vectors to transition animations. Depending on the game state, they might add up from 10 to 1000 (in extreme cases). I've been delaying the moment until I'd have to work on the saving and loading of all that mess, as I have no experience on this, but now the moment I was fearing is about to arrive.

这是一个好主意使用NSKeyedArchiver吗?它的概念似乎很强大。这样我可以重建对象状态,但包括保存对象之间的指针吗?它是如何表现的性能方面?系统有时间在应用程序终止时将所有这些对象保存在磁盘上吗?

Is it a good idea to use NSKeyedArchiver for this? Its concept seems powerful. That way I could rebuild the objects states, but does that include the pointers between saved objects? And how does it behave performance-wise? Will the system have time to save all these objects on disk on app termination?

推荐答案

我去了NSKeyedArchiver,之间。请参阅:轻松地归档相互关联的对象

I went for NSKeyedArchiver, which does maintain references between objects. See here: Easy way to archive interlinked objects

这篇关于最好的方式保存/加载iphone游戏数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆