Thread: Best Database Stratagey?

  1. #16
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    You don't really make a game out of SQL. SQL is just a way to access organized data. In other words, just what you want.

    You need a presentation layer. Probably a programming language suited for building clients and a graphics API, like DirectX and OpenGL. You will need a server that organizes everything that happens in your world. This is the key part. Speed is of the essence here, probably C++ with heavy networking API use. Winsock comes to mind. The server will need to access all data, your terrain, your monsters, your players, simply ererything. This is going to be a lot of data organized in many different fashions. SQL would be the best way. However, if your game needs to be really cutting egde ( like MMORPG ) accessing a database will be too slow because a database is a generic thingy and you can shortcut many things that a database cannot. Because you know what kind of data you have.

    An MMORPG isn't that different from a forum or a blog. Just huge. You have a table for weapons, a table for armour, a table for monsters, a table connecting each monster to a number of weapons and armour, a table for loot, a table connecting each monster to a random number of possible loot items... it goes on and on. But basically, it's tables and connections.

    I wouldn't start too big ( though if it starts with M it's already too big ). Get 2 characters going and have them fight each other. Even that's not easy. If you manage, display them graphically. Once you got that done, have each fighter be one program and the server decides the outcome. Once you have done this, you will have started over at least twice. Keep going. And don't expect to have this in acceptable quality in less than 2 years.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  2. #17
    Thanks! Finally, a very useful post!
    I have a SQL client (phpMyAdmin). But I already have some pretty big DB's offline in C Header files (that's where they go, right?).
    I've already created the opening graphic scene. I switched to C++. It's in OpenGL (DirectX is later, way later).

  3. #18
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    OpenGL for an mmorpg? I doubt opengl would support such a thing. Anyways MMORPGS arent limited to hack n' slash. I suggest you start small with a text based MMORPG first, so you get used to passing things from server-game game-server. Sql is slow as said above, but for text rpgs, its not really a major factor.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #19
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Quote Originally Posted by Blackroot
    OpenGL for an mmorpg? I doubt opengl would support such a thing. Anyways MMORPGS arent limited to hack n' slash. I suggest you start small with a text based MMORPG first, so you get used to passing things from server-game game-server. Sql is slow as said above, but for text rpgs, its not really a major factor.
    Please, tell me how OpenGL is incapable of displaying the graphics for an MMORPG?

    OpenGL is often faster than DirectX, in my experience, so I see no issue with using it.
    Last edited by 7smurfs; 01-04-2006 at 07:58 PM.
    To code is divine

  5. #20
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    OpenGL cant support the variety of things DirectX can. Though, for smaller programs its much more desirable.

    Anyways I wasnt talking about graphics, its just less capable of handling very large waves of data-streaming.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  6. #21
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Quote Originally Posted by Blackroot
    OpenGL cant support the variety of things DirectX can. Though, for smaller programs its much more desirable.

    Anyways I wasnt talking about graphics, its just less capable of handling very large waves of data-streaming.
    Unless I am very, very wrong: the only thing OpenGL does IS graphics.

    Seriously, what do you mean by your statement?
    To code is divine

  7. #22
    I could make it in PHP XD PHP + MySQL = Awesome.

  8. #23
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    But I already have some pretty big DB's offline in C Header files (that's where they go, right?).
    If you have lookup tables in headerfiles, the are read only. You will need tables that can change dynamically and stay that way if you leave the game. Persistance.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  9. #24
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The first thing you must implement is your scripting system and message system for every object in the world. As nvoigt said you must be able to quickly access all objects and I'll add to that by saying you must also be able to quickly manipulate objects.

    A good system is a message based system because by combining messages and using queues much like Windows you can control every aspect of every object.

    Code:
    class Script;
    class Object;
    class ObjectContainer;
    
    class Script
    {
      ObjectContainer m_pObjectManager;
      ...
      void Encode();
      void Decode();
      void Compile();
      void Translate();
      void RouteToObject();
      ...
    };
    
    class Object
    {
      friend class ObjectContainer;
      ...
      //Default handler
      void MsgProc(DWORD msgID,Object *ptrObject);
    };
    Something like this. The script class translates the script, and converts the object ID used in the script to a CObject pointer or perhaps 2 depending on the script function at hand. Then it sends a message to the MsgProc of the Object or you can send the message to a message router system which then passes it on to the object. The object then is responsible for performing the action required or it can use default processing as defined in the base class for Object.

    Using messages takes away the hard-coding aspect and makes your system a lot more flexible. You can add messages to a queue, send messages from object to object, etc. With this system it is much easier to test, debug, and write demos for your project. The entire game engine comes to life. It is a very powerful thing to be able to write a script function and have it execute just as you wrote it in the actual game engine. Quite nice.

    Shakti and myself are working on just such a system. Perhaps if you want experience with this type of thing, you can join us in bringing our game to life with the script. Scripts are encoded as word opcodes much like assembly language opcodes, except those are byte opcodes. If you want more info you will have to join the project. It would be good experience and we would let you use the script system and modify it for your needs later. This game is a single player game, but trust me man, you want to do single player before you even attempt to tackle an MMORPG. I think you will find that we have a lot to show you and you have a lot to learn. We didn't learn this overnight, and we are still learning. You won't learn it overnight, and you will always be learning as well.

    So what do you say? Join or not?

    And BTW the database for an MMORPG might be SQL, but in-game I'm sure they are using a custom created data system that is much faster. Now when you exit I'm sure they stream game state information out to SQL and back in when you load, but I doubt they do this in game. Speed is critical to syncing and thus giving everyone an enjoyable experience instead of a lag fest.
    Last edited by VirtualAce; 01-05-2006 at 01:59 AM.

  10. #25
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    And BTW the database for an MMORPG might be SQL, but in-game I'm sure they are using a custom created data system that is much faster. Now when you exit I'm sure they stream game state information out to SQL and back in when you load, but I doubt they do this in game. Speed is critical to syncing and thus giving everyone an enjoyable experience instead of a lag fest.
    They might even do some half-assed optimizations like writing to their database and RAM, but only ever reading from RAM. This way you have a persistant world and speed of RAM(+writing) and you will be able to recover based on your database. But I guess that if we do it at work for 20 people, you well need to think of some more optimisations to have it running for a MASSIVE MULTIplayer game.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  11. #26
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    If you really want to do an MMORPG, I suggest you at least reas this

    It is a postmortem about Eternal Lands, an indie MMORPG written in C, using OpenGL and SDL. It has been running for some time now, and now has (I think) several hundred people on at any given time. It is really worth the read.
    To code is divine

  12. #27
    I'll think about joining.

    BTW: I'm viewing this page in the web browser I made, SimpleWeb v2 XD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. literature database: help with planning
    By officedog in forum C++ Programming
    Replies: 1
    Last Post: 01-23-2009, 12:34 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Replies: 10
    Last Post: 05-18-2006, 11:23 PM
  4. Developing database management software
    By jdm in forum C++ Programming
    Replies: 4
    Last Post: 06-15-2004, 04:06 PM
  5. Making a Simple Database System
    By Speedy5 in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 10:17 PM