<-- Continued from previous post
Asset Changes
- Updated fgd to account for code changes
- Added test maps for new features
- Removed
DefaultGameData.json
(now defined in game code) - Updated Create Server config to account for code changes
- Added dummy
mapcycle.txt
and default mapcycle.json
- Added default Spawn Inventory for multiplayer and CTF (was previously hard-coded)
Map configuration file changes
The map change config file has been removed. It had been added as a counterpart to the engine's mapchange cfg file but in practice it doesn't have any value since it can only change cvars after the game has already started which has the potential to break things.
The server config can now only echo text to the console and execute commands. Default configurations are now hard-coded again to help avoid the case where a server operator modifies the default config, players download a custom map and are then unable to play it due to those changes being missing.
If a map doesn't have a configuration file the game will use the default map configuration file
cfg/DefaultMapConfig.json
instead.
Game mode selection
Game mode selection has been completely reworked. Previously the game mode used in multiplayer depended on whether the map enables co-op and the value of mp_teamplay. Now maps can specify the default game mode and lock it to that in the map cfg:
{
"Includes": [
"cfg/OpposingForceConfig.json"
],
"GameMode": "ctf",
"LockGameMode": true
}
The server can choose a game mode using the
mp_gamemode
cvar which contains the name of the game mode to use (deathmatch, teamplay, ctf, coop).
The Create Server dialog also lets you choose one, unfortunately due to engine limitations this had to be done using a separate cvar
mp_createserver_gamemode
. That cvar overrides the value of
mp_gamemode
so the method used is slightly different when starting a server that way.
Since engine bugs cause cvars to be updated too late when starting a second local server through the main menu the game now brute forces the engine to execute remaining cvar changes. Due to engine bugs this can cause multiple map changes to occur which the game now responds to by returning you to the main menu. This should never happen since it requires a specially crafted set of console commands to be executed.
The co-op gamemode is now mostly playable. Some entities still need changes to work correctly in a multiplayer environment but for the most part they now behave as they should. Some game logic and features need updating to handle co-op specific requirements as well.
Mapcycle changes
The map cycle is now JSON instead of the original custom format. I don't think many people are aware that the original map cycle format has optional attributes:
// Example/Default mapcycle for Deathmatch Maps
// Copy to mapcycle.txt to use :)
//
op4_bootcamp "\minplayers\0\maxplayers\32\mp_weaponstay\1\"
op4_datacore "\minplayers\0\maxplayers\32\mp_weaponstay\1\"
op4_demise "\minplayers\0\maxplayers\32\mp_weaponstay\1\"
op4_disposal "\minplayers\0\maxplayers\32\mp_weaponstay\1\"
(from WON Opposing Force)
The original version allows maps to be restricted to certain player counts and also to set cvars. Since the Unified SDK has map configs the ability to change cvars is rather useless and the syntax is pretty confusing, so it's now JSON:
[
"undertow",
{
"Name": "snark_pit",
"MinPlayers": 0,
"MaxPlayers": 32
},
"boot_camp",
"lambda_bunker",
"datacore",
"stalkyard"
]
It works the same way but it's a lot easier to understand.
The map cycle code is also a lot simpler so it's easier to modify if you wanted to say, modify it for co-op to handle map packs that are chained together using
trigger_changelevel
. You wouldn't include all maps in the map cycle file so you'd have to keep track of the last map that was in the file so you can skip to the next one.
In most cases you'll only have a list of map names so the syntax barely changes.
Spawn Inventory and Persistent Inventory
Two new features have been added to remove hard-coded functionality, fix bugs and improve co-op.
The Spawn Inventory is a configuration feature that lets you define what the player's inventory is like when they spawn in the game. In singleplayer this is the inventory they start with when a map is loaded using the
map
command, so when playing through a campaign you'll only get it in the first map, never in subsequent maps.
In multiplayer this is the inventory each player starts with when they respawn. Gamemode-specific inventories are handled through conditional sections in the map config. A new config file called
cfg/BaseGameConfig.json
has been added that defines the defaults:
{
"SectionGroups": [
{
"Condition": "Multiplayer",
"Sections": {
"SpawnInventory": {
"HasSuit": true,
"Weapons": {
"weapon_crowbar": {},
"weapon_9mmhandgun": {}
},
"Ammo": {
"9mm": 68
},
"WeaponToSelect": "weapon_9mmhandgun"
}
}
},
{
// Override default multiplayer inventory for CTF.
"Condition": "Multiplayer && GameMode == \"ctf\"",
"Sections": {
"SpawnInventory": {
"Reset": true,
"HasSuit": true,
"Weapons": {
"weapon_pipewrench": {},
"weapon_eagle": {},
"weapon_grapple": {}
},
"Ammo": {
"357": 21
},
"WeaponToSelect": "weapon_grapple"
}
}
}
]
}
You can control whether the player is given the following:
- HEV suit
- Long jump module
- weapons
- ammo
And set health and armor to any valid value.
And you can choose which weapon is selected by default.
You can also specify the default ammo in a weapon:
"Weapons": {
"weapon_crowbar": {},
"weapon_9mmhandgun": {
"DefaultAmmo": 34 // Two magazines by default
}
}
So you can give players empty weapons, make them injured by default, or give them a full loadout.
This feature is also used in Blue Shift to replace the original method used to give the HEV suit since it no longer works (it depended on the player touching the suit before touching a teleport trigger). This also allows players to get the HEV suit if they join a co-op game after it has started on that map, though they'll spawn in the wrong location (campaign maps need a lot of adjustments for co-op, which is out of scope for this project).
Building on the backend functionality used by this feature is Persistent Inventory, a feature exclusive to co-op that allows players to carry their inventory state to the next map. All of the above is carried over along with the weapon's current magazine count.
A skill variable
coop_persistent_inventory_grace_period
controls how long this persistent inventory is given when respawning. A
trigger_changelevel
keyvalue controls whether the inventory is persisted or not.
Here's a video showing co-op and persistent inventory:
Note that some sounds aren't playing due to an engine bug. I am working on a solution for that.
Project merging status
Current status:
- Half-Life Updated (up-to-date)
- Half-Life: Opposing Force Updated (up-to-date)
- Half-Life: Blue Shift Updated (up-to-date)
- Half-Life Updated CMake (done, project has been archived)
- HLEnhanced (in progress)
- Enhanced Half-Life (almost done)
- Half-Life Better Weapons (done)
- Condition Zero: Deleted Scenes SDK (done)
Merging continues along with planned features being finished. This shouldn't take much longer.
Remaining work to be done
- Update changelog to include all changes (partially complete)
- Write documentation for all new features (partially complete)
- Networking system (other immutable data): Networking system is implemented, new and existing features are being updated to use it
- HUD image replacement for Opposing Force: basic hud sprite name replacement test done and functional; more complete implementation will be added to implement this feature
- Versions of Opposing Force-only HUD images that have the scanline effect removed: in progress
- A way to start all three campaigns from the main menu. Probably the same solution as used in Condition Zero Deleted Scenes (menu button that starts a map that opens an SDK-level menu that enables campaign and training selection)
- Merge in remaining useful functionality from other projects (in progress)
- Implement as much of the work scheduled on the issue tracker as possible (in progress)
- Review all changes
- First alpha build
- Stress test the three campaigns and fix issues that show up (first test done)
- First beta build
Most of the work done the past few weeks has been completing work that was listed on the issue tracker. That's quickly getting done and some of those also involve merging other projects (e.g. HLEnhanced weather effects code).
One by one major features are getting implemented, co-op is mostly finished now (you can actually make map packs now that level changes work) so it's going pretty smoothly.
I will end this progress update with a couple videos showing new features: