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?

  • \$\begingroup\$ Are you starting your game with the DB-design? \$\endgroup\$ – bummzack Nov 14 '11 at 8:24
  • \$\begingroup\$ Yeah, actually. \$\endgroup\$ – John Svensson Nov 14 '11 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\$ – Jonathan Dickinson Nov 14 '11 at 11:54

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.

  • \$\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\$ – John Svensson Nov 14 '11 at 11:46
  • \$\begingroup\$ @JohnSvensson, Are you writing "Databases II: The Dark SELECT"? \$\endgroup\$ – Engineer Nov 14 '11 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\$ – Sean Middleditch Nov 14 '11 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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