ked Posted October 18, 2018 Posted October 18, 2018 (edited) Hello everyone, today I'm introducing NIOD. NIOD is a npm package that lets you use the MOOSE functions with Javascript or TypeScript, it connects to DCS World using a socket. Then you can use some of the functions at your disposal to spawn groups, create triggers, etc... We're still in the early phase of this package so there aren't many functions implemented yet but it will grow ! How does this work ? The nodejs server stores callbacks linked to a callback id, this id is passed to the lua server which pass it back with the returned data. The dispatcher will then execute the right stored callback Here's a basic example const { initNiod, spawnGroup } = require("niod"); initNiod().then(() => { spawnGroup("template_group", () => console.log("your group has been spawned") ); }); Instalation Unsanitize the require function Niod requires DCS to import some functionalities from LUA so it can create a socket, you'll need to "unsanitize" it. To do so go into your DCS installation folder DCS World\Scripts\MissionScripting.lua and edit this line require = nil to --require = nilMission Editor Then you need to create a mission that loads the MOOSE lua file (found here: https://github.com/FlightControl-Master/MOOSE/releases) and then loads the NIOD lua file found in the "script" folder. And there you go ! You're all set, you can import niod in your project and start the server using const { initNiod } = require("niod"); initNiod().then(() => { // your mission code goes here });and start coding ! Typescript support Niod is written in typescript, so the npm package is shipped with all the type declarations. Which means auto-completion depending on your code editor API initNiod(): Promise<core.Express> This function will init Niod and resolve the express server spawnGroup = (groupName: string, callback: Callback) This function will spawn a group and execute the callback once it's done, the callback takes one parameter which is the name of the group that was spawned spawnGroupInZone = (groupName: string, zoneName: string, callback: Callback, randomize?: boolean)This function will add a "trigger", it means that Niod will execute the callback function when something happens (depending on the trigger). The "type" argument defines the trigger that will be added, the only one implemented at the moment is: "GroupPartlyOrCompletelyInZone" addTrigger = ( type: string, groupName: string, zoneName: string, frequency: "once" | "repeat", callback: Callback)Special thanks Thanks to Drex from Dynamic DCS for all the help on sockets, go check his server out Make sure to leave your thougths and suggestions below or as issues on the github repository. I'm also thinking about opening a discord server so we can discuss this more in depth. Cheers :pilotfly: Edited March 10, 2019 by ked
Wrench Posted October 21, 2018 Posted October 21, 2018 I'll be keeping a sharp eye on this thread. Keep us posted, buddy. Carrier Script.
ked Posted December 13, 2018 Author Posted December 13, 2018 (edited) Hello everyone ! I know it's been a while but I had some personnal issues and a lot of work to do. I'm not abandoning this project, I actualy have redone the whole thing in typescript. There's a lot to do but right now I am able to: - Send and receive data from/to the DCS server reliably - Retrieve data from all groups within a coalition I know it's not much but it was a huge pain, and I had a lot of work to do to get the foundation mechanisms for the next functionalities ! Incomming functionalities are: - Spawning - Zone retrieval - Event handling - API - Data persistance - Triggers - A nice interface to create triggers - Functionnalities comparable to MOOSE (AI_Dispatcher, etc ...) to create dynamic campaigns - Statistics Stay tuned ! Edited December 13, 2018 by ked
ked Posted December 18, 2018 Author Posted December 18, 2018 Is it going to have GUI? At some point, yes
ked Posted March 4, 2019 Author Posted March 4, 2019 Hey guys, I've been working a lot on the API and I have taken a decision: NIOD will now use MOOSE ! It makes my life so much easier. In one night I've already done this: - Spawn a group from a template - Spawn a group from a template in a particular zone - Many improvements on the socket There's still some work to do, like triggers, code preparation for npm and npm packaging. You can follow the avancement here: https://github.com/Ked57/NIOD/issues/2
ked Posted March 11, 2019 Author Posted March 11, 2019 V1.1 is out! You can now easily create an A2A_Dispatcher, Polygon_Zones and get information about the groups in your mission
ked Posted March 18, 2019 Author Posted March 18, 2019 V1.2 is out, express is out of the equasion since it was a little out of scope. On top of that I added a queue system in case of disconection. Next step is the react interface here: https://github.com/Ked57/niod_manager
Recommended Posts