characters and their stash,inv, and gear

Started by
3 comments, last by andur 14 years, 1 month ago
I started designing the technical side to an online rpg, which will save player's characters, items in stash, items in inventory, and items equipped on their char, as well as other stats. But im trying to decide one of the following: 1) If i should store the stash, inventory, gear, and all other character variables at once place ("Master Saved Character Database" which would contain every variable needed to restore a character into gameplay, in that one line of data) 2) If i should store the character stats (strength, experience, level ect), ID to their Stash, ID to their Inventory, ID to their Gear ("Gear" is what the character has equipped) in one place, And have a separate storage for all character's stashes (which stores a series of Item IDs), another storage for all character's Inventory, and another storage for all character's equipped gear. The last RPG i was designing used the first method which seemed messy. Of course i have minimal experience designing the technical sides of storing saved data. Method 2 is what im currently leaning towards, because its stored in a more organized fashion. In addition if a character's data became corrupt, that character's stash/inventory/gear will remain intact. The downside to #2 is that i have to access multiple storage databases to load one character. ---------------------------- Method #1 would look something like: [0]NAME=Gnomerogue,LEVEL=79,STRENGTH=104,STASH=07,03,15,79,00,00,INVENTORY=... [1]NAME=Javasirc,LEVEL=43,STRENGTH=34, STASH=02,60,62,00,00,00,INVENTORY=... ---------------------------- ---------------------------- Method #2 would look something like this: CharacterList [0]NAME=Gnomerogue,LEVEL=79,STRENGTH=104,STASH_ID=0,INVENTORY_ID=5,GEAR_ID=14 [1]NAME=Javasirc,LEVEL=43,STRENGTH=34,STASH_ID=2,INVENTORY_ID=6,GEAR_ID=6 ... StashList (Lets assume the stash holds 6 items, to make this simple) [0]07,03,15,79,00,00 [1]00,00,00,00,00,54 [2]02,60,62,00,00,00 ... ---------------------------- PS Im not sure how a character will end up with a different ID than the Stash, Inventory and so on.. but lets just assume it can happen (maybe i make a command like "CreateNewStash" and its not linked to any character.. i dont know) There are other object-based variables such as spellbook, actionbar-setup, and so on but i did not cover that, just discussing the idea of design. So the question is, which method is better to use in an online game that has to support a lot of characters? Which does WoW and other MMOGs use? Or do they use a completely different design?
Advertisement
If you are writing an online rpg, you would probably be best storing your items in a relational database such as MySQL or MSSQL. Ensure you nomalise your database (Google "database normalisation" to see what I mean)

You should also introduce the concept of generic containers. There would both hold items, and also be able to be held themselves. E.g. You can place items in a bag then place the bag into the player's inventory.
Im using a file database i programmed a year ago, rather than a real database. The storage formats i shown in my first post were just examples so people can understand whats being stored. In my file database it would look like:

######Gnomerogue00790104000000000000000500000014
########Javasirc00430034000000020000000600000006

It reads a line, or just a series of bytes, depending on what needs loaded.

Im just not sure how to manage the stash, inventory, ect.


Should the stash, inventory, and gear be a Containers, and be placed in a single storage that only stores container data?

So Gnomerogue's stash ID could be 0, Inventory ID 1, Gear ID 2, each weapon gets its own container for sockets, Bags that can be placed in the stash/inventory gets its own container, and so on?

-------List of Stored Containers--------
[0]Gnomerogue's stash container
[1]Gnomerogue's inventory container
[2]Gnomerogue's gear container
[3]Item ID 7's container thats in Container [1] (Gnomerogue's inventory)
[4]Javasirc's stash container
[5]Javasirc's inventory container
[6]Javasirc's Gear container

And then give the character data a container ID for the stash, inventory, gear ect?

Quote:In addition if a character's data became corrupt, that character's stash/inventory/gear will remain intact.

If you use a real RDBMS you can restore corruptions, and possibly prevent them in the first place. MS-SQL is fairly easy to use, PostgreSQL is harder to get your head around but is free (price and licensing) and doesn't restrict you to a Windows server.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Quote:Original post by krez
Quote:In addition if a character's data became corrupt, that character's stash/inventory/gear will remain intact.

If you use a real RDBMS you can restore corruptions, and possibly prevent them in the first place. MS-SQL is fairly easy to use, PostgreSQL is harder to get your head around but is free (price and licensing) and doesn't restrict you to a Windows server.


Not to mention a real RDBMS will give you the ability to query for all sorts of data and figure out what is going on in your game world, instead of having to manually write a ton of query code to do this yourself. It becomes trivial to figure out things like: How many of item X are in the world? What is the level distribution of players like in the game? How many of class X are in the world? How many of class X have item Y? And so on.

This topic is closed to new replies.

Advertisement