GithubHelp home page GithubHelp logo

restful-doom's Introduction

About

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.

Usage with steps loaded from txt file

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',

Recorder

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.

  1. Run the php server via php -S localhost:7777
  2. Go to recorder site: http://localhost:7777/game.html
  3. 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.