13 GameInterface
INSANEMODE edited this page 2023-06-10 00:40:03 -05:00
This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Preface

Game servers typically offer a limited range of functionality that can be used by administrative tools like IW4MAdmin.
This minimal functionality is usually restricted to administrative commands.
Unfortunately, modifying game mechanics or creating custom commands that interact directly with the game is not possible by default.
Enter the Game Interface...

What is the game interface?

The Game Interface is a set of utilities that allows IW4MAdmin and the Call of Duty® game scripting engine to communicate with each other.
Without getting too technical, the Game Interface uses a bus system to allow two way communication with IW4MAdmin.

This communication channel enables the creation of custom commands that can directly interact with the game through scripting.
These custom commands can significantly enhance the gaming experience and improve the integration of IW4MAdmin with the game server.

What games are supported?

The following games are supported in some capacity

Game Notes
IW4
IW5
T5
T6

How to install

[1] Install the game interface by copying the .gsc files to your game server install.
[2] Add set sv_iw4madmin_integration_enabled 1 to your game server config.

For Plutonium games you can execute the provided deploy.bat (on Windows) to automatically copy the files
The source .gsc files are provided in the GameFiles directory of your IW4MAdmin installation
⚠️ Make sure to restart IW4MAdmin and your game server after installation

IW4x

Source Destination Notes
Gamefiles/GameInterface/_integration_base.gsc %IW4XInstall%/userraw/scripts
GameFiles/GameInterface/_integration_shared.gsc %IW4XInstall%/userraw/scripts
GameFiles/GameInterface/_integration_iw4x.gsc %IW4XInstall%/userraw/scripts

Pluto IW5

Source Destination Notes
Gamefiles/GameInterface/_integration_base.gsc %LOCALAPPDATA%/Plutonium/storage/iw5/scripts
GameFiles/GameInterface/_integration_shared.gsc %LOCALAPPDATA%/Plutonium/storage/iw5/scripts
GameFiles/GameInterface/_integration_iw5.gsc %LOCALAPPDATA%/Plutonium/storage/iw5/scripts

Pluto T5

Source Destination Notes
Gamefiles/GameInterface/_integration_base.gsc %LOCALAPPDATA%/Plutonium/storage/t5/scripts
GameFiles/GameInterface/_integration_shared.gsc %LOCALAPPDATA%/Plutonium/storage/t5/scripts
GameFiles/GameInterface/_integration_t5.gsc %LOCALAPPDATA%/Plutonium/storage/t5/scripts/mp
GameFiles/GameInterface/_integration_t5zm.gsc %LOCALAPPDATA%/Plutonium/storage/t5/scripts/sp/zom

Pluto T6

Source Destination Notes
Gamefiles/GameInterface/_integration_base.gsc %LOCALAPPDATA%/Plutonium/storage/t6/scripts
GameFiles/GameInterface/_integration_shared.gsc %LOCALAPPDATA%/Plutonium/storage/t6/scripts
GameFiles/GameInterface/_integration_t6.gsc %LOCALAPPDATA%/Plutonium/storage/t6/scripts
GameFiles/GameInterface/_integration_t6zm_helper.gsc %LOCALAPPDATA%/Plutonium/storage/t6/scripts/zm
GameFiles/GameInterface/_integration_t6_file_bus.gsc %LOCALAPPDATA%/Plutonium/storage/t6/scripts optional, see here for requirements

How to add new commands

Utilize the RegisterScriptCommandObject function.
See example_module.gsc

You must have working knowledge of GSC (Call of Duty® game scripting code)

Troubleshooting

Regular commands stop working when game interface is enabled

Increase the pollingRate value in Configuration/ScriptPluginSettings.json.
Increasing the polling rate adds more time between RCon requests for new data from the game server.

⚠️ Increasing the polling rate will cause Game Interface to respond slower to commands
"GameInterface.js": {
    "config": {
      "pollingRate": 2000
    }
  }

Game interface commands respond slow

Decrease the pollingRate value in Configuration/ScriptPluginSettings.json.
Decreasing the polling rate reduces the time between RCon requests for new data from the game server.

⚠️ Decreasing the polling rate will increase the likelihood of IW4MAMdmin being RCon throttled

See the Bus Mode section below for bus mode options to reduce latency on supported games.

"GameInterface.js": {
    "config": {
      "pollingRate": 150
    }
  }

Advanced

Bus Mode

One of the limitations of the Game Interface is data transfer speed.
Because the default implementation uses RCon to transmit data, various factors can affect the speed and responsiveness of Game Interface commands.
However, some Call of Duty® clients support filesytem operations (either officially or with unofficial mods).
For those clients, the Game Interface has an alternative bus mode that uses the filesystem instead of rcon; which increases reliablity and decreases latency.

File bus mode support

File bus mode is supported on these games

Game Notes
IW4
T6 Requires t6-gsc-utils, and _integration_t6_file_bus.gsc
⚠️ Currently only works on local game servers (game servers running on a different machine are not supported)

Configuring bus mode

Set the following values in your server configuration
set sv_iw4madmin_integration_busmode "file"
set sv_iw4madmin_integration_busdir "<absolute path to default gsc filesystem access>"