Results 1 to 8 of 8

Thread: Carma: A C++ to SQF "native" Interface

  1. #1

    Wink Carma: A C++ to SQF "native" Interface

    Hey guys, just announcing a little project I started a few days ago to provide a "native" interface to SQF commands inside C++ using callExtension. This allows you to write plugins in C++ that can call and interact directly with SQF.

    Right now its incredibly basic, more of a proof of concept than anything workable, but the concept seems solid so far. I have implemented the sqf functions for time and hintSilent and have had them perform correctly.

    Method of Operation

    As for technical details, the entire system is blocking, which means there is no annoying asynchronous message queues exposed to the programmer or anything that creates superfluous execution time. In both SQF and C++ they appear as native functions to the programmer who does not need to worry about the behind the scenes operations for getting data from the SQF RealVirtuality (RV) engine.

    It works on a simple messaging system based on two threads, the main entrant thread and an execution thread. A call originating from SQF first enters the DLL (which if it hasn't been called before initializes the execution thread which waits for a command) and the type of call is determined. If it is a call to execute a C++ defined function then it messages the execution thread that there is a new task to execute. While that task executes the entrant thread waits for a message from the execution thread. The execution thread will run the defined task, and if it contains a call to SQF then it tells the entrant thread to stop waiting and return with a message to the original SQF call telling SQF to execute the needed command. The execution thread now enters a waiting period while the SQF command is executed.

    The SQF command is parsed and executed in SQF space and the result is then messaged back to the DLL which determines that the type of call is a return value from a previous SQF command generated in the execution thread. This value is messaged to the execution thread, which then continues executing the SQF function call and handles the return data, eventually returning it to the original user defined function called originally. This can happen multiple times for each SQF command executed. It simply messages back and forth between threads and SQF with the required data. When the user defined function is finished all that is required is that the user call a specific return function, which is essentially the same as the previous call back to SQF messages except that it is final and no longer will come back to the DLL. The execution thread goes into a waiting state, waiting for the next user defined command to execute, and the original entrant thread also idles till the next command from callExtension (which would be a call to execute a C++ defined function).

    Development

    As far as future development goes this project is not on my front burner, but somewhere towards the back. I do plan to work on a more mature implementation of my proof of concept, but my ultimate goal would for this project to be taken up by members of the community and worked on. I plan to keep this thread updated with any developments.

    Dev-Heaven: https://dev-heaven.net/projects/carma

    If anyone is interested in helping out please let me know!

  2. #2
    Master Gunnery Sergeant Alwarren's Avatar
    Join Date
    Aug 25 2009
    Location
    Germany
    Posts
    1,209
    This sounds very interesting. I am working on a plugin for the Eclipse IDE for ARMA mission (and addon) editing, and something like that might enable me to attach the IDE directly to the editor, if there is the possibility to run scripts from within the editor somehow. That would be a very nice addition, since it could be used e.g. to connect the Equipment/Loadout editor directly to a editor-unit, or read config entries directly from the IDE...

  3. #3
    Sergeant Major NouberNou's Avatar
    Join Date
    Jul 6 2009
    Location
    Tacoma, WA
    Posts
    1,952
    Author of the Thread
    Dev-Heaven is up here: https://dev-heaven.net/projects/carma

  4. #4
    Second Lieutenant GossamerSolid's Avatar
    Join Date
    Feb 3 2006
    Location
    Ontario, Canada
    Posts
    4,056
    When I say carma, I immediately thought of carmageddon. Anybody else think that?

    Missions/Gamemodes - F.U.B.A.R. (WIP)
    Mods/Addons - Green Sea Conflict (WIP)
    Resources - ArmA 3 Notepad++ Syntax Highlighting
    PC - i5 3570K | Gigabyte GTX 680 OC | 16GB DDR3

  5. #5
    Quote Originally Posted by GossamerSolid View Post
    When I say carma, I immediately thought of carmageddon. Anybody else think that?
    Absolutely. Bring on the blood!!
    A.C.E. Advanced Combat Environment

    Dev-Heaven.net Free Project Hosting | A2 Community Issue Tracker Help BIS, Help yourself!

  6. #6
    First Lieutenant Kremator's Avatar
    Join Date
    Jun 8 2007
    Location
    Cambridge, UK
    Posts
    5,076
    Quote Originally Posted by GossamerSolid View Post
    When I say carma, I immediately thought of carmageddon. Anybody else think that?
    Now THERE was a game ! Outright devastation and we were able to mow down pedestrians in new and interesting ways ..... ahh the good old days !

    'Take On Carmageddon' FTW .... sorry to derail!

    Nice work Nou!

  7. #7
    I'll definitely have to check out your project. It seems like it does what I need. Maybe a bit more than I need actually... I only require the SQF to call 2 custom functions on a DLL.
    First I'll have to check if it supports parameters though.

  8. #8
    Quote Originally Posted by Kremator View Post
    Now THERE was a game ! Outright devastation and we were able to mow down pedestrians in new and interesting ways ..... ahh the good old days !

    'Take On Carmageddon' FTW .... sorry to derail!

    Nice work Nou!
    Its being remade: http://www.kickstarter.com/projects/...ation?ref=live

Similar Threads

  1. CfgVehicles: overriding "accuracy", "camuflage" and "sensitivity"
    By fabrizio_T in forum ARMA 2 & OA : ADDONS - Configs & Scripting
    Replies: 4
    Last Post: Apr 18 2013, 19:21
  2. Using init.sqf command "setTerrainGrid 50 ;"
    By Pd3 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Mar 13 2012, 14:54
  3. SQS to SQF "translation" request - field of view scanner
    By Rydygier in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 10
    Last Post: Oct 29 2011, 02:54
  4. "put this code in the init.sqf", means create a new file init.sqf? or put in init?
    By undercoverbrother in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Dec 2 2010, 07:14
  5. "addaction" command without sqf or sqs script
    By [FRL]Myke in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Jul 4 2010, 13:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •