ofpsounds

Quick links: Download - Description - Usage

ofpsounds is a command line tool for monitoring and limiting the size of custom sound files uploaded by players connecting to an Operation Flashpoint: Resistance server and subsequently sent to other gamers.

ofpsounds requires at least Windows 2000 and will only work if the Operation Flashpoint server is installed on an NTFS partition.

Download

ofpsounds 1.0, (2003-02-25)

Description

Operation Flashpoint has several cool features which greatly enhance online play but which simultaneously inconvenience players.

When a player connects to an Operation Flashpoint server, his face.jpg file and the contents of his Sound directory are uploaded to the server, which proceeds to distribute them to the other players in the game. This enables the player to trigger his custom sounds by sending a command to the server telling it which sound he wishes to play. The server then informs all connected clients that they should play the locally-download sound file.

However, these cool features come at a price.

The problems

Players connecting to the server must download the custom files of everyone currently online. Since the game server is optimised for sending game data and not files, this can take a long time, especially for players using 56k modems. It is not uncommon for such players to spend several minutes waiting for their connection to a busy server to be completed.

Furthermore, each player who connects immediately triggers the server to push his files out to all other players. People on low bandwidth links can find their connection saturated during this time, and unable to play at all.

Flashpoint's developers, Bohemia Interactive, recognised the potential problems associated with large custom files and implemented a server-side configuration directive which bars players from connecting if any one file exceeds a specified limit. As of version 1.91 of the game, however, this directive applies only to individual files and there is no way of limiting the total amount of custom data. This means, for instance, that if the server administrator specifies a limit of 15k for each file, there is nothing to stop a player connecting with ten files which are 14k each.

Worse, the server caches all files transmitted by clients. Even if a player disconnects and returns with fewer custom files, the data he had previously sent remains on the server and will be sent to the other clients when he connects again.

The solution

ofpsounds uses the FindFirstChangeNotification() API entry to register a notification handler on the game server's cache directory. When a player connects to the server, his custom files are transmitted and written into this directory, triggering the handler.

ofpsounds then wakes up and calculates the total disk space used by each player's sounds (since the notification doesn't specify which file was created, the program has to process each player directory in turn). If any one player is found to have exceeded the limit, the program constructs a new ACL which grants all privileges except FILE_ADD_FILE to Everyone, and applies the ACL to the directory. This has the effect of preventing new sounds being written into the cache, and hence from later being sent to other players.

Happily, other clients do not crash when subsequently asked to play sounds they have not downloaded.

Usage

To use ofpsounds, extract the executable to your server's installation directory (default: %programfiles%\Codemasters\Operation Flashpoint), open a command prompt in that directory and run

ofpsounds x

x above refers to the cutoff limit (in bytes) you wish to impose on sound directories.

Notes

Because of the way ofpsounds works, it can only check the disk space used by an individual player after he has started transmitting a new file. This means that players can still exceed the limit you specify by twice the size of the largest file allowed by your server configuration.

For example, imagine you wished to limit disk usage to 35Kb by starting ofpsounds viz:

ofpsounds 35000

Imagine further that a player uploads a 20K file. ofpsounds receives notification of the creation of the file and checks the disk space used. Since this file is still being written, the current disk usage is close to 0 and ofpsounds determines that no action should be taken.

Now the player uploads a 25K file. ofpsounds checks the disk usage and sees that it is a little over 20K, still within the 35K limit. By the time the file is uploaded, the player's disk usage is 45K.

Now if the player uploads an 18K file, ofpsounds will be triggered and see that 45K > 35K. It will then prevent file creation in the directory, while not taking any action to stop the 18K file being created. This means that although the player can't unload any further files, he will have used 63K of disk space, almost twice the 35K limit.

For this reason, you should be conservative in picking a limit. Experience on the LOL clan server has shown that a limit of 35K coupled with a maximum single file size of 28K works well.