Custom Protocol - amnesia-spelos/amnesia-tdd-tcp GitHub Wiki
After connecting to the game, your application will need to follow the custom protocol for communication. In practice, it's a format of messages sent to and from the game.
Warning
The protocol specification is not final and may change, especially in the early stages of development
Upon connecting, the game sends your application a welcome message. Usually Hello, from Amnesia: The Dark Descent!\n
.
Note that this message is terminated with a \n
(newline). This is the basis of all commands and responses. Newline signifies the end of a message.
The communication can be split into three major categories:
- Application Requests (Things your application wants from the game)
- Game Responses (The game responding to application requests)
- Game Events (Ad-hoc events from the game, for example changing a map)
Requests generally follow the <REQUEST-COMMAND>:<optional-parameter>
format.
The game responses then follow the RESPONSE:<REQUEST-COMMAND>:<RESULT>
format.
Here is a list of currently implemented request commands with their example usage:
-
ping
: tests the communication, game simply responds without doing anything- Application Request Example:
ping
- Game Response Example:
RESPONSE:ping:pong
- Application Request Example:
-
getposrot
: Gets the player's current position and rotation. Returnsno map loaded
if not in game- Application Request Example:
getposrot
- Game Response Example:
RESPONSE:getposrot:1.0, -0.1, 24.123:180.0, 0.0, 0.0
(format x, y, z:yaw, pitch, roll) | OR |RESPONSE:getposrot:no map loaded
- Application Request Example:
-
getrot
: Gets the player's current rotation. Returnsno map loaded
if not in game- Application Request Example:
getrot
- Game Response Example:
RESPONSE:getrot:180.0, 0.0, 0.0
(format yaw, pitch, roll) | OR |RESPONSE:getrot:no map loaded
- Application Request Example:
-
getpos
: Gets the player's current position. Returnsno map loaded
if not in game- Application Request Example:
getpos
- Game Response Example:
RESPONSE:getpos:1.0, -0.1, 24.123
(format x, y, z) | OR |RESPONSE:getpos:no map loaded
- Application Request Example:
-
exec
: Executes arbitrary AngelCode script in the currently loaded map. Returnsno map loaded
if not in game- Application Request Example:
exec:SetPlayerActive(false);SetEntityActive("enemy", true);
- Game Response Example:
RESPONSE:exec:script executed
| OR |RESPONSE:exec:no map loaded
- Application Request Example:
-
Additionally if a command is not understood, the game responds with:
WARNING:Unknown command