mux2.4/game/data/
mux2.4/src/tools/
TinyMUX 2.4: MEMORY
Last Update: September 2004

This file will explain how to configure for the two memory options of MUX as
well as the procedure for converting between them.

The default build procedure creates a disk-based server.  MUX is also able to
run in a memory-based mode and this version of MUX continues to support that
style.  However, to create a memory-based server, you need to enable it at a
specific time in the build process.

  ./configure --enable-memory-based
  make depend
  make

It is critically important that -all- of your source code is built for the
same memory mode.  If you are building cleanly, there is no special action to
take.  However, if you have previously built for one memory mode and are now
building for the other memory mode, you must interject the following step
between editing your Makefile and the 'make depend' and 'make' steps:

  make clean

The 'make clean' step removes any intermediate files and prepares for a clean
build.

The remainder of this file details two specific procedures converting from
one mode of operation to the to the other.

NOTE: In all four of these procedures, the word 'GAMENAME' is the same as the
      variable set in your ./game/mux.config (on Unix) or ./game/muxconfig.vbs
      file (on Win32).

      Also note that while the following procedures may be adapted for Win32,
      building MUX on Win32 using the MEMORY_BASED mode is beyond the scope of
      this readme file.


Procedure 1.  Converting from Memory-Based to Disk-Based:
-------------------------------------------------------

The first part of converting a database from Memory-Based mode to Disk-Based
mode is easy as a Memory-Based server always dumps a Flatfile.  Look in your
config file for your specific setting, but the name of the output file is
normally 'GAMENAME.db.new' ('netmux.db.new' is the default).

If you want to perform some simple checking, look for '***END OF DUMP***'
on the end and look for attributes values throughout the flatfile.  If
'***END OF DUMP***' is not at the end, the flatfile has been abbreviated
(disk quotas, the site operator shutdown the entire server, etc).
If there are no attribute values throughout the flatfile, it's not a true
flatfile, but instead what is sometimes called a 'structure' file.

A Structure file is the type of dump performed by a Disk-Based server.  You
aren't running in Memory-Based mode.  There is no need to convert.
Alternatively, if this file is from a backup, you have some problems as there
isn't enough information in this file alone to run a game.

However, assuming that your flatfile is good and true:

  1. 'cd src'
  2. ./configure --disable-memorybased
  3. 'make clean' to remove all intermediate files.
  4. 'make' to build a disk-based server.
  5. 'cd ../game/data'
  6. './db_load GAMENAME GAMENAME.db.new GAMENAME.db'
     ('./db_load netmux netmux.db.new netmux.db' is typical).
  
At this point, GAMENAME.dir and GAMENAME.pag files should have been created.
Verify that your .conf file has 'game_pag_file=./data/GAMENAME.pag' and
'game_dir_file=./data/GAMENAME.dir'.

You are now ready to ./Startmux your game.

Step 6 above is also the same as the following:

  '../bin/dbconvert GAMENAME X < GAMENAME.db.new > GAMENAME.db'


Procedure 2. Converting from Disk-Based to Memory-Based.
-------------------------------------------------------

Because a Disk-Based server does not normally produce a flatfile, it is
necessary to create one yourself -before- attempting to re-build your
server for Memory-Based mode.

While your game is not running, perform the following:

  1. 'cd game/data'
  2. './db_unload GAMENAME GAMENAME.db.new GAMENAME.FLAT'
     ('./db_unload netmux netmux.db.new netmux.FLAT' is typical).

Step 2 above is also the same as the following:

    '../bin/dbconvert GAMENAME x < GAMENAME.db.new > GAMENAME.db.FLAT'

Then, with 'GAMENAME.FLAT' in hand, you can re-build the server for
Memory-Based mode:

  3. 'cd ../../src'
  4. ./configure --enable-memorybased
  5. 'make clean' to remove all intermediate files.
  6. 'make' the game.
  7. 'cd ../game/data'.
  8. mv GAMENAME.FLAT GAMENAME.db

For the sake of clean living, you should remove the following files:

  GAMENAME.db.new, GAMENAME.db, GAMENAME.pag, GAMENAME.dir.

You may now ./Startmux the game in Memory-Based mode.