-2
\$\begingroup\$
users
id
username
password
email
userlevel

characters
id
userid
level
strength
exp
max_exp

map
id
x
y

This is what I have so far. I want to be able to implement and put different NPC's on my map location. I am thinking of some npc_entities table, would that be a good approach? And then I would have a npc_list table with details as how much damage, level, etc the NPC is.

Give me some ideas with the map, map entities, npc how I can structure it?

\$\endgroup\$
3
  • \$\begingroup\$ Are you starting your game with the DB-design? \$\endgroup\$
    – bummzack
    Commented Nov 14, 2011 at 8:24
  • \$\begingroup\$ Yeah, actually. \$\endgroup\$ Commented Nov 14, 2011 at 8:44
  • 2
    \$\begingroup\$ @JohnSvensson you are not writing business software - you are writing a game; don't go schema-first. However, if you want a good example of a game DB look no further than the MangOS one. \$\endgroup\$ Commented Nov 14, 2011 at 11:54

1 Answer 1

5
\$\begingroup\$

Your question made me think that you're starting your game with the DB design, and this seems to be the case. Now you basically have some tables and you want to add more "stuff".

Let me say that starting with the DB is a very bad idea. Firstly it doesn't represent a game-world properly and is not suited for lots of changes. Let's assume that you have a nice and normalized DB design and you notice that you'll have to change things because you want to add "feature X". That might force you to re-do the entire architecture.

I suggest you start the other way round. Define what your game should do. Write it down. If you're eager to start coding, then write some code that works with values from a text-file or hard-coded values. Once you figure out what you need and how things play together, you can plug the DB into that.

The DB isn't your game, it's just a data-storage. Your game should be written in a way that this storage is abstracted so that you can start with some simple (hard-coded) values and later plug in the code that actually does the DB connection etc. Also things like the "login" (eg. username, password etc.) is really not something you need right off the bat.

\$\endgroup\$
3
  • \$\begingroup\$ I see - but I really have the problem with the map and entities the other stuff I have experienced before, but thanks for your reply. \$\endgroup\$ Commented Nov 14, 2011 at 11:46
  • \$\begingroup\$ @JohnSvensson, Are you writing "Databases II: The Dark SELECT"? \$\endgroup\$
    – Engineer
    Commented Nov 14, 2011 at 12:23
  • 1
    \$\begingroup\$ @JohnSvensson: your problem isn't maps and entities. Your problem is that you're not even thinking about how to write a game in the least. You're designing data structures with no idea what data you even need. You're asking for a solution to a problem you don't have yet. For that matter, you don't need SQL at all; I'm all for using it where it makes sense, but for something like a game, you absolutely positively no-questions want to use an object database, not a relational database. Start thinking about objects instead of tables and the questions you're asking now will answer themselves. \$\endgroup\$ Commented Nov 14, 2011 at 23:49

You must log in to answer this question.

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