Skip to content

Authoring maps for SourceCoop

Alienmario edited this page Oct 28, 2024 · 33 revisions

Are you looking to create a multiplayer map or campaign, which is more exciting than deathmatch?
Add any NPC, unlock missing mechanics from singleplayer and more?
Perhaps you'd like to have your levels hosted on a server, so you don't have to play them alone.

We've got you covered.

Getting started

Compile Pal

In this guide, we show examples using Compile Pal. It's an indispensable tool with modern user interface that can compile your maps, pack in custom content and much much more.

Setup

1. Install SourceCoop to your game directory.

The steps are identical to a typical installation on a server. The only difference is, you'll be using your game instead.

  1. Download required archives as written in the guide.
  2. Extract all downloaded archives under "Black Mesa/bms".

Tip: to uninstall, just delete the Black Mesa/bms/addons folder.

2. Create an .edt file for your map.

This will let the mod know, that it's a co-op map.

  1. It's easiest to start with the provided sample. Save it as "Black mesa/bms/maps/your_map_name.edt".
  2. Edit "chapter" with the name you want your map to be displayed as. If you're making a multi-chapter campaign, you may also edit "campaign".
  3. You can keep adding to it during the development of your map, or leave it as is. EDT reference

Launching the map

SourceCoop requires running in multiplayer mode. To do this, open the console and execute following:

  • disconnect - will stop any background maps so we're allowed to change maxplayers
  • maxplayers 2 - tells the game to start maps in multiplayer mode
  • sv_lan 1 - tells the game to start maps in LAN only, VAC-less mode
  • map <your_map_name> - starts the map

If your map has started and you see SourceCoop messages in chat or console, everything is fine. Otherwise, you might have done something incorrectly.

You may also automate this:

  • In launch options / Hammer / CompilePal configs:
    • With old UI: -oldgameui -dev +maxplayers 2 +sv_lan 1
    • With new UI: -dev +maxplayers 2 +sv_lan 1

While we haven't had any issues, and many people have used this method before, technically Sourcemod/Metamod do add custom DLLs to your game. By launching with -insecure, you can be sure you won't ever get a VAC Ban if Valve changes their mind. This will prevent you from playing on secured servers though. In any case, you can always stop the mod from loading by renaming the addons folder.

Adding -dev to launch options prevents background maps from loading, which, in multiplayer, can lead to unforseen consequences, er bugs.

Compile Pal has a useful parameter called Hijack, which automatically restarts the map in game after it's done compiling.
As you can see above, many parameters are already predefined, so we add the remaining manually.

Mapping

Map flow

Start

There is a variable length player wait timer at the beginning of each map. Once all players fully connect or the timer runs out, the coop map starts. You can trigger entity outputs on this event by using the delay_output edt function. What players see or can do during the timer is configured by the intro_type edt parameter.

Players will spawn at info_player_start if use_map_spawnpoint is set in edt. Otherwise, define first checkpoint to be the spawn point.

Checkpoints

It is recommended to manually define checkpoints in edt. Many additional features can be used this way.

However, simple checkpoints can be entity based if use_map_autosave is set. This way, all trigger_autosave entities are imported as checkpoints. When first touched by player, the location and angles are saved and the checkpoint is activated.

Transitions

Transitioning to new maps is similar to singleplayer - by trigger_changelevel with some differences.

Entities and player location are not currently transitioned. Only the player state (health, suit, items) is, if enabled. Using the ChangeLevel input changes level instantly, however if using as a touch trigger, a variable length timer is displayed that reacts to the number of players that touched it.

Ending

To end the current map / map series and allow new one to start, use game_end entity.

Adapted entities

point_viewcontrol

New input EnableAll has been added.

If no activator is found with input Enable, all players will be affected.

Disable input targets all players.

env_zoom

New input ZoomAll has been added.

If no activator is found with input Zoom/UnZoom, all players will be affected.

player_speedmod

New input ModifySpeedAll has been added.

point_clientcommand

New input CommandAll has been added.

Input CommandAll with give command has special handling. All players will be equipped with the item and the item is saved for subsequent spawns.

player_loadsaved

This entity will kill the activating player and fade their screen.

logic_autosave

This entity may be used to trigger respawning dead players in survival mode (as long as respawns are enabled).

Extras

Custom models

Any model can be used for NPCs by specifying the custommodel property on the entity. Keep in mind the default NPC models carry a lot of information, like sounds, animation events that are used by game code, etc. The overriding model's activity names should correspond as well.

Known issues

  • env_screenoverlay shows to all players once activated
  • player_speedmod with suppress HUD flag breaks the HUD
  • Do not set GameEndAlly on NPCs
  • Some entities with "loop move sound" set never stop playing the sound
  • Anything else listed under Issues.

Publishing

Pack the .edt file to your .bsp file.

Once you are ready to publish the map, pack the .edt file in.

Below is a guide for packing an .edt file to a .bsp file using Compile Pal:

  1. Select a config on the left side that you want to use.
  2. Click "ADD" button at the process selector and choose "PACK" by double-clicking it.
  3. Now choose "PACK" at the process selector and click "Add" button at parameters box.
  4. Choose "Include" by double-clicking it.
  5. Click "..." button at "VALUE" column. Choose your .edt file. It must be under the game's maps folder in order for Compile Pal to fixup the path.
  6. Click the compile button. Your map will be packed with found custom content and the config file. You can customize this further by adding more parameters.

Check that you've packed it right

Remove or move the .edt file from "Black Mesa\bms\maps" and start the map normally.

Hosting - important!

  • Workshop

The workshop support for servers in Black Mesa is limited. It is possible for the server to automatically download and update its workshop items. However, it can't force players to subscribe to them. They would, if at all, attempt to very slowly download the map directly from the server, if not already subscribed. This creates an issue if the player has previously downloaded a map from the server and it has been updated on the workshop in meantime. They would be unable to play. There are 3 possible solutions to this:

  • 🛑 Discouraged! Rely on the slow downloads directly from the server. You must version your map with each workshop update. Any content you pack inside .vpk will be lost, since only .bsp is downloaded to players. To use this method, add "allow_server_download" "1" to the config section in your edt.
  • ✔️ Rely on the workshop kicker addon we include with SourceCoop. This detects players who are missing the map and kicks them even before they begin downloading it with a custom message that server operators can customize. This allows them to point to a collection they're running that the player has to manually subscribe to.
  • ✔️ Do not host your map on the Workshop. This brings us to the next section...

Advantages: download speed, saved server bandwidth, ease of use server side, automatic updates and ability to pack custom content in .VPKs.

Black Mesa Workshop guide

  • Server hosting

Publish your map on any website, for example Gamebanana. Server operators can then easily download the map, manually update it and host it on their own fast-download server. You must version your map for all updates you publish. You can't pack custom content inside .vpk. You must pack it inside .bsp, since only it is downloaded to players.

Advantages: players automatically download the map and don't have to subscribe to workshop items before connecting.