Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.
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?

share|improve this question
    
Are you starting your game with the DB-design? –  bummzack Nov 14 '11 at 8:24
    
Yeah, actually. –  John Svensson Nov 14 '11 at 8:44
2  
@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. –  Jonathan Dickinson Nov 14 '11 at 11:54
add comment

1 Answer

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.

share|improve this answer
    
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. –  John Svensson Nov 14 '11 at 11:46
    
@JohnSvensson, Are you writing "Databases II: The Dark SELECT"? –  Nick Wiggill Nov 14 '11 at 12:23
1  
@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. –  Sean Middleditch Nov 14 '11 at 23:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.