How can I download code for game levels in iOS?
guys! I want to build a game for iO开发者_StackOverflow社区S, and I need to download levels for it. Levels should allow me to organize conditional statements, simple object discription. I know that downloading any code in iOS is prohibited, so I can't use Lua or smth. But how do other applications solve this problem?
Could you use XML? You can have flags like: <conditionalA>true</conditionalA>
to handle your conditionals and descriptions (textual?) can again be wrapped inside tags:
<descriptionA>description</description>
.
If you meant description in terms of position of objects, you can do things such as
<position>100, 100</position>
Have a look at NSXMLParser
if you do decide to do something like this.
You have some sort of file that describes how the level looks. Lets say you have a game where the user has to walk through a maze. You could have a text file which shows the map:
######## #
# #
# ########
# #
######## #
# #
# ########
Well, this is really simple. The #
characters are walls ...
You could then already implement all the logic in the code that you ship with your application and just download the files describing your levels. So you are not downloading any codes, just files that you have to parse with the code you already shipped
Any code already should be in your app. Downloaded level could only contain data which app could decode and behave appropriately.
Expansion packs, Mods, etc. are all data.
Design your application to read XML / Text / Some sort of serialized data to create level's, characters, events etc.
Then when you want to release something new, You package it up as that data (XML, text, serialized etc.).
You don't need to have code, as your application should already know how to interpret that data.
精彩评论