noubernou 77 Posted August 1, 2014 (edited) Carma is a object oriented programming extension to SQF, the scripting language of Arma. It uses a translator/compiler to parse additional syntax in SQF files and generate the requisite real SQF to implement objects. An example is shown below. // The carmaClassDef operator defines a class. ClassA carmaClassDef { // The public code space defines all assignments inside // as being public members, accessible by anyone. public { _varA = "A"; }; }; // The carmaClassDefExtends operator extends an // existing class. ClassB carmaClassDefExtends ClassA with { public { _varB = "B"; }; }; // The carmaClass operator creates a new instance // of a an object. Objects are stored as arrays, so // they are always passed by reference and they go // in and out of scope like any other SQF variable. _objectB = carmaClass ClassB(); // The final operator is the "." (dot) operator, which // is used to access member variables. hintSilent format["A: %1\nB: %2", _objectB._varA, _objectB._varB]; Carma supports public and protected members and methods, static members and methods, constructors, destructors (though they are as of 1.0 not currently called automatically), method chaining, inheritance, and C style array access for array members. For more information please see the wiki page on DH: http://dev.withsix.com/projects/carma/wiki/ This is a side project from my normal ones (ACRE, ACE, etc) and is meant to mostly be experimental and designed to further SQF coding practices, techniques, and technology as well as serve as a useful distraction. I am looking for people that wish to develop and maintain the project further. If anyone is interested in applying please let me know. You can find download links to the current version here: http://dev.withsix.com/projects/carma/files If there are any immediate issues you can see please post tickets to the tracker here: http://dev.withsix.com/projects/carma/issues Questions will be fielded in this thread. Enjoy! Edited August 1, 2014 by NouberNou Share this post Link to post Share on other sites
Gudsawn 93 Posted August 1, 2014 (edited) Very impressive work, SQF is starting to become quite a mature language. How does using this, instead of native SQF equivalents, affect performance? With the possible overhead in mind, what sort of scenarios would object-oriented SQF be best used in? Edited August 1, 2014 by Goodson Share this post Link to post Share on other sites
noubernou 77 Posted August 1, 2014 I've tried to minimize performance overhead as much as possible, but to maintain the same style as SQF, such as it being dynamically and loosely typed, there had to be some sacrifices. For example, all method/members require a look up. Static members/methods require a depth look up (searching the parent class definitions). Maintaining the _self variable requires call wrappers. The nice thing though is there is tons of room for optimization still. Static analysis can lead to implementing hard coded method functions, direct set/getting of members, etc. There is room for dynamic optimization as well. Since all of this can be implemented in the library and compiler it means code can stay the same source wise and benefit from improved performance as releases are made. At current the best scenarios are for things where near real time performance is not needed, things that can be done over many frames or (god forbid) in the scheduler. Administrative things, data systems, etc. Share this post Link to post Share on other sites
Aristine 14 Posted August 8, 2014 This is very amazing work! Please keep it up. I am wondering about something though. Could this be used for multiplayer scripting? I'm new to the multiplayer side and it seems to me that every client would have to download and have carma loaded as an add-on first. Share this post Link to post Share on other sites
noubernou 77 Posted August 9, 2014 I plan to make a static compiler in the future, also thinking about possibly suggesting integration with CBA (but we'll see). Share this post Link to post Share on other sites
ImperialAlex 72 Posted May 18, 2015 I just came across this again - is this still an active project? I looked up Naught's object-oriented stuff as well and that seems fairly dead/inactive, too. Has anybody else continued working on creating a higher-level language on top of SQF? Share this post Link to post Share on other sites
noubernou 77 Posted May 23, 2015 It is pretty dead at the moment. I might fork it over to github and let anyone take a crack at it. The code is really rough though and could use a good rewrite. The lexer/parser is ... not great. Share this post Link to post Share on other sites