DonkeyKong
DonkeyKong

Reputation: 1272

Objective-C game class serialization advice (hand coded XML file)

I am looking to create / instantiate the levels and level enemies of a game I'm creating from an xml file at runtime that I will initially edit by hand until I have time to create a level editor. Once I have time to make the editor, I wish to automatically serialize and save my levels to disk. My enemy class uses CGPoints, floats and enums, along with basic datatypes like NSString.

Being new to objective-c, I am having trouble working out the most efficient way of doing this. NSPropertyListSerialization appears to only support basic data types and from reading the docs, it looks as though NSCoder serialises / deserializes using its own format.

Any advice is appreciated.

Upvotes: 1

Views: 106

Answers (1)

user529758
user529758

Reputation:

This library enables you to save any object to a property list and this one to JSON without making any additional effort. If you're wondering how they work, have a look at the Archives and Serialization Programming Guide.

Upvotes: 2

Related Questions