Author Topic: API or Protocol to control an Arena  (Read 518 times)

Offline artik

  • Silver Member
  • ****
  • Posts: 1908
      • Blog
API or Protocol to control an Arena
« on: July 06, 2014, 05:43:48 AM »
Today there are many tools that allow to control the arena bases of flags, weapons, vehicles... but finally every scenario and even every 2nd event ends with player enforced rules that sometimes are VERY hard to enforce in the hear of the battle or just due to misunderstanding of the rules by walkons.

I think that having an API or a protocol that would provide an information about the area events on the fly and would allow to change settings of the terrain automatically would allow to create a very advanced campaigns with complex resource use and prevent human errors. Of course this API/protocol would be available to the CM level users only so they "script" the event.

For example allocating resources dynamically, implementing SAR, checking the outcome and much-much more.

I'd suggest, to use https for the API commands and data retrieving:


This way the setups could be designed rules would be written in JavaScript and controlled by CMs and of course with the access by CMs only.

Arena Events Stream

Each update would consist of a JSON object containing related data, for example:


{
  "player" : "artik",
  "side" : "knights",
  "squadron" : "101 \"Red\" Squadron, Israel",
  "timestamp" : "14:23:45.245",
  "event" : {
    "type" : "takeoff",
    "vehicle" : "P-51D",
    "from" : "A1",
    "spawn" : "N",
    "loadout" : { "fuel" : 100, "point1" : "rockets", "point2" : "bombs 1000lb" }
  }
}


Of course event.type can be one of many: takeoff, land, kill, assist, ditch, capture, bail and other major events in the current logs.
I also suggest to have a special type of event like command, i.e. player writes ".command add life to DJango" and it is sent as an event to the script:

{ "type" : "command", "content": "add life to Django" }

This event stream would be kept with a history with an event-stream synchronization such that in case of disco it would be reconnected.

Location Updates

This event stream would not keep the history but rather a "latest-data" update (as it is irrelevant what happened 30 min ago for most of the cases) and would include locations of all the players on the arena such an updates would be sent once in 20-30 seconds or something like that.

It would allow to enforce: "altitude rules", "no-fly zones" and probably event to create some fancy radar systems with different resolution like automated GCI if needed.

[
  {
     "id" : "artik",
     "country" : 2 ,
     "loc" : [ 2343.345, 1234.345, 15320.0 ],
     "vel" : [250.2,1.32,-0.1],
     "above_ground" : 12302.0
   },
   { "id" : "Django" ....
  ...
]


Control Channel

Would work on JSON-RPC level and handle the commands sent by the CM's client side,


getSetting(name:string) -> string
setSetting(name:string,name:string) -> bool (ok or fail)
getEnabled(plane:string,field:int,side:int) -> bool
setEnabled(plane:string,filed:int,side:int,enabled:bool) -> book (ok/fail)
sendMessage(playerId:string,message:string) -> bool (ok or player offline)
getObjectStatus(id:string)-> ["ok","destroyed"]
setObjectStatus(id:string,status:string) -> bool
...
and more




AFAIK the first part of the events can be implemented relatively easily by reading the server log I assume the 2nd as well. the 3rd need some level of backward communication.

I understand that it isn't your priority, however I have a great deal of experience with such an efficient web services. If you would want to I can implement such a server providing HTC the full source code and copyrights (if needed under NDA). i.e. I can implement such an efficient web front-end that given a logs and some API to the server so it would work smoothly as my contribution to the community (I love to implement such cool tools). I can also implement a web front end only and you would hookup the rest.

I know this isn't something that you regularly (if at all) agree to do but such a service may significantly enrich the special events possibilities.

Thanks
Artik, 101 "Red" Squadron, Israel

Offline jeffdn

  • Nickel Member
  • ***
  • Posts: 406
Re: API or Protocol to control an Arena
« Reply #1 on: July 06, 2014, 08:04:04 AM »
As a fellow developer, I agree that this would be a great tool to have, and furthermore volunteer my services should they be needed.

Offline Skyyr

  • persona non grata
  • Gold Member
  • *****
  • Posts: 2052
Re: API or Protocol to control an Arena
« Reply #2 on: July 06, 2014, 08:33:53 AM »
+1

It would be awesome if the API had an outbound data component as well, so we could pull stats from events and games live.
Skyyr

Tours:
166 - 190
198 - 204
218 - 220
286 - 287
290 - 296

nrshida: "I almost beat Skyyr after he took a 6 year break!"
A few moments later...

vs Shane: 30-11

KOTH Wins: 6, Egos Broken: 1000+

Mmmmm... tears.

Offline jeffdn

  • Nickel Member
  • ***
  • Posts: 406
Re: API or Protocol to control an Arena
« Reply #3 on: July 07, 2014, 07:40:20 AM »
+1

It would be awesome if the API had an outbound data component as well, so we could pull stats from events and games live.

That would definitely be possible. There could even be a page that live-updated with information about the event in question, and it would require very little (almost negligible) CPU time on the server or bandwidth.

Offline guncrasher

  • Plutonium Member
  • *******
  • Posts: 17362
Re: API or Protocol to control an Arena
« Reply #4 on: July 07, 2014, 11:19:09 AM »
how easily would it be for somebody to intercept the data and send something else.  just for the fun of it?



semp1
you dont want me to ho, dont point your plane at me.

Offline jeffdn

  • Nickel Member
  • ***
  • Posts: 406
Re: API or Protocol to control an Arena
« Reply #5 on: July 08, 2014, 12:03:58 PM »
how easily would it be for somebody to intercept the data and send something else.  just for the fun of it?

It would be very difficult unless they failed to implement even a basic security model.