Please check out VikingMUD !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Room loading techniques Sun Sep 12, 2004 [11:18 AM]
meekrab
brad.heller@gmail.com
member since: Sep 8, 2004
Reply
Which is better: Loading all your rooms into memory at once or reading them from a file as they're called?

I would say loading to memory would be better depending on the size of the MUD . . . but I could be mistaken.
Brad Heller
printf("Huh?");


2. RE: Room loading techniques Sun Sep 12, 2004 [1:53 PM]
Fire
Email not supplied
member since: Feb 29, 2000
In Reply To
Reply
'Better' is a subjective term, depending on your needs of the moment.
Bootup loading pro: Once all the rooms are, the requested room description and associated scripts, items and NPC's and their scripts and items are quickly available. If you have background processes working such as digging NPC miners or other such things that do not require a PC to be in the vicinity, then loading all the rooms at one time is 'better'.
Bootup loading con: Consumes more memory, possibly memory that would not be used for more than a few minutes per month, especially if you have a lot of areas that are rarely visited. Also slows the bootup process considerably.

I would suggest you do a little research to determine which way would be best for your unique needs. If you have a large playerbase but rarely require reboots, then perhaps loading them at bootup might be the best way to go. You might also want to add some sort of statistical data function to your game to keep track of what areas are used the most and perhaps load those at bootup and the rest when needed.

Have a lot of fun!
Never use a big word when a diminutive one will suffice.


3. RE: Room loading techniques Sun Sep 12, 2004 [4:23 PM]
unifex
unifex@nospam_codealchemy.org
member since: Dec 12, 2000
In Reply To
Reply
> Which is better: Loading all your rooms into memory at once
> or reading them from a file as they're called

Lazily loading them is generally better. Your mud will be able to scale to billions of rooms without excessive load times and memory footprints. Loading everything at boot is just an unnecessary optimization, spurred by a lack of an abstraction in Diku for finding and iterating over rooms.
Yui Unifex


4. RE: Room loading techniques Mon Sep 13, 2004 [7:12 PM]
lolindrath
Email not supplied
member since: Apr 2, 2000
In Reply To
Reply
Taking that first step into an area can make for a wierd pause though. This could make it feel weird for people on the MUD.


5. RE: Room loading techniques Mon Sep 13, 2004 [10:49 PM]
Kelson
Email not supplied
member since: Feb 8, 2001
In Reply To
Reply
With proper segmentation, there is no noticeable pause to the user.

Kelson


6. RE: Room loading techniques Mon Sep 13, 2004 [11:20 PM]
muir
Email not supplied
member since: Sep 14, 2003
In Reply To
Reply
I pointed this out in a previous thread regarding area loading but fairly simple optimizations help here: set a 'perimeter' for a given room (or coordinate, or whatever), so that the room is loaded not when someone enters it but e.g. when someone enters any of the adjacent rooms in a n radius (in expectance of this room being needed soon). Areas or other intensive tasks could then even be loaded in a separate thread, if necessary. Additionally, simple heuristics could be used to try to determine whether it's necessary to load or not.

.


7. RE: Room loading techniques Tue Sep 14, 2004 [6:11 AM]
unifex
unifex@nospam_codealchemy.org
member since: Dec 12, 2000
In Reply To
Reply
> Taking that first step into an area can make for a wierd
> pause though.

Completely unnoticeable on my mud, where every room is loaded individually when it is first requested. But players don't step into 'areas' as a whole, they step into 'rooms'. There is also no need to load an entire area when you only need a single part of it. Although as muir stated it is often useful to use batch loading as an optimization technique, I haven't yet found a case where it was necessary for room loading.
Yui Unifex


8. RE: Room loading techniques Tue Sep 14, 2004 [10:05 AM]
muir
Email not supplied
member since: Sep 14, 2003
In Reply To
Reply
Do you think it's a viable option to load and unload the rooms based on necessity, or are you simply doing lazy loading?

.


9. RE: Room loading techniques Tue Sep 14, 2004 [11:16 AM]
unifex
unifex@nospam_codealchemy.org
member since: Dec 12, 2000
In Reply To
Reply
> Do you think it's a viable option to load and unload the
> rooms based on necessity, or are you simply doing lazy
> loading?

Currently I'm simply doing lazy loading. Although I haven't implemented a strategy of unloading rooms, I plan to have the room loading procedure insert an unload event into the scheduler. You just have to make sure all your dependencies are using weak references, which I haven't done yet. You really can't have a truly large world without having some strategy for unloading rooms (and their dependant NPCs and inanimates) like this.
Yui Unifex


10. RE: Room loading techniques Sat Sep 18, 2004 [5:59 PM]
lindahlb
Email not supplied
member since: Mar 2, 2001
In Reply To
Reply
Keep in mind that Unifex is running his MUD on a system that has multiple processors and RAID disk access which typically perform in the range of 100-120MBs/sec, while normal disks perform around 10-15 MBs/sec. Though you still shouldn't see much of a delay when loading small portions. Just thought I'd point that out.


11. RE: Room loading techniques Sun Sep 19, 2004 [8:01 AM]
unifex
unifex@nospam_codealchemy.org
member since: Dec 12, 2000
In Reply To
Reply
Well all of my development and benchmarking is done on a server which is cobbled together from my old hardware scraps. It's not exactly the quickest thing on the road, but this method still performs admirably.
Yui Unifex




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]