02.16.06
KaladeaMUD – Shared String Library
Time: 4 hours
Total: 36 hours
———————-
A very vital role of any program is to use resources efficiently to accomplish its task. This is no different for games.
When you create an object in game, it lives within the resources of the system the program runs on. You can conserve space by storing data that is the same (and always will be) one time for all objects of a given type. For example, if you have one hundred storm troopers prancing about the game, ready for interaction with your players, their name’s will never change.
The purpose of a shared string library is to cut down on memory usage by combining an efficient way to look up and store strings one time, as opposed to each time they would have been stored. As stated before, the name of a mobile game controlled character (NPC or mob) will never change unless a game builder deems it so. Thus, if you have anywhere from one to ten thousand of them (or more), you can get by using one allocated string. This works by keeping a number stored along with it to store the number of references to that particular string that the game needs.
My recent playing with binary tree’s helps a lot with this, and is, in fact, almost exactly what needs to be done. The examples we used for class stored string with reference counts, which is what the MUD will do. However, I have chosen to employ the use of an already tested and proven library produced by David Haley (otherwise known as Ksilyan). It is relatively simple to get working and produces good results. It operates somewhat differently, using a hash table (an array of linked lists it generally happens to be, though an array of binary tree’s may work better) instead of a binary tree. This can be good sometimes, as they can often be -faster- than binary trees. That is something very hard to do.
Most of this time was spent doing research, downloading, compiling, and fiddiling with the library. It still remains largely untested and unused within my code (rooms and players have little need for shared strings), though it has been successfully added to Kaladea. Now I must resume work on the OLC for rooms. Once this is done I’ll throw the thing up and do a bit of testing, and possibly work on the task system a bit more.
–
In related news (yay), O’Kane has given me permission (he even installed MySQL) to use the machine Sidhe that belongs to UNI. If you haven’t heard my rant, just know it is a very high end machine. You can find it at http://sidhe.cs.uni.edu .
Nick said,
February 18, 2006 at 7:21 pm
What do you need a machine like that for? You’re running your MUD on it? *is, obviously, very behind on your blog* Maybe you could collect all of my comments and reply to them all in an e-mail because I can’t remember where all I commented (*wishs for subscribe to comments, again*)