### Filesystem Mount Order and Examples Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Illustrates the virtual filesystem mount order and provides an example directory structure for Xash3D FWGS addons and localization. ```text Mount order (lowest to highest priority): 1. $game/downloaded - Server downloads storage 2. $game - Main game directory 3. $game/custom - User modifications 4. $game_hd - High-definition content (fs_mount_hd 1) 5. $game_addon - Addon content (fs_mount_addon 1) 6. $game_lv - Low-violence content (fs_mount_lv 1) 7. $game_$language - Localization content (fs_mount_l10n 1) # Example directory structure: valve/ # Base game (basedir) pak0.pak models/ mymod/ # Your mod (gamedir) pak0.pak gameinfo.txt mymod_hd/ # HD content models/ sprites/ mymod_addon/ # Addon content maps/ mymod_russian/ # Russian localization resource/ titles.txt # Mount commands fs_mount_hd 1 # Enable HD content fs_mount_addon 1 # Enable addon folder fs_mount_l10n 1 # Enable localization ui_language russian # Set language ``` -------------------------------- ### Configure Custom Deploy Step in Qt Creator Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/setting-up-qt-creator.md Set up a custom deploy step in Qt Creator to install the built binaries. Use 'waf install --destdir=""' and specify the destination directory. ```text Command: python Arguments: waf install --destdir="" Working Directory: %{buildDir}/../ ``` -------------------------------- ### Scripting Example: Conditional Entity Actions Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/entity-tools.md An example configuration file demonstrating how to create multiple entities with dynamic names and then execute different actions based on the entity's name using ent_last_cb. ```cfg alias ent_last_cb exec entity_cb.cfg ent create targetname my_ent1_$name ent_create targetname my_ent2_$name ``` ```cfg if $ent_last_name == my_ent1_$name :(ent1 actions) if $ent_last_name == my_ent2_$name :(ent2 actions) ``` -------------------------------- ### Install Xash3D FWGS (Windows Visual Studio) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs the compiled Xash3D FWGS project to a specified destination directory on Windows using the waf build system. ```bash waf install --destdir=c:/path/to/any/output/directory ``` -------------------------------- ### Install RedHat/Fedora Dependencies (64-bit) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs necessary development tools and libraries for building the 64-bit engine on RedHat/Fedora systems. ```bash $ sudo dnf install git gcc gcc-c++ SDL3-devel sdl2-compat-devel opus-devel freetype-devel bzip2-devel libvorbis-devel opusfile-devel libogg-devel ``` -------------------------------- ### Example sounds.lst Configuration Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/sounds.lst.md An example configuration demonstrating how to override various default sounds, including player shell bounces, weapon shell bounces, debris impacts, ricochets, explosions, and entity/player water interactions. ```plaintext BouncePlayerShell "player/pl_shell%d.wav" 1 3 BounceWeaponShell "weapons/sshell%d.wav" 1 3 BounceConcrete "debris/concrete%d.wav" 1 3 BounceGlass "debris/glass%d.wav" 1 4 BounceMetal "debris/metal%d.wav" 1 6 BounceFlesh "debris/flesh%d.wav" 1 7 BounceWood "debris/wood%d.wav" 1 4 Ricochet "weapons/ric%d.wav" 1 5 Explode "weapons/explode%d.wav" 3 5 EntityWaterEnter "player/pl_wade%d.wav" 1 4 EntityWaterExit "player/pl_wade%d.wav" 1 4 PlayerWaterEnter { "player/pl_wade1.wav" } PlayerWaterExit { "player/pl_wade2.wav" } ``` -------------------------------- ### Install Debian/Ubuntu Dependencies (64-bit) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs necessary development tools and libraries for building the 64-bit engine on Debian/Ubuntu systems. ```bash $ sudo apt install git build-essential python libsdl2-dev libfreetype6-dev libopus-dev libbz2-dev libvorbis-dev libopusfile-dev libogg-dev ``` -------------------------------- ### Install RedHat/Fedora Dependencies (32-bit) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs necessary development tools and libraries for building the 32-bit engine on RedHat/Fedora systems. Requires 32-bit architecture support. ```bash $ sudo dnf install git gcc gcc-c++ glibc-devel.i686 SDL3-devel.i686 sdl2-compat-devel.i686 opus-devel.i686 freetype-devel.i686 bzip2-devel.i686 libvorbis-devel.i686 opusfile-devel.i686 libogg-devel.i686 ``` -------------------------------- ### Build System Integration - Python Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md Example of build system integration using Python for library naming. ```python from waifulib import library_naming ``` -------------------------------- ### Install Debian/Ubuntu Dependencies (32-bit) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs necessary development tools and libraries for building the 32-bit engine on Debian/Ubuntu systems. Requires i386 architecture to be enabled. ```bash $ sudo dpkg --add-architecture i386 $ sudo apt update && sudo apt upgrade && sudo apt install aptitude $ sudo aptitude --without-recommends install git build-essential gcc-multilib g++-multilib libsdl2-dev:i386 libfreetype-dev:i386 libopus-dev:i386 libbz2-dev:i386 libvorbis-dev:i386 libopusfile-dev:i386 libogg-dev:i386 ``` -------------------------------- ### Build System Integration - CMake Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md Example of build system integration using CMake for library naming. ```cmake include(${CMAKE_CURRENT_LIST_DIR}/LibraryNaming.cmake) ``` -------------------------------- ### Install Xash3D FWGS (Linux) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs the compiled Xash3D FWGS project to a specified destination directory on Linux using the waf build system. ```bash ./waf install --destdir=/path/to/any/output/directory ``` -------------------------------- ### Build vitaGL Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/psvita.md Clone and build the vitaGL library with specific configurations for the PS Vita. The `install` target is used to install the library. ```bash git clone https://github.com/Rinnegatamante/vitaGL.git make -C vitaGL NO_TEX_COMBINER=1 HAVE_UNFLIPPED_FBOS=1 HAVE_PTHREAD=1 SINGLE_THREADED_GC=1 MATH_SPEEDHACK=1 DRAW_SPEEDHACK=1 HAVE_CUSTOM_HEAP=1 -j2 install ``` -------------------------------- ### Xash3D FWGS Console CVar Usage Examples Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Examples demonstrating how to interact with Console Variables (CVars) in Xash3D FWGS, including getting values, setting values, and creating new CVars. ```text // CVar usage examples: // r_draworder - prints current value // r_draworder 0 - sets value to 0 // set r_draworder 0 - creates cvar if not present, then sets value // set defaultmap crossfire - pre-set value before game DLL registers it ``` -------------------------------- ### Install iOS Build Dependencies Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Installs Python using Homebrew, a required dependency for building on iOS. ```bash brew install python ``` -------------------------------- ### gameinfo.txt Syntax Example Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/gameinfo.md Illustrates the basic syntax of gameinfo.txt, including comments, integer, float, boolean, and string values. Supports strings with spaces and escaped characters. ```plaintext // this is a comment :) // this is another comment some_integer_key 123 this_is_float_key 13.37 // optional comment enable_feature 1 // boolean, 1 to enable, 0 to disable example_string_key string_value example_spaces "string with spaces" example_title "Fate\Stay Night" // engine will parse it as Fate\Stay Night ``` -------------------------------- ### Scripting Example: Create and Use C4 Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/entity-tools.md Demonstrates how to create a weapon_c4 entity and then use it via the ent_last_cb alias, which is executed after cvars are set by ent_create. ```console ent_create weapon_c4 alias ent_last_cb "ent_fire $ent_last_inst use" ``` -------------------------------- ### Configure and Build xash3d-fwgs for PS Vita Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/psvita.md Configure the xash3d-fwgs project for a release build on PS Vita using waf, then build the project. The `install` command copies the resulting .so files. ```bash ./waf configure -T release --psvita ./waf build ./waf install --destdir=xash3d ``` -------------------------------- ### Build vita-rtld Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/psvita.md Clone, build, and install the vita-rtld library using CMake. This is a necessary dependency for the PS Vita port. ```bash git clone https://github.com/fgsfdsfgs/vita-rtld.git && cd vita-rtld mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j2 install ``` -------------------------------- ### Add new button with custom icon and command Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/touch-controls.md This example demonstrates adding a new button with a custom icon and assigning the `lastinv` command to it for quick weapon switching. The button is configured via the layout editor. ```bash lastinv ``` -------------------------------- ### Create iOS IPA Package Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Generates an installable .ipa file for iOS devices. This script can also be used to automatically create an ipa with the Half-Life SDK dylibs. ```bash scripts/ios/createipa.sh ``` -------------------------------- ### Xash3D FWGS Texture Loading Log Example Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/hd-textures.md This log output shows the status of texture replacement loading. 'OK' indicates success, 'MISS' means the file was not found, and 'FAIL' suggests a parsing or loading error. ```text Looking for replacement... () ``` ```text Looking for maps/bounce.bsp:!waterblue tex replacement...OK (materials/common/!waterblue.tga) Looking for maps/bounce.bsp:!waterblue_luma tex replacement...MISS (not found) Looking for {shot2 decal replacement...MISS (materials/decals/{shot2.tga) Looking for {shot4 decal replacement...MISS (materials/decals/{shot4.tga) Looking for {shot3 decal replacement...MISS (materials/decals/{shot3.tga) Looking for models/gman tex replacement...FAIL (materials/models/gman/GMan_Case1.tga) Looking for models/gman tex replacement...FAIL (materials/models/gman/inside_1.tga) ``` -------------------------------- ### Define Custom Command Alias Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/console-scripting.md Create new commands by defining aliases. This example defines a 'wnext' alias that cycles through inventory items and performs an attack. ```xashscript alias wnext "invnext;wait;wait;+attack;wait;-attack" ``` -------------------------------- ### Configure Run Settings in Qt Creator Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/setting-up-qt-creator.md Specify the executable path and working directory for running Xash3D FWGS within Qt Creator. The working directory should point to the installation destination. ```text Executable: ./xash3d or xash3d.exe Command line arguments: -dev 2 -log (optional) Working directory: ``` -------------------------------- ### Hide buttons by pattern Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/touch-controls.md Use the `touch_hide` command followed by a pattern to hide specific buttons. For example, `touch_hide menu*` hides all buttons whose names start with 'menu'. ```bash touch_hide ``` ```bash touch_hide menu* ``` -------------------------------- ### Examine Build Options (Linux) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Displays available build configuration options for Xash3D FWGS using the waf build system on Linux. ```bash ./waf --help ``` -------------------------------- ### Configure Build (Windows Visual Studio) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Configures the build process for Xash3D FWGS using the waf build system on Windows. Requires specifying the path to SDL2. ```bash waf configure --sdl2=c:/path/to/SDL2 ``` -------------------------------- ### Pre-load Wine Server Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/cross-compiling-for-windows-with-wine.md Execute these commands to ensure the Wine server is running and ready for use before proceeding with the build. ```bash wineserver -k; wineserver -p; wine64 wineboot ``` -------------------------------- ### Build iOS SDK with Waf Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Automatically creates an ipa with Half-Life SDK dylibs. This is an alternative to manually copying game dylibs. ```bash scripts/ios/buildhlsdk.sh ``` -------------------------------- ### Example Conditional Script: Cheats Enabled Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/console-scripting.md An example demonstrating conditional execution. If the `sv_cheats` cvar is equal to 1, it echoes a message and executes `cheatmenu.cfg`. Otherwise, it prompts the user to enable cheats. ```xashscript if $sv_cheats == 1 :echo Cheats enabled, adding cheat menu :exec cheatmenu.cfg else :echo Please enable cheats to use this! ``` -------------------------------- ### Configure iOS Build with Waf Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Use this command to configure the build for iOS. Include `--enable-bundled-deps` and `--sdl2` with the path to your SDL2 framework. Use `--ios-simulator` for simulator builds. ```bash ./waf configure --ios --enable-bundled-deps --sdl2 (path/to/SDL2.framework) ``` -------------------------------- ### Configure Custom Build Step in Qt Creator Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/setting-up-qt-creator.md Set up a custom process step in Qt Creator's build settings to execute the Waf configure command. Ensure the working directory points to the Waf script's location. ```text Command: python Arguments: configure Working Directory: %{buildDir}/../ ``` -------------------------------- ### Enable and Run Tests with Waf Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Configure the build with tests enabled and then run all tests. This builds standalone unit tests and a separate engine test binary. ```bash ./waf configure --enable-tests ``` ```bash ./waf --alltests ``` -------------------------------- ### Clone Repository (Git) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Use this command to clone the Xash3D FWGS repository and its submodules. Ensure Git is installed. ```bash git clone --recursive https://github.com/FWGS/xash3d-fwgs ``` -------------------------------- ### Button Flags Explanation Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/touch-controls.md Defines button behavior. Flags can be combined by adding their values. For example, 5 = 1 + 4 (TOUCH_FL_HIDE + TOUCH_FL_CLIENT). ```text TOUCH_FL_HIDE = 1 TOUCH_FL_NOEDIT = 2 TOUCH_FL_CLIENT = 4 TOUCH_FL_MP = 8 TOUCH_FL_SP = 16 TOUCH_FL_DEF_SHOW = 32 TOUCH_FL_DEF_HIDE = 64 TOUCH_FL_DRAW_ADDITIVE = 128 TOUCH_FL_STROKE = 256 ``` -------------------------------- ### Get Entity Information Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/entity-tools.md Prints information about an entity by its identifier. Sets client cvars like ent_last_name, ent_last_num, etc., and calls ent_last_cb. ```console ent_getvars ``` -------------------------------- ### Run Xash3D FWGS with libgcompat Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/musl.md Use this command to preload `libgcompat` when running Xash3D FWGS if you encounter missing symbol errors, typically with games linked against glibc. ```bash $ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ... ``` -------------------------------- ### Configure Custom Build Step for Waf Build Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/setting-up-qt-creator.md Add another custom process step in Qt Creator to invoke the 'waf build' command. This step should use the same Python executable and working directory as the configure step. ```text Command: python Arguments: waf build Working Directory: %{buildDir}/../ ``` -------------------------------- ### Launch with Custom Configuration Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Launches Xash3D with a custom game directory and base directory, enabling developer mode and logging. ```bash XASH3D_GAME=cstrike XASH3D_BASEDIR=/games ./xash3d -dev 2 -log ``` -------------------------------- ### Build Android APK Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Instructions for building the Android APK. Requires cloning SDL and HLSDK-portable repositories into the 3rdparty folder, then building via Android Studio or Gradle. ```bash git clone https://github.com/libsdl-org/SDL.git -b SDL2 3rdparty/SDL git clone https://github.com/FWGS/hlsdk-portable.git -b mobile-hacks 3rdparty/hlsdk-portable ``` -------------------------------- ### List Available Buttons Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/touch-controls.md Displays all buttons defined in the current configuration file. Useful for reference. ```console touch_list ``` -------------------------------- ### GetNativeObject API Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/native-object.md This API provides a way to get native objects, which are interfaces to platform-specific features or optional engine interfaces. It can be called from client DLLs (MobilityAPI), server DLLs (PhysicsAPI), and menu DLLs (MenuAPI). ```APIDOC ## GetNativeObject API ### Description Allows access to platform-specific features or optional engine interfaces by retrieving named native objects. ### Method ``` void *pfnGetNativeObject( const char *name ); ``` ### Parameters #### Path Parameters - **name** (const char *) - Required - The name of the native object to retrieve. ### Cross-platform Objects These objects are guaranteed to be available on all targets: | Object name | Interface | |---------------------|---------------------------------------------------------------------------------------------------------| | `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. | | `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use. | ### Android-specific Objects These objects are available on Android targets: | Object name | Interface | |-----------------|-----------------------------------------------------| | `JNIEnv` | Allows interfacing with Java Native Interface. | | `ActivityClass` | Returns JNI object for engine Android activity class. | ``` -------------------------------- ### Configure Waf for Dedicated Server Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/engine-porting-guide.md Use this option to build a dedicated server for testing network features and dynamic library loading. ```bash waf configure --dedicated ``` -------------------------------- ### Configure Build (Linux) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Configures the build process for Xash3D FWGS using the waf build system on Linux. Use -8 for 64-bit engine on 64-bit x86. ```bash ./waf configure -8 ``` -------------------------------- ### Build Xash3D FWGS (Windows Visual Studio) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Compiles the Xash3D FWGS project after configuration using the waf build system on Windows. ```bash waf build ``` -------------------------------- ### Configure Custom Clean Step in Qt Creator Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/setting-up-qt-creator.md Define a custom process step for cleaning the build in Qt Creator. Use 'waf clean' as the argument and set the appropriate working directory. ```text Command: python Arguments: waf clean Working Directory: %{buildDir}/../ ``` -------------------------------- ### Send Server Query Request Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Demonstrates sending a request to a master server for a list of game servers and handling responses. Includes callbacks for server list and ping requests. ```c #define NETAPI_REQUEST_SERVERLIST 0 #define NETAPI_REQUEST_PING 1 #define NETAPI_REQUEST_RULES 2 #define NETAPI_REQUEST_PLAYERS 3 #define NETAPI_REQUEST_DETAILS 4 #define FNETAPI_MULTIPLE_RESPONSE (1<<0) typedef struct net_api_s { void (*InitNetworking)(void); void (*Status)(struct net_status_s *status); void (*SendRequest)(int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response); void (*CancelRequest)(int context); void (*CancelAllRequests)(void); // Address utilities const char* (*AdrToString)(struct netadr_s *a); int (*CompareAdr)(struct netadr_s *a, struct netadr_s *b); int (*StringToAdr)(char *s, struct netadr_s *a); // Key-value parsing for server info const char* (*ValueForKey)(const char *s, const char *key); void (*RemoveKey)(char *s, const char *key); void (*SetValueForKey)(char *s, const char *key, const char *value, int maxsize); } net_api_t; // Example: Query server list and ping a server void OnServerResponse(net_response_t *response) { if (response->error == NET_SUCCESS) { if (response->type == NETAPI_REQUEST_SERVERLIST) { net_adrlist_t *list = (net_adrlist_t*)response->response; while (list) { Con_Printf("Server: %s\n", gEngfuncs.pNetAPI->AdrToString(&list->remote_address)); list = list->next; } } else if (response->type == NETAPI_REQUEST_PING) { Con_Printf("Ping: %.1f ms\n", response->ping * 1000.0); } } } // Query master server for server list gEngfuncs.pNetAPI->SendRequest( 1, // context NETAPI_REQUEST_SERVERLIST, // request type FNETAPI_MULTIPLE_RESPONSE, // flags 5.0, // timeout NULL, // remote address (NULL for master) OnServerResponse // callback ); ``` -------------------------------- ### Game Definition File Configuration Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Configure game settings, paths, DLLs, map configurations, engine limits, UI settings, URLs, and ambient sounds using the gameinfo.txt file. Includes FWGS-specific options. ```text // gameinfo.txt - Game definition file // Comments start with // // Basic game information title "My Half-Life Mod" version 1.0 type "Single and Multiplayer" gamemode "" // Directory configuration basedir valve gamedir mymod fallback_dir "" // DLL paths dllpath cl_dlls gamedll dlls/hl.dll gamedll_linux dlls/hl.so gamedll_osx dlls/hl.dylib // Map configuration startmap c1a0 trainmap t0a0 mp_entity info_player_deathmatch sp_entity info_player_start // Engine limits max_edicts 2048 max_beams 256 max_particles 8192 max_tempents 1024 // UI settings nomodels 0 noskills 0 icon game.ico // URLs url_info "https://example.com" url_update "https://example.com/updates" // Ambient sounds (automatic environment audio) ambient0 ambience/water1.wav ambient1 ambience/wind1.wav // FWGS-specific options render_picbutton_text 1 hd_background 0 animated_title 0 autosave_aged_count 3 quicksave_aged_count 3 internal_vgui_support 0 ``` -------------------------------- ### Clone and Build Xash3D FWGS Engine Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Clone the repository with submodules and use Waf to configure and build the engine. Supports various configurations like 64-bit builds or Windows with SDL2. ```bash git clone --recursive https://github.com/FWGS/xash3d-fwgs ``` ```bash ./waf --help ``` ```bash ./waf configure -8 ``` ```bash waf configure --sdl2=c:/path/to/SDL2 ``` ```bash ./waf build ``` ```bash ./waf install --destdir=/path/to/output ``` ```bash ./waf configure --enable-tests ./waf --alltests ``` -------------------------------- ### Client to Server: C2S_CONNECT Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/protocol/02-connectionless.md Initiates a connection with the game server. Includes version, challenge, protocol information, and user information. ```APIDOC ## C2S_CONNECT ### Description Used to build a connection with the server. ### Header `\xff\xff\xff\xff` ### Request `connect "" ""` #### Parameters - **version** (text) - Required - Must be 49. - **challenge** (text) - Required - The challenge value from the server. - **protinfo** (string) - Required - A Quake info string containing protocol extensions and connection information. - **uuid** (string) - FWGS extension - This client's unique ID, hashed with MD5. - **qport** (integer) - Random integer value from 1 to 65535, unique for this engine run. - **ext** (integer) - OR'ed with requested protocol extensions. `NET_EXT_SPLITSIZE` (value 1) requests message splitting based on `cl_dlmax`. - **userinfo** (string) - Required - Initial user info, encoded as a Quake info string. ### Possible Responses - `A2A_PRINT` followed by `S2C_REJECT` - `S2C_ERRORMSG` (FWGS extension) followed by `A2A_PRINT` and `S2C_REJECT` - `S2C_CONNECTION` ``` -------------------------------- ### Configure Waf for Wine-MSVC Cross-Compilation Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/cross-compiling-for-windows-with-wine.md Use this command to configure the build system for cross-compilation targeting Windows with MSVC via Wine. The PKGCONFIG=/bin/false flag prevents accidental inclusion of system-wide dependencies. ```bash PKGCONFIG=/bin/false ./waf configure -T --enable-wine-msvc --sdl2=../SDL2_VC ``` -------------------------------- ### Build Xash3D FWGS (Linux) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Compiles the Xash3D FWGS project after configuration using the waf build system on Linux. ```bash ./waf build ``` -------------------------------- ### Server Library Naming Convention (Non-x86) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md For non-x86 systems, server libraries require appending the architecture to the base gamedll name before the file extension. ```text hl_amd64.so cs_e2k.so ``` -------------------------------- ### Filesystem Addon Folders Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Defines the virtual filesystem mount points and their order of precedence. ```APIDOC ## Filesystem Addon Folders ### Description Virtual filesystem mount points in order of precedence. ### Mount Order (Lowest to Highest Priority) 1. `$game/downloaded` - Server downloads storage 2. `$game` - Main game directory 3. `$game/custom` - User modifications 4. `$game_hd` - High-definition content (fs_mount_hd 1) 5. `$game_addon` - Addon content (fs_mount_addon 1) 6. `$game_lv` - Low-violence content (fs_mount_lv 1) 7. `$game_$language` - Localization content (fs_mount_l10n 1) ### Example Directory Structure ``` valve/ # Base game (basedir) pak0.pak models/ mymod/ # Your mod (gamedir) pak0.pak gameinfo.txt mymod_hd/ # HD content models/ sprites/ mymod_addon/ # Addon content maps/ mymod_russian/ # Russian localization resource/ titles.txt ``` ### Mount Commands - **fs_mount_hd 1**: Enable HD content. - **fs_mount_addon 1**: Enable addon folder. - **fs_mount_l10n 1**: Enable localization. - **ui_language [language]**: Set the UI language (e.g., `ui_language russian`). ``` -------------------------------- ### Server Library Naming Convention (Other OS) Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md For operating systems other than Win/Lin/Mac, server libraries use the gamedll name from `gamedll_linux` field, with OS and architecture appended. ```text hl_haiku_amd64.so cs_freebsd_armhf.so ``` -------------------------------- ### Math Library Source: https://context7.com/fwgs/xash3d-fwgs/llms.txt Comprehensive 3D math utilities for vectors, matrices, and quaternions. ```APIDOC ## Math Library Comprehensive 3D math utilities for vectors, matrices, and quaternions. ### Vector Operations - `VectorAdd(vec3_t a, vec3_t b, vec3_t result)`: Adds two vectors. - `VectorSubtract(vec3_t a, vec3_t b, vec3_t result)`: Subtracts vector `b` from vector `a`. - `VectorScale(vec3_t a, float scale, vec3_t result)`: Scales a vector by a scalar value. - `VectorMA(vec3_t a, float scale, vec3_t b, vec3_t result)`: Performs a "multiply and add" operation: `result = a + scale * b`. - `VectorCopy(vec3_t src, vec3_t dst)`: Copies vector `src` to vector `dst`. - `VectorClear(vec3_t v)`: Sets all components of a vector to zero. - `VectorNormalize(vec3_t v)`: Normalizes a vector in place. - `DotProduct(vec3_t a, vec3_t b)`: Computes the dot product of two vectors. - `CrossProduct(vec3_t a, vec3_t b, vec3_t result)`: Computes the cross product of two vectors. - `VectorLength(vec3_t v)`: Computes the length (magnitude) of a vector. - `VectorDistance(vec3_t a, vec3_t b)`: Computes the distance between two vectors. ### Angle and Vector Conversion - `AngleVectors(vec3_t angles, vec3_t *forward, vec3_t *right, vec3_t *up)`: Converts Euler angles to direction vectors. - `VectorAngles(vec3_t forward, vec3_t angles)`: Converts a forward direction vector to Euler angles. ### Matrix Operations - `Matrix3x4_LoadIdentity(matrix3x4 transform)`: Loads an identity matrix into a 3x4 matrix. - `Matrix3x4_CreateFromEntity(matrix3x4 transform, vec3_t angles, vec3_t origin, float scale)`: Creates a 3x4 transformation matrix from entity properties. - `Matrix3x4_VectorTransform(matrix3x4 transform, vec3_t in, vec3_t out)`: Transforms a vector using a 3x4 matrix (including translation). - `Matrix3x4_VectorRotate(matrix3x4 transform, vec3_t in, vec3_t out)`: Transforms a vector using a 3x4 matrix (rotation only). - `Matrix4x4_LoadIdentity(matrix4x4 m)`: Loads an identity matrix into a 4x4 matrix. - `Matrix4x4_ConcatTransforms(matrix4x4 result, matrix4x4 m1, matrix4x4 m2)`: Concatenates two 4x4 matrices. - `Matrix4x4_Invert_Simple(matrix4x4 in, matrix4x4 out)`: Inverts a 4x4 matrix (simple method). ### Quaternion Operations - `AngleQuaternion(vec3_t angles, vec4_t quaternion, qboolean degrees)`: Converts Euler angles to a quaternion. - `QuaternionSlerp(vec4_t q1, vec4_t q2, float t, vec4_t result)`: Performs spherical linear interpolation between two quaternions. - `QuaternionAngle(vec4_t quaternion, vec3_t angles)`: Converts a quaternion to Euler angles. ### Bounds and Intersection - `ClearBounds(vec3_t mins, vec3_t maxs)`: Initializes bounding box minimum and maximum points. - `AddPointToBounds(vec3_t point, vec3_t mins, vec3_t maxs)`: Expands the bounding box to include a given point. - `BoundsIntersect(vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2)`: Checks if two bounding boxes intersect. - `RadiusFromBounds(vec3_t mins, vec3_t maxs)`: Computes the radius of a bounding box. ### Plane Operations - `PlaneDist(vec3_t point, mplane_t *plane)`: Computes the distance from a point to a plane. - `PlaneDiff(vec3_t point, mplane_t *plane)`: Computes the signed distance from a point to a plane. - `BoxOnPlaneSide(vec3_t mins, vec3_t maxs, mplane_t *plane)`: Determines which side of a plane a box lies on. - `PlaneIntersect(mplane_t *plane, vec3_t ray_start, vec3_t ray_dir, vec3_t result)`: Computes the intersection point of a ray and a plane. ### Example Usage ```c // Vector operations vec3_t a = {1.0f, 2.0f, 3.0f}; vec3_t b = {4.0f, 5.0f, 6.0f}; vec3_t result; VectorAdd(a, b, result); // Angle/vector conversion vec3_t angles = {0.0f, 45.0f, 0.0f}; vec3_t forward, right, up; AngleVectors(angles, forward, right, up); // Matrix operations matrix3x4 transform; Matrix3x4_LoadIdentity(transform); Matrix3x4_VectorTransform(transform, a, result); ``` ``` -------------------------------- ### Configure Waf for Low Memory Mode 2 Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/development/engine-porting-guide.md Enables deeper Low Memory Mode 2, which may break protocol compatibility and multiplayer functionality. Not suitable for testing dedicated servers. ```bash waf configure --low-memory-mode=2 ``` -------------------------------- ### Android Legacy Packaging Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md Configuration for Android builds to ensure game libraries are loaded correctly within an APK. ```gradle useLegacyPackaging = true ``` -------------------------------- ### Connect to GoldSrc Server Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/goldsrc-protocol-support.md Use this command in the console to connect to a GoldSrc server. Ensure you have purchased Half-Life 1 and set up the Steam API broker. ```console connect ip:port gs ``` -------------------------------- ### M2A_SERVERSLIST Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/protocol/02-connectionless.md Response from a master server containing a list of available game servers. ```APIDOC ## M2A_SERVERSLIST ### Description Response from a master server containing a list of available game servers. ### Method Not applicable (Connectionless Protocol) ### Endpoint Not applicable (Connectionless Protocol) ### Parameters #### Response Data - **server_list** (list) - A list of game servers, each with its IP address and port. ### Response Example ``` [ {"ip": "192.168.1.100", "port": 27015}, {"ip": "192.168.1.101", "port": 27015} ] ``` ``` -------------------------------- ### Save Configuration File Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/touch-controls.md Saves the current touch control configuration. A new file name can be specified. ```console touch_config_file command.cfg ``` -------------------------------- ### Client Library Naming Convention Source: https://github.com/fwgs/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md Use this scheme for naming client libraries. The extension depends on the OS, and architecture-specific suffixes are added for non-x86 systems. ```text client.$ext client_$arch.$ext client_$os_$arch.$ext ``` -------------------------------- ### Set PKG_CONFIG_PATH for 32-bit RedHat/Fedora Source: https://github.com/fwgs/xash3d-fwgs/blob/master/README.md Configures the PKG_CONFIG_PATH environment variable to locate 32-bit libraries on RedHat/Fedora systems. ```bash export PKG_CONFIG_PATH=/usr/lib/pkgconfig ```