Mapping/Setting Up Survival Mode

From Sven Co-op
< Mapping
Revision as of 13:39, 25 March 2020 by Hezus (talk | contribs)
Jump to navigation Jump to search

1 Introduction

Survival mode offers an interesting alternative to the typical spawn-die-respawn-repeat gameplay of many Sven Co-op maps. About 30 seconds after the map starts it disables spawn points, and any players who die will be placed into 'observer mode' until a checkpoint is reached or all players are dead, at which point a vote will be called to either restart the map or change the level.

Everything that a mapper or server operator needs to enable survival mode comes packaged with Sven Co-op by default. You can add survival mode to any map, regardless of whether or not you are an experienced level designer. This guide explains the process.

Setting up survival mode in a map involves two steps:

  1. Enabling the survival mode script
  2. Placing respawn checkpoints

2 Enabling the "Survival Mode" script for a map

Find the map's CFG file in the svencoop/maps folder. It should have the same name as the BSP file. If the file doesn't exist, just make a new TXT file with the name of the BSP and rename the extension to 'cfg'.

In the CFG file, add the line:

map_script survival_generic

This tells the map to load scripts/maps/survival_generic.as on startup.

This script also runs Survival.as, which lays down gameplay rules for survival mode, and point_checkpoint.as, which gives checkpoint entities their functionality.

With these scripts enabled, about 30 seconds after the map starts, respawning will be disabled and all players who die will be placed into 'observer mode' until a checkpoint is reached or all players are dead, at which point a vote will be called to either restart the map or change the level.

Error creating thumbnail: File missing

3 Adding checkpoints with Map Editor(for custom maps)

To use the respawn point entity you must first add the survival.fgd file to the editor's configuration. This file can be found in \svencoop\scripts\maps\fgd. Restart the editor and find point_checkpoint in the list.

Error creating thumbnail: File missing

All of the checkpoint entities in Sven Co-op's Half-Life maps are 48 units off of the ground, and will hover in the air at any height that you place them.

4 Adding checkpoints with Ripent (for already-compiled maps)

Ripent is a very powerful tool that allows server operators to customize a map without forcing players to redownload the bsp, and will not result in "Map differs from server" errors when a player who already has the unmodified version of the map tries to connect to the server. This is the method that was utilized to place checkpoints in sc_another and YABMA, as the map source files are not available. Ripent allows you to export a map's entity data, modify it, and put it back into the map. Sven Co-op includes Ripent.exe in the svencoop/maps folder.

Because it requires a command prompt to operate, I prefer to use batch files to export/import the entity data. Setting this up allows you to drag and drop a BSP or ENT file onto the batch file and convert the files without typing a bunch of stuff into a command prompt. It is also a good idea to make a separate 'ripent' folder, containing ripent.exe, your batch files, and whatever ENT or modified BSP files you're working on. Otherwise they just get mixed up in the maps folder.

In the same folder as ripent.exe, make a batch (.BAT) file to export the map's entity data to a .ENT file. Below is an example of my 'export' batch file, named "BSP_2_ENT.bat".

ripent.exe -export %1
pause

Drag and drop the desired BSP file onto this batch file to export it to an ENT file. In this case, I'm adding checkpoints to svencoop1.bsp.

Error creating thumbnail: File missing

Next, open the ENT file in a text editor.

Error creating thumbnail: File missing

The ENT file is literally a text list of every single entity in the map and all of their keyvalues. You can change any existing entity or add new ones. The only restriction is that you cannot add new brush models to a map that has already been compiled. You can only re-use brush models that are already in the map. But, since we're only adding checkpoints, that doesn't matter to us.

All you need to do now is insert "point_checkpoint" entities. First, though, you need to find coordinates where you'd like to add a checkpoint. Play through the map and find events where a lot of players might typically die. It is generally a good idea to place checkpoints after these events. When you reach a good checkpoint position, enter "status" into the console to get the coordinates where you're going to place the checkpoint.

Error creating thumbnail: File missing

You can see the X-Y-Z coordinates of your position on the 'map' line. Scroll down to the bottom of the ENT file and add the following:

{
"origin" "[X] [Y] [Z]"
"classname" "point_checkpoint"
}

Where [X] [Y] [Z] are the coordinates, without the [] brackets.

Error creating thumbnail: File missing

Once you're done adding checkpoints, make a batch file to import the map's entity data from the .ENT file back into the .BSP. Below is an example of my 'import' batch file, named "ENT_2_BSP.bat".

ripent.exe -import %1
pause

Make sure the BSP is in the same folder as the ENT file, then drag and drop the ENT file into the import batch file.

Error creating thumbnail: File missing

The BSP file should now have a checkpoint entity at the coordinates specified in the ENT file. Load it up in-game to check.

Error creating thumbnail: File missing

5 Map Configuration File CVARs

Several CVARs are available for map configuration files that can be used to control the behavior of Survival Mode when a map starts or ends.

  • mp_survival_supported - If set to '1', this tells the game that Survival Mode is supported by the map. This enables Survival Mode voting and toggling capabilities.
  • mp_survival_starton - If set to '1', Survival Mode will auto-start after the map loads. If set to '0', Survival Mode will be 'off' when the map starts. This is useful for maps that want to turn Survival Mode on at a later point in the map.
  • mp_survival_startdelay - Delay (in seconds) before survival mode starts.
  • mp_survival_nextmap - Specifies the name of the next survival map in a series. This is useful if you have multiple maps in a series where Survival Mode settings should be carried across level changes.