3
\$\begingroup\$

I am building a game in jMonkey (Java) and I have so far only used default quest text. But now I need to start populating a lot of quests with text. My design requires A LOT of quests texts.

What is the best way to build a database of quest texts in jMonkey? I don't have a lot of real experience with databases. Is there a database that integrates well with jMonkey?

Here are the ideal properties I want in my database, in order of priority:

  1. Reasonably light learning curve
  2. Easy portability (in Java) to Windows, Linux, and Mac OSX
  3. Good interface with Java
  4. Good interface with jMonkey
  5. The ability to add properties to the quests: ID, level, gender, quest chain ID, etc.

Or am I wrong in thinking I need to use some giant monster like SQL? I haven't been able to find much information on this, so are people using some non-database methods for storing things like quest text in jMonkey?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ I'm not sure about jMonkey, but I think it's generally better to use some file format like XML or JSON for texts like dialogues and quest text. \$\endgroup\$ Commented May 2, 2012 at 10:45
  • \$\begingroup\$ Assuming that by "quest texts" you mean lines of text you can directly reference by say, an ID number... What do you mean by "A LOT"? 100? 1,000? 100,000? \$\endgroup\$
    – Tim Holt
    Commented May 2, 2012 at 14:06
  • \$\begingroup\$ @Mentoliptus So you would store thousands of quests in 1 giant XML or thousands of little ones? \$\endgroup\$ Commented May 2, 2012 at 15:37
  • \$\begingroup\$ @Tim Holt Sorry, my design currently has in the neighborhood of a couple thousand quests. And each quest will need several identifying properties: ID, level, gender, faction, quest chain, etc. \$\endgroup\$ Commented May 2, 2012 at 15:37
  • 1
    \$\begingroup\$ One big file is slower to parse, uses more memory and it's harder to maintain, but a lot of small ones is slower to access. The strategy depends on your game and the way you use the quests in your game. It's a "chatty or chunky" approach decision. \$\endgroup\$ Commented May 2, 2012 at 16:19

2 Answers 2

3
\$\begingroup\$

If you want an SQL database, i would recommend you the H2 database engine. It is pretty lightweight, written in pure Java and you can use it in embedded and server mode. It doesn't have so many features as "bigger" db engines do, but I think it will be enough in your case.

Also, consider Object databases. There are several options out there, but I would recommend you db4o. In my opinion, object databases are more intuitive to learn than SQL ones if you are akin to object-oriented design.

Hope this helps, and good luck with your game.

P.S. also, if you intend to sell your game, watch out for licensing

\$\endgroup\$
2
  • \$\begingroup\$ So SQL/Object database are the way to go for gaming? Mentoliptus above suggested just storing quest text in JSON/XML format. And my current goal would be to license under BSD. \$\endgroup\$ Commented May 2, 2012 at 15:42
  • \$\begingroup\$ If you don't have much quests, xml is the way to go. But if you have thousands of entries and you need to retrieve them based on different criteria - some kind of database is the way to go. This can be a SQL or a NOSQL one, depending on your preferences. \$\endgroup\$
    – loodakrawa
    Commented May 3, 2012 at 6:39
1
\$\begingroup\$

Why not try Json or XML if you want to hold large amounts of data. In my own jMonkey project I use XML currently to store all of my relevant information; though I plan to switch to JSON. Both are simple to use and parse and quest information can be edited by hand. You could maybe save a file for each quest and then place all of the quests in an archive to be loaded by reference ID when needed. I wouldn't really use SQL for this but thats just my opinion.

You could try using DOM, SAX or JAXB for XML or Kyro, Moxy or Jettison for JSON

HopeThisHelps

\$\endgroup\$

You must log in to answer this question.

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