2
\$\begingroup\$

i'm trying to develop an android app to handle character sheets in roleplay games like D&D and Pathfinder.

My target is to avoid calculations of bonuses by the player who only cares to set which talent is he using or by which magic he is afflicted.

The easiest way (imho) is to handle all talents and magic with classes, with methods that modify the attributes of the character class.

Another way is to store all talents and spells in a db and read from it when the user choose or use a talent or a spell.

Am i right saying that with 1st way i use more memory than the 2nd? (if not i'm choosing it)

If is better using db, I don't know how to save the data because is poorly structured:

Talent Improved Bluff: +2 to Bluff checks

Talent Speed: if the character wears no armor or light armor he moves 5 feet fast than his base speed

I can save the talent description as a meta-code string and parse it whithin the program but it seems too complicated. Do you have any better ideas for this db?

\$\endgroup\$
2
  • \$\begingroup\$ The first question your asking is somewhat pointless since you've already decided against it. The remainder of your question is likely a possible duplicate: gamedev.stackexchange.com/questions/29982/… \$\endgroup\$
    – House
    Aug 14 '13 at 1:12
  • \$\begingroup\$ I'm not against first option, i'd like to use it. What i read in your link is how to implement this option but since the high number of talents and spells in a roleplay game i wonder if it's better handling them with objects or with databases storing someway the effect they have on the character. \$\endgroup\$
    – user34157
    Aug 14 '13 at 14:01
0
\$\begingroup\$

It kind of sounds like you are confusing your concepts here. Classes and databases aren't mutually exclusive things, and most likely you would have your classes populated by a database on game/event/other load.

So the question should be more "What would an appropriate data structure for an RPG be? And what would be the most appropriate data store be?"

A data store may be a database, a xml file, a json file, a flat file, etc. The data structure could be anything from using classes/objects, right through to nothing and accessing the data store directly.

Knowing only that you want a small footprint I would use a combination for classes for the structure and json for the data store.

A class may be "Skill" with methods such as "name", "mp", and "magic attack". Your JSON might be something like:

{skills:[
  {"name":"Fire", "mp":20, "magic attack": 200},
  {"name":"Ice", "mp":30, "magic attack":250}
]};

And then when your game is loaded, or when the menu is accessed, etc, you would create a "new Skill(json.fire)" or similar. So there would be an instance per skill.

\$\endgroup\$
-1
\$\begingroup\$

I am not exactly sure what you are asking, but I would not use a database.

If anything use XML. You can store the XML in a database if you want, or you could access the file directly via:

InputStream is = res.openRawResource(R.raw.fileName);

Really, I would use basic object orientation and just set up character class to contain or handle properties that represent the objects of the spells or the attributes, etc, and have the players input build the character class properties at run time.

If you are executing in a game loop I would recommend trying everything else before parsing xml or calling a database, especially a remote database.

\$\endgroup\$
2
  • \$\begingroup\$ Since the OP was talking about using less memory, XML is a pretty poor choice for that goal. \$\endgroup\$
    – House
    Aug 14 '13 at 4:46
  • \$\begingroup\$ Others seem to disagree. \$\endgroup\$
    – Justin
    Aug 14 '13 at 5:18

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