I'm making a top-down RPG for iPhone. I'm using tilemaps (CCTMXTileMap) and the cocos2d-iphone engine.

I've made a class that can handle loading maps and NPCs onto the screen, a class that handles input, and, a class that is supposed to display dialog. The dialog class takes a single string, or an array, and displays it onscreen inside a neat dialog box, hiding the controls until the user taps on the screen, when it cycles to the next message, or if it's the last/only message, hides the dialog.

My NPCs are currently stored in Core Data. Their strings will need to be updated based on quest progress. Also, there are other bits of dialog, like signposts and other messages.

So, where do I put my game's textual content? I don't think Core Data is the right place, because of three reasons:

  1. If my strings are stored in Core Data, I will probably have a harder time translating them.

  2. If my strings are in Core Data, that only leaves me with strings for NPCs (which would be attached to the NPCs in Core Data). Where does that leave everything else?

  3. If I leave my strings in Core Data, it's a bit heavy on the loading operations, no?

Given all of this background information, where do I put my strings and dialog in my game?


What's an efficient way to store strings for an iOS game so that they can be easily accessed, translated and referenced at various parts of the game?

  • \$\begingroup\$ I removed your edit because that is fundamentally a separate question, and should be a separate question. \$\endgroup\$
    – Tetrad
    Commented Nov 7, 2011 at 3:35
  • \$\begingroup\$ See also gamedev.stackexchange.com/questions/31/… \$\endgroup\$
    – Tetrad
    Commented Nov 7, 2011 at 3:35

2 Answers 2


Unless you have some particular requirements for portability, formatting, or speed, Apple's standard string resources should be fine.

  • \$\begingroup\$ +1. NSLocalizedString works just fine. Unless you want to store whole dialogue-trees, then you might need a format that supports this kind of structure. \$\endgroup\$
    – bummzack
    Commented Jul 17, 2011 at 16:46
  • \$\begingroup\$ And how do I "attach" them to my characters? Is there a way to reference them by number, ie string #8, or strings(8), or [strings objectAtIndex:8];? \$\endgroup\$
    – Moshe
    Commented Jul 17, 2011 at 16:53
  • \$\begingroup\$ The strings have keys. You should read the link. \$\endgroup\$
    – user744
    Commented Jul 17, 2011 at 17:23
  • \$\begingroup\$ This is exactly what I was looking for. \$\endgroup\$
    – Moshe
    Commented Jul 18, 2011 at 1:11

I would create an external file or files for all strings. then load it once when the program begins into some global object. in run time every object that needs to display some string will have to ask that global object for the proper string. you can use keys for every string or you can use an array. if you don't like the global object idea, you can load every string whenever you need directly from file, but that may cause low fps when loading dialogues. using this approach you can easily change the language whenever you want, just you have to start reading from a different file.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .