Progress on Half-Life Unified SDK
Make sure to read the wiki for more information.It's been a while since the last update. I've been busy with real life stuff so i haven't had much time to work on stuff, but there has been progress.
First off, i'd like to make it absolutely clear that this SDK is not ready for use yet. You shouldn't be trying to use it to make mods at this point. It also doesn't change any engine limits.
malortie has done a lot of good work updating and improving models. Related models are now consistent with each-other and are more flexible to use. He's also been improving the studiomdl compiler with important changes.
A lot of small fixes and improvements have been made to the game's code:
- Lots of fixes and changes for work-in-progress stuff, to be expected
- Minor code cleanup
delta.lst
andliblist.gam
are now installed to the mod directory. This means you'll have to edit these files and commit them in the source code repository. The files are closely related to the game's code, that's why they're here.- renamed hl library to server
- Updated third party dependencies
- Added .natvis config file to allow the Visual Studio debugger to show the contents of certain
string_t
variables like the entity's classname, netname, targetname, target. In the future i plan to changestring_t
to a struct to allow this to work for all instances ofstring_t
, but i need to test that this works on all platforms - Enabled modernize-use-bool-literals Clang-tidy check
- Improved game config loader to detect the use of different search paths to bypass single include detection
- Reworked the client command registry to avoid the use of global variables. Commands that exist for the duration of the server's existence have their lifetime managed by the registry, others are managed by an object with automatic lifetime
- Client command names are required to be lowercase and contain only alphabetic characters and
_
- Added constants for checking if a server is running in listen or dedicated mode to allow config files to check for it
- Removed unused trigger_changelevel code (left over from Quake 1)
- Added special targetname fired when players are activated (happens when they've fully spawned after connecting or map change)
- OpenGL is no longer needed for linking, which simplifies Linux setup a bit
- Changed minimum required version of CMake to 2.23
- Github CI builds now provide artifacts containing the contents of the CMake install command to ensure that everything needed is included
- Linux builds no longer enable DWARF debug info for all build configurations, which dramatically reduces the size of CI artifacts
- spdlog log output now adds the short library prefix to console log output to make it clear where it's coming from (useful for code used in both client and server)
- Added CMake option to enable developer mode (
-dev
command line parameter). This enables cheats, the console, setsdeveloper
to 1 and most importantly allows more console log output to be seen during startup. Most of this parameter's behavior was already provided with other options, but the early logging behavior is exclusive to this parameter - Reworked game title drawing to allow the use of all three games' titles. I've combined the sprites into a single HUD sprite, and the Opposing Force version uses both the Half-Life and Opposing Force sections at the same time. This greatly simplifies the logic for drawing this title, but it's still temporary since the UI needs a rewrite at some point. It will work fine for custom maps as well, but only those three titles are supported. The
gametitle
worldspawn keyvalue has been changed from a boolean to a string to allow selection of this title. In the future i'd like to make this flexible enough to allow for custom titles, but that's not happening any time soon. - Merged sentences.txt for all three games together. There are too many sentences to have them all co-exist, so i've commented out some of the scripted dialogue. I've also increased the server-only sentence group limit from 200 to 1536 to match the engine's sentence limit. Both limits will be going away with a new feature, see below.
Major changes
New music system
I've implemented a new music playback system using OpenAL. This provides the same functionality as the engine's version (minus the ability to open the CD tray) and does not stop playing on map change. It also supports Ogg files.trigger_cdaudio
and target_cdaudio
have been removed, replaced by ambient_music
. This entity allows you to play music for a single player or all players, allows you to loop, fade out and stop music and play music for players in a certain radius.The existing soundtracks for each game are now copied to the mod installation and are renamed to allow them to co-exist. Existing maps are upgraded to use the new entity.
This does not replace the engine's music system. That's still there and is used to play
gamestartup.mp3
. Servers can also still issue commands to the original system so multiple songs could be playing at the same time. There's nothing i can do about that.On Windows OpenAL is installed to the
cl_dlls
directory and located by way of delay loading. On Linux the existing OpenAL library is used, which is the version provided by the Steam runtime. Miles Sound System (used by the engine to play music) uses OpenAL so that dependency is already locked in. OpenAL is backwards compatible with a stable API so this shouldn't be a problem.This video shows the music system in action:
Project configuration changes
Windows and Linux require the use of a toolchain file now. This is needed to enforce the use of the right compiler on Linux and to enable the use of vcpkg.Vcpkg is a package manager used to automate the process of setting up third party dependencies. It downloads, builds and installs dependencies to enable them to be used in the project. This process occurs when you configure or generate the build files with CMake, so this slows things down a bit there. On the other hand it is no longer necessary to rebuild dependencies as part of the project which speeds things up compared to before.
Not all dependencies are acquired through vcpkg. One of them isn't available at all, another is outdated. I may contribute to those projects to get things moving on that end.
Continuous integration builds cache vcpkg artifacts, which means it doesn't have to rebuild all of them like it did before. This speeds up CI builds which is great.
Project info overlay
To help with development, bug reporting and debugging i've added an in-game overlay to show information about the project's build state: For Pre-Alpha and Alpha builds this is enabled by default to make it obvious that this is a development build.More information here.
Removal of support for low resolutions
Historically Half-Life has had special support for resolutions below 640x480 in the form of smaller HUD sprites and some UI elements being smaller.I've removed this support because it doubles the amount of sprites needed for the HUD, the results appear near identical and modern systems don't even allow a resolution that low.
Only the use of command line parameters allows the game to be forced into such a low resolution, which isn't very useful and not worth providing special support for.
The game will still work and display the UI at those resolutions but it might not perfectly fit the screen.
I'm hopeful that the UI can be rewritten altogether, which makes the use of sprites and
hud.txt
unnecessary but that's too much work for V1.0.0.
Changes in HalfLife.UnifiedSdk-CSharp
The packager, asset synchronizer, installer have been ported from dotnet script to become full fledged executables. They are part of this repository now.Many improvements have been made to these tools. Ripent .ent files are no longer used to update maps, instead all changes are done exclusively through the map upgrade tool.
The packager now handles the including of additional mod directories (_addon, _hd, etc) through the configuration file to avoid hardcoding anything and allowing complete control.
Package names have the format
PackageName-yyyy-MM-dd-HH-mm-ss.zip
. When needed pre-alpha builds are uploaded to the main repository's releases page. As noted on the main wiki page this project uses standard terms for releases. Pre-alpha builds are not ready to be used for mod development and regular play.A new tool has been added to upgrade maps separately from the installer, allowing the conversion of custom maps. You'll have to specify which game the map is from, it will then convert the map according to the rules for that game.
Many upgrades have been added to automate the conversion of maps that use models that malortie has updated.
The documentation for all of these tools is available on the wiki (see the sidebar): https://github.com/SamVanheer/halflife-unified-sdk/wiki
Continued in next post ==>