Advertisement

How does a game like UO store all the ingame objects?

Started by July 15, 2003 04:45 PM
22 comments, last by nathan going 21 years, 6 months ago
How does a game like UO store all the ingame objects? a friend of mine must have thousands of different items stored in his house and bank, everyother player must do the same thing. i''m curious how the developers organized the storage system?
My thoughts.

DATABASE_OF_YOUR_CHOICE
PLAYER_ID (primary key)
WEAPONS
0001,0004,3445,4456
ARMOR
4556,54345,6565,2344,66543
KEYS
1234,34343,243423
ETC
4543,2344,34345,3444

Basically a massive database where the primary key is the player id. Inside of that is his inventory laid out in an easily searchable manner and indexed only by an item number.

You could even tag on information as to what slot the item is located on the character. For example, database entry for me might be.
WILL|ARMOR:12232.777
where the .777 corresponds to the characters right wrist, or bag slot 77, etc.

Another main database elsewhere that has primary key of item number/name that stores item images, models, effects, stats, quantity in game, etc.

Databases are very fast if the structure of them is correct. Actual structure depends completely on how much and what type of information you need to store about each item and each players inventory.

Another way it could be stored is a simple flat file system. Create a character and a text files (or similar) is created for that character that stores all relevant information.
Line1 = NAME
Line2 = CLASS
Line3 = RACE
Line4 = LEVEL
Line5 = INVENTORY LIST
where inventory list is just a sequence of numbers delineated by a common symbol (ex. 10111|12333|56767|34565|87654|34565|)
possibly with another code for items of which there can be multiples (ex 10111.1|123345.54|3423423.1|45443.4545)

It''s not hard to visualize once you have an idea of what needs to be stored and how often certain things need to be accesses or saved.

Webby
Advertisement
I would bet the servers store a lot of that information in memory for speed in the game, and do occasional writes to the database for backup and saving purposes.

The question is, which database engine? Oracle? SQL Server? MySQL? Something proprietary?

[edited by - Waverider on July 15, 2003 5:59:48 PM]
It's not what you're taught, it's what you learn.
I guess it depends... a well written and structured proprietary database system would be as lean and fast as possible.. though it may not be feasible if you have a small team or lack of time
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
Well, I know that they used to use Oracle... A few years ago (when UO was in its hayday) they (OSI) had several Oracle DBA job openings.

I would agree with Waverider - when someone logs in the information for the character is loaded into memory for faster access/manipulation. That data in memory is periodically updated to the database.



Dave "Dak Lozar" Loeser
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
Agree there to a certain extent but I was mainly referring to the actual storage. Where does the main program get the information that it keeps in memory when you have to pull it down for servicing? Why, in the database of course!

But to that actual idea if storing something in memory when the server is running I''ve often wondered about that myself.
My theory is that the world server (if broken into pieces where each piece is part of the world) would load up all items specific to that part of the world. These are items that can be "harvested" from that part of the world. Now I''m thinking that when a player zones into that area then everything he has in inventory is also loaded into memory for that zone and likewise unloaded when he leaves the zone. Otherwise a player wouldn''t have access to his items unless you could trust the client to say "I am using this from my inventory" which we certainly cannot do. Database accesses aren''t supposed to be very slow at all for accessing information from them and the occassional saving of character data.

Yet another good topic up for discussion here as there will be as many ways to design this and have it work great, or horribly.

Webby
Advertisement
Actually, there are several ways to do this. Everquest uses a flatfile I believe. StarWars Galaxy uses Oracle, and only loads objects into memory when they are needed/requested.

Some games will use a ''prototype'' object like Diku MUD. Basically the whole list of items can be loaded into memory at runtime, then the player object references it by a numeric ID which is just an index into a global table of objects. That way only a single instance of the object exists in memory, even though 100 players may own a copy of the object. With more conventional games, there are probably too many items to do this. In systems where items take damage, a complete copy of the object must be stored with the character, and thus ''demand loading'' is used.
quote:
Original post by WebsiteWill
Now I''m thinking that when a player zones into that area then everything he has in inventory is also loaded into memory for that zone and likewise unloaded when he leaves the zone. Otherwise a player wouldn''t have access to his items unless you could trust the client to say "I am using this from my inventory" which we certainly cannot do.


I think that part is not totally right. Of course the server has to know about players inventory, but I can''t see the point to load / unload inventory from X container to Y container when the player leaves the zone the item remaining in the player inventory. You would rather just load it in the zone if the player drops the item on the ground for example.

In my personnal project I use the same kind of system. I have a global map in which items are loaded/unloaded dynamically (i.e. when the players log in and off). Integers (keys) are used to set the position of the item in the world (or eventually in the player''s inventory).
Darkhaven Beta-test stage coming soon.
Yes, from what I have read they use database programs to manage the content. Its loaded into RAM on the servers, there almost has to be a local copy on the players machine of his items as well, changes of the items would be recorded on both the host and server. The servers would most likely have MASSIVE ammounts of RAM. I know that there are solid-state hard drives that essentially have 20gigs or more of RAM(They make ones with flash memory too if there was a need for persistant storage, but I don''t think they would use this variety) inside but act like a hard disk. I know that these types of devices are often used in conjunction with very large databases such an MMPOGs would develop, but I don''t know if anyone is using these specifically.

Ravyne, NYN Interactive Entertainment
[My Site][My School][My Group]

throw table_exception("(? ???)? ? ???");

quote:
Original post by Cahaan
You would rather just load it in the zone if the player drops the item on the ground for example.


But what if two clients wanted to initiate a trade for the item? I suppose it''s just another case that has to happen. That and every item worn that has a specific graphic would have to be loaded. It''s probably easier to just dynamically load the items as they are needed. This is a part of the project that I will have to deal with in a few short months so it''s worth my thinking about it now.

Thanks for the topic.
Webby

This topic is closed to new replies.

Advertisement