Hard Light Productions Forums

General FreeSpace => FreeSpace & FreeSpace Open Support => Topic started by: phreak on March 18, 2008, 08:17:09 pm

Title: RamDrive for FSOpen
Post by: phreak on March 18, 2008, 08:17:09 pm
I don't know if any instructions have been posted on doing this, but here's what i've done from about 30 minutes of experimentation.  I don't have Vista, so the procedure is probably different.  As usual, I take no responsibility for you ****ing up your own system.

Overview
------------

A RamDrive is basically a hard drive that is stored in main memory.  It is extremely fast compared to mechanical media like hard drives, it's drawbacks being that a RamDrive can't be as large as a normal hard-drive, and the data is volatile (lost after shutdown).

In order to do this, you will also need a tool that creates NTFS Junction Points.  These are similar to soft-links in your favorite unix flavor.  It basically creates a file that tells the OS where to look for the file.  This is transparent to the application program (Freespace2 in our case), so there are no code changes involved.

further reading
RamDrive (http://en.wikipedia.org/wiki/Ramdrive)
NTFS Junction Point (http://en.wikipedia.org/wiki/NTFS_junction_point)
Symbolic Link (http://en.wikipedia.org/wiki/Symlink)

Tools
-------

You will need the following things to make this work.

1) Lots of main memory, this may require the use of a 64-bit OS, especially if you have more than 3GB.
2) A RamDisk driver for Windows.  I am using RRamDisk, as it is 64bit capable.  A link will be provided at the end of this section.
3) A Utility to create NTFS Junction Points.  I am using a utility called JunctionLinkMagic.  A link will be provided at the end of this section.
4) The partition that FS2 is installed on must be NTFS version 5 or later.  Not an issue if you're running XP.

RRamDisk Driver (RAR format) (http://www.cs.kent.edu/~niannett/fso/rramdisk.rar)
JunctionLinkMagic (Self-extracting EXE) (http://www.cs.kent.edu/~niannett/fso/linkmagic.exe)

Procedure
-------------

Setting up the Ramdisk

Setting up the Junction Points

You should now be able to run freespace2.  The beauty of this is that windows sees D:\Freespace2\Freespace2\mediavps as it's own directory, but the files are actually located on R:\mediavps.  I can imagine a procedure like this may work for other games.  Loading times were off the charts, probably 1 second to boot the game, 10-15 seconds to load a mission. no ingame stutters.

To be safe, you should never delete the junction point directories using the windows shell, and use the JunctionPointMagic utility.  The junction points persist on the hard drive after reboot, if you try to access them you get the generic "this path is not available message".  If you copy the directories back from the archive to the ramdrive the links are automatically restored as long as the path names are the same.

sample pictures
Junction Point (http://www.cs.kent.edu/~niannett/fso/junction.jpg)
My FS2 directory (http://www.cs.kent.edu/~niannett/fso/fs2dir.jpg)
Mediavps on D: (http://www.cs.kent.edu/~niannett/fso/d_mediavps.jpg)
Mediavps on R: (http://www.cs.kent.edu/~niannett/fso/r_mediavps.jpg)

Caveats
----------

You can only create junction points for directories, so you can not load up single files (individual VPs) on your ramdisk.
Title: Re: RamDrive for FSOpen
Post by: Colonol Dekker on March 18, 2008, 09:01:03 pm
I understand the how, but i don't understand why? If (obviously) the drives purged at powerdown. What would i use it for?
Title: Re: RamDrive for FSOpen
Post by: phreak on March 18, 2008, 09:16:31 pm
because it's a *bit* faster.  Once you get things setup initially, recopying the files over to the ram drive doesn't take too long (~10sec for 2GB).  You can probably be able to manage multiple games if you have a single "archive" directory with shell scripts to swap the games in and out.

and i can ;)