This is PHP command line communicating to Restful Doom game via HTTP REST API on default 6666 port.
$ php .\game.php play --help
Description:
Plays Restful Doom game
Usage:
play [options] [--] [<steps>]
Arguments:
steps File with steps to exec during play
Options:
-m, --map=MAP Doom map to load [default: 1]
-p, --port=PORT HTTP port for Doom REST API [default: 6666]
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Controls Restful Doom via REST API from that command.
You can record the steps for game in txt file and have it executed automatically:
php .\game.php play steps.txt
Each line has single command and delay im ms:
<action> <delay>
Allowed actions:
's' => 'shoot',
'shoot' => 'shoot',
'f' => 'forward ',
'forward' => 'forward',
'b' => 'backward',
'backward' => 'backward',
'l' => 'turn-left',
'left' => 'turn-left',
'r' => 'turn-right',
'right' => 'turn-right',
# not supported
#'u' => 'use',
#'use' => 'use',
There is also an option to record your steps when playing.
The recorder is a simple html file listening for keyboard events and recording them via fetch
request to underline action.php.
- Run the php server via
php -S localhost:7777
- Go to recorder site: http://localhost:7777/game.html
- Use the arrow keys to move the person in the game
- shift - for shooting
- enter - for using, eg opening doors
- s - for restarting the level
Steps are recorded to last-run.txt file