The data in the game can be modified during the running of the program. For simple data, you can use UserDefault to store dynamic data, SQLite is more inclined to process large data than xml. in the development process, choose the data storage scheme as needed: UserDefault, xml, json, and sqlite.
The data in the game can be modified during the running of the program. For simple data, you can use UserDefault to store dynamic data, SQLite is more inclined to process large data than xml. in the development process, choose the data storage scheme as needed: UserDefault, xml, json, and sqlite.
Game data is divided into dynamic data and static data
Dynamic Data can be modified while the program is running. For simple data, UserDefault can be used to store dynamic data. SQLite tends to process large data more than xml, select the data storage scheme as needed during the development process: UserDefault, xml, json, and sqlite
Static data is not changed during the program running, such as the title, name of the npc, and price of the item. However, such data may change frequently during the development process, A common practice is to store the data in an external file to prevent hard encoding. For simple data, you can use plist to save the data and use plist to edit the data. By calling
Cocos2d: ValueMap _ dictionary = cocos2d: FileUtils: getInstance ()-> getValueMapFromFile ("static data file name ");
Read the file and cache it to _ dictionary. You can easily use the data in the program.