Giter Club home page Giter Club logo

dcs-http's Introduction

dcs-http

dcs-http is a Play! framework 1.x application that exposes a small JSON HTTP API with data from a DCS World client.

Demo

Here's a demo what you can build with this!

Features

The API currently exposes two endpoints:

Fetch all objects (static and dynamic) in the simulator: /api/objects

Fetch all active objects (objects that are moving): /api/activeobjects

Example response

[
  {
    "id": 17018625,
    "name": "AWACS #001",
    "lat": 42.411212,
    "lon": 42.577581,
    "heading": 3.275483,
    "alt": 7010.398437,
    "country": "Enemies",
    "type": "E-3A",
    "groupName": "AWACS #001",
    "entity": "O",
    "time": 9776.44
  },
  {
    "id": 17018369,
    "name": "Tanker SHELL-1",
    "lat": 41.896175,
    "lon": 42.170345,
    "heading": 0.13528,
    "alt": 5486.398435,
    "country": "Enemies",
    "type": "KC-135",
    "groupName": "Tanker SHELL-1",
    "entity": "O",
    "time": 9776.44
  }
]

Example client

There currently exists a sample client which is located at http://localhost:9000/maps. This is a small web page that uses JavaScript to fetch the positions of all objects in the game which are then drawn out on a map.

How it works

DCS World allows you to run Lua code in order to export data out of the simulator. Lua is used in order to establish a socket to the Play application, where data is then streamed. The data is cached in memory in order to efficiently serve HTTP requests to clients.

23:39:53,945 INFO  ~ Starting C:\Users\Peksa\git\dcs-http
23:39:54,018 INFO  ~ Precompiling ...
23:39:56,681 INFO  ~ Application 'dcs-http' is now started !
23:39:56,704 INFO  ~ Waiting for connection by DCS on: 0.0.0.0:9595
23:39:56,749 INFO  ~ Listening for HTTP on port 9000 ...
23:40:20,769 INFO  ~ Got connection from DCS 127.0.0.1:9923

TODO

Expose much more information from DCS - the active players on the server, the current map and so on. If you know Lua or DCS World, please get in touch.

Run it yourself

If you'd like to run the application yourself, you're welcome to do so.

  1. Install DCS World.
  2. If the folder doesn't exist, create a folder called Scripts in %USERPROFILE%\Saved Games\DCS\
  3. Copy lua/Export.lua from the root of this repo to %USERPROFILE%\Saved Games\DCS\Scripts
  4. Install JDK 7
  5. Install Play framework 1.x. Instructions here.
  6. Clone this repo, git clone git://github.com/Peksa/dcs-http.git
  7. Start the application, play run --%prod
  8. Start DCS World and join or host a single or multiplayer game.
  9. Visit http://localhost:9000/api/objects or try out the sample client at http://localhost:9000/maps

dcs-http's People

Contributors

peksa avatar

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.