Downloads
Servers can allow clients to download needed files straight from the server or from a webserver. This is great for servers using custom maps, mutators, and other content.
The client will download all packages currently loaded by the server, for example, the current map, mutators, etc. Clients can be told to download additional packages by adding the packages to a list on the server, see details below.
There are 2 main download methods, Channel Downloading and HTTP Downloading. Both are enabled by default, using HTTP Downloading first, and then falling back to Channel Downloading.
Directly downloading from the server is called channel downloading. It is called this because it uses the normal client communications channels, and as such, is very slow, using the speed assigned for network gameplay updates as the download speed. This is set to 40kbps by default.
Downloading from a webserver is called HTTPDownloading and is as fast as the webserver can allow.
Files downloaded from a server go into a cache folder on the client, which is located at (Game folder)\UDKGame\Cache. These files can be anything, maps files, characters, effects, sounds,,, everything under UDKGame\CookedPC.
The packages in the cache are the exact same packages as found on the server, just renamed to their GUID(the unique id of the package), and the extension changed to .uxx. You will find a file inside the cache folder called Cache.ini which maps these files to their real file name. The cache folder will be included in any search for packages, so the client doesn't not need to move any files.
Channel Downloading
Channel downloading can be controlled with the following option in the config INI.
(game folder)\UDKGame\Config\UDKEngine.ini
Under the [IpDrv.TcpNetDriver] section
AllowDownloads=True
The download speed is based on the client channel communication speed.
HTTP Downloading
For this, you will need to have a webserver setup, to hold the files for clients to download. It is advised that this server be on a different internet connection to your game server, to avoid
effecting performance.
Pay attention to the following points about the webserver.
- The webserver must run on port 80
- The packages must be on the root of the path, NO subfolders.
- Make sure to set the appropriate MIME types on your webserver. For example:
.udk application/octet-stream
.u application/octet-stream
.upk application/octet-stream
- Make sure you keep your game folder and the webfolder synced. You don't want clients trying to download the wrong version of your files.
On the Renegade X game server set the following INI options.
(Game Folder)\UDKGame\Config\UDKEngine.ini
[IpDrv.HTTPDownload]
RedirectToURL=http://cdn.renegade-x.com/site/gamerepo/
UseCompression=False
Option Descriptions
RedirectToURL= ;url to redirect to. Must have trailing slash. Doesn't work with alternative ports (must be port 80).
UseCompression= ;are the files compressed
There are a couple client side settings that effect downloading.
The first is cache related settings. The cache has a built in cleaning system, that will remove old files from the cache.
These settings are located in (Game Folder)\UDKGame\Config\UDKEngine.ini
Cache Options
[Core.System]
StaleCacheDays=365
MaxStaleCacheSize=10000
MaxOverallCacheSize=100000
PackageSizeSoftLimit=2000
Option Descriptions
StaleCacheDays ; How long in days until an unused file is marked as stale.
MaxStaleCacheSize; How much content in MB can be considered stale before being deleted.
MaxOverallCacheSize; How much content in MB can be in the cache before being deleted, old files first.
PackageSizeSoftLimit; Individual max package size in MB.
HTTPDownload options
[IpDrv.HTTPDownload]
ConnectionTimeout=12000
ProxyServerPort=0
ProxyServerHost=
Option Descriptions
ConnectionTimeout ;how long in seconds the client can spend downloading before timing out. Can be very high, as the client isn't taking up a player slot while downloading maps.
ProxyServerPort ;the clients web proxy port
ProxyServerHost ;the clients web proxy IP
Issues
-Current issue: It currently doesnt automatically download the next map, it just drops players to the main menu. They can then reconnect and get the next map. I'm looking into what can be done about this. Right now, when players see the "loading map" message on the end game screen, it starts to download the next map, then the client connects to the server and the server seems to kill it. I'm thinking its a code issue and not a config issue at this point. I'm going through the code to find out.
Tools
Powershell script to copy files from Renegade X server to webserver.
$GameFilePath = "C:\Program Files (x86)\Renegade X\UDKGame\CookedPC\" $WebFilePath = "\\iis2\c$\inetpub\Virtual\RenX\maps\" $GameFiles = get-childitem -file -r -Path $GameFilePath $WebFiles = get-childitem -file -r -Path $WebFilePath foreach ($GameFile in $GameFiles) { $WebFile = $WebFiles | where {$_.name -eq $GameFile.name} Write-Host "GameFile: " $GameFile.Name "Time: " $GameFile.LastWriteTime Write-host "WebFile: " $WebFile "Time: " $WebFile.LastWriteTime if($webFile -eq $null -or $GameFile.LastWriteTime -gt $WebFile.LastWriteTime) { Write-host "Copying File: " $GameFile.Name Copy-item $Gamefile.FullName -Destination $WebFilePath -Force -verbose } }