Jump to content

noubernou

Member
  • Content Count

    2460
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by noubernou

  1. Intercept is a C/C++ binding interface to the Arma 3 engine (internally referred to as the Real Virtuality or RV engine). It's goal is to provide easy to use library for addon makers to develop addons in a native language, or to develop language extensions for the Arma 3 engine. In a nutshell, Intercept provides a full C/C++ binding system for calling the base C++ functions which are declared in RVEngine for SQF functions. All SQF functions within the RVEngine are actually native code, which is called by SQF via the function names. Intercept bypasses SQF entirely, allowing native C++ plugins to seamlessly interact with the game engine. In essence, Intercept allows for expansions of the game engine, calling internal functionality of the engine which has been exposed via SQF functions. This was the idea behind the intended Java implementation by Bohemia Interactive in Take On Helicopters and was planned for, but never implemented in Arma 3. Intercept not only completes the intended functionality of what Java was meant to provide but has gone much further, including returning data to SQF and multithreaded addons. Intercept works on a host/client based system, in which the host, Intercept itself, hosts client DLLs that implement the Intercept library. The Intercept host handles access to the RV engine by clients through a layer that provides thread concurrency, memory handling, and event dispatching. Client DLLs are then able to be written in a way that can safely ignore most internal nuances of handling data in the RV engine and work with standard C++ STD/STL data types, and only a few specialized objects specific to the game engine. The Intercept library also provides raw C bindings to the C++ versions of SQF functions, so it is entirely possible to use Intercept as the basis for writing in additional scripting languages to the RV engine, such as Python or Lua. You can find more information on our GitHub project page. Technical Details Intercept works by making direct calls to the SQF functions in the RV engine. These functions are themselves C++ functions which are then exposed to SQF for allowing interaction with the underlying game engine; Intercept completely bypasses SQF and allows C++ plugins to interact with the engine directly. User created threads can even be created and by properly using the provided thread concurrency functionality it is possible to execute game functionality safely and concurrently. Intercept clients are able to invoke through the host these commands by provided wrapper functions that replicate and emulate the SQF command namespace (minus some unneeded functionality, like arrays or control structures). These wrapper functions take standard inputs, such as simple primitives like float or bool, and standard std::string arguments and convert them into the proper SQF command variables, providing a seamless layer to the clients. An example of a very simple client that invokes nular, unary, and binary SQF functions (aka functions that take no arguments, a right side argument only, and both a left and right side argument respectively) is demonstrated below and a more examples can be found here. #include <Windows.h> #include <stdio.h> #include <cstdint> #include <sstream> // the Intercept library, only one include required. #include "intercept.hpp" // required exported function to return API version int __cdecl intercept::api_version() { return 1; } // This function is exported and is called by the host each frame. void __cdecl intercept::on_frame() { // get the player object and store it intercept::types::object player = intercept::sqf::player(); // get the post of the player intercept::types::vector3 pos = intercept::sqf::get_pos(player); // build a string... std::stringstream side_chat_msg; side_chat_msg << "Hello Arma World, here is the player pos: " << pos.x << "," << pos.y << "," << pos.z; // send it to the binary SQF sideChat command intercept::sqf::side_chat(player, side_chat_msg.str()); } // Normal Windows DLL junk... BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } Completion Status As of now (3/13/16) Intercept is over 82% language feature complete. You can view the progress of wrapper completion here. Almost all normally used SQF functions are available to the end user, and with the added ability of writing inline SQF code, you can call any function that has not had a wrapper written for it yet (though with a small performance penalty). We will post a release thread when we start releasing builds of the host. Contributions Feel free to contribute as much as you want to this project in terms of time and code. The goal of this project is to be a tool for the community to provide better performing and more complex addons for the Arma 3 platform. If you would like to contribute or want more information please join our Slack channels and get involved! License Intercept is licensed under the MIT license. You can find the full license in the LICENSE file. Prior to commit f9fe4d5 the project was licensed under the GNU/GPL v2 license and continues to be for any commit prior to that.
  2. Today we are excited to announce ACE3, a proud merger between the ACE2, AGM and CSE teams. Through a collaborative effort over the last few months we have merged these groups into one solid development team devoted to creating the most comprehensive and realistic gameplay experience for Arma 3. Taking the strong points from each of the previous modifications our goal is to deliver a modular, open system designed to support unified development in the Arma community. We are devoted to NOT reinventing the wheel, finding the best solutions, and bringing them to one place, while also fostering a development environment that promotes stability and performance. This mod is entirely open-source (we are hosted on GitHub and we will be providing the link soon), and everyone is free to propose changes or maintain their own, customized version as long as they make their changes open to the public in accordance with the GNU General Public License. ACE3 is built modularly, thus a team can maintain its own tailored version, excluding a select number of components that they don't like, or which conflict with other addons. Larger components themselves, like the medical system and other core features also include various customization options, allowing mission designers and communities to tweak the overall experience. Going Forward - ACE3 is currently under heavy development, and is close to reaching its initial release goals. We are currently planning on releasing these offerings to the public after the Marksman DLC becomes final, meaning a rough estimate can be made for our release sometime this month. We have already begun developing against the new expansion, and expect to be able to keep this timeline. Source code and Git access for preview and collaboration will be available prior to the public release. Further information, teasers, trailers, details and bananas will be released in the days and weeks to come! Never fear - ACE3 will be in your hands soon. Signed, The ACE Team Repository If you want to get a jump start on ACE3 and check out the code, please go to our GitHub repository! Core Features Completely new 3D Interaction/Action System Performance and reliability framework Focus on modularity and customization New flexible client and server settings & configuration Improved medical system with various levels (Basic/Advanced) focus on gameplay/realism Proper & consistent network synced weather Wind and Weather Advanced Ballistics Captivity System Explosives System including different trigger types Map screen improvements, marker placement and map tools Advanced missile guidance and laser designation Additional Features Carrying and dragging Realistic names for vehicles and weapons Realistic ballistics/FCS calculated in C/C++ extensions Backblast and overpressure simulation A fire control system for armored vehicles and helicopters Disposable launchers Realistic G-forces Vehicle Locking Realistic Night and Thermal vision modes Magazine repacking Realistic weapon heating Combat deafness simulation Improved Ragdoll Physics Improved interactions for AARs and ammo bearers Adjustable sniper scopes No Idle Animation with lowered weapon No talking player Avatar Jumping over obstacles, climbing over walls and cutting down fences Vector, MicroDAGR and Kestrel devices ... and much more Working With Us ACE3 is entirely open source, and you can find our project on GitHub. If you are interested in working with us get involved, if you are regularly suggesting and committing features and bug fixes to us that we accept then you'll probably get asked to join the team officially. If you aren't doing work directly on ACE3, keep at it. We are always scouting the best talent in this community and looking to mature good projects by bringing individuals and teams officially on board with us! Test Groups We already have a number of test groups lined up and currently we are not looking for suggestions on new groups. In the future if we need more active testing we'll be sure to announce it, and do not forget that, again, because ACE3 is open source, you'll be able to pull the latest commits and build the mod yourself, for you or your group! Teaser Follow us at http://www.ace3mod.com
  3. This imgur album I made a while ago shows some of the detail that the algorithm generates: http://imgur.com/a/P9BSn Warning it is fairly old, and there was a bug at the time where reflections were not causing phase inversion. Also this album might be interesting to some: http://imgur.com/a/9jETM It shows fade over altitude differences.
  4. Everyone stays in the same position exactly? I can guarantee you that the signal algorithm is deterministic. Unless you are getting weird network position updates and players are seeing each other at different locations than they really are, there shouldn't be any different in signal quality if everyone has their hands off the keyboard and mouse while transmitting.
  5. So my guess (and Jaynus is backing me up on this guess as well) is that our code that searches for open PBO files in the Arma process, to try and figure out what PBOs we need to index so we can load files from them is conflicting with the code in the EyeX software, which is most likely hooking the ntdll.dll file Windows uses. Our calls into ntdll (which are kinda funky since Microsoft doesn't export the functions we need, because who would ever want to investigate what file handles are open in the process they are in right?!) are most likely then hanging up and dying in there. I am not sure what the best way to fix this would be (short of BI giving us a list of mod folders or pbos). We might possibly be able to skip the Tobii file handles if it is NOT what I described above, and it is just some weird hangup when querying the device itself, but we'll have to see.
  6. The Steam Workshop version can be found here: http://steamcommunity.com/sharedfiles/filedetails/?id=751965892
  7. The visibility is set to hidden right now and won't change. Trying to resolve it. Also it is Arma that does the file installation of TS plugins technically.
  8. Boom! Good work everyone involved! :D
  9. noubernou

    ACRE2 Stable Release

    New Release Here: https://forums.bistudio.com/topic/193813-acre2-v22-stable-steam-workshop-release/ Mod's shut this one down please!
  10. Current Version: 2.1.0.811 Latest Release Date: 05.17.15 Current TS3 Support: 3.0.16/3.0.11 ACRE2 The Advanced Combat Radio Environment INTRODUCTION Welcome to the ACRE2 Stable release! For those who are not familiar with ACRE from Arma 2 or the ACRE2 Beta which has been released for almost a year, ACRE is a full fledged communications suite for Arma, allowing realistic radio and voice communications through Teamspeak 3. The original ACRE released in the Summer of 2010 set the bar for communications in the Arma series and allowed what was once the tedious and long task of organizing Teamspeak or Ventrilo channels, with multiple whisper lists and no direct communications between groups, to be reduced to a natural implementation in a single Teamspeak channel. All players are able to speak with each other directly or use in game configurable radios to communicate at longer distances providing unparalleled immersion in the Arma series. ACRE2 takes what ACRE1 pioneered to a whole new level. With increased performance and stability ACRE2 provides and even more immersive communications experience for the Arma user. Direct voice communications has had a complete overhaul and introduced new features such as occlusion from the environment, including vehicles and buildings, as well as multi-channel audio, allowing voices to be heard from multiple sources. A new virtual language feature in the Babel System allows mission makers to designate "languages" to certain players, making those that do not speak the same language indecipherable. This presents a multitude of gaming scenarios including player translators (Babel allows multiple languages per-person) and enemy communications that are unable to be understood. The core feature of ACRE has always been radios though, and that has undergone major improvements in ACRE2 as well. A new, extremely powerful and modular distributed data system allows for a whole manner of new features to be simulated in a robust and reliable way, and powers the most realistic real time radio simulation released in either the civilian or military market. The new data system is designed to support large numbers of radios, in a JIP compatible and persistent world setup, as well as allowing for the future implementation of highly advanced features such as data event logging and radio replay ability. While the public beta only implements two functional radios at the moment the robust and well documented framework allows for rapid prototyping and easy implementation of new radio systems by ACRE as well as the community at large. The entire system is implemented in a way to maximize commonality with current Arma modding practices, going so far to even allow individual sounds of the radios to be modded by the community or any other feature. FEATURES LIST A short list of the features in ACRE2. Accurate simulations of AN/PRC-343, AN/PRC-77, AN/PRC-148, AN/PRC-117F, AN/PRC-152. Real time voice occlusion for world objects, including buildings. Babel language system that allows you to implement virtual languages on other players. Multi-channel audio, allowing people on the radio to be heard locally as well. Radios with external speakers. Highly detailed radio signal simulation. Increased performance and stability. A highly customizable and documented framework for the creation of radios. A highly customizable and documented framework for implementing different game modes (persistent world, replays, logging, external data storage, external radio control). Customizable sound configs that allow traditional patching of sounds played in ACRE via Arma addons. Customizable radio presets, allowing groups to define radio presets in additional addons for mission makers to take advantage of (also see the F3 framework). Enhanced and easily configurable vehicle sound occlusion and intercoms. DOWNLOAD Traditional Download: http://acre.idi-systems.com/archive/acre2_2.1.0.811.zip ACRE2 is also available on Play with Six. REQUIREMENTS ACRE2 requires the latest version of Teamspeak 3 (currently 3.0.16) be installed (either 32bit or 64bit), as well as the Community Base Addons (CBA) for Arma 3, which is available on Play With Six or here: http://forums.bistudio.com/showthread.php?178224-CBA-Community-Base-Addons-ARMA-3 INSTALLATION Manual Installation If you are choosing a manual installation from the download link above please follow these short instructions for an easy installation. Download from the above link and extract the zip file to your hard drive. Open the extracted folder and open the Teamspeak/plugins folder. Copy the correct version of the plugin dll for your Teamspeak installation. Navigate to your Teamspeak installation and open the plugins folder. Paste the plugin into that folder, overwriting any current ACRE2 plugin. Return to the extracted folder and go to the Game folder. Copy the @ACRE2 folder. Navigate to your Arma 3 installation folder. Delete any current @ACRE2 folder and then paste in the @ACRE2 folder you copied from the extracted zip. Create a new shortcut or edit an existing one, and add @ACRE2 and @CBA_A3 to the -mod parameter, for a longer explanation see this tutorial: http://www.armaholic.com/forums.php?m=posts&q=20866 Launch Teamspeak 3 and enable the ACRE2 plugin in the Settings > Plugins window. Launch Arma 3 from the shortcut you created. Play With Six If you are installing from Play With Six then make sure both Teamspeak and Arma 3 are closed before running the installation. Once installation is complete launch Arma 3 through Play With Six and launch Teamspeak 3 and enable the ACRE2 plugin in the Settings > Plugins window. If the plugin is not available copy it from the @ACRE2 directory to your Teamspeak installation's plugin directory manually. CONTROLS Controls are now editable in Arma via the CBA addon keys configuration. You must be in a game to change your keys. The default controls are as follows: Radio PTT: Capslock Alternate PTT 1: Shift-Capslock Alternate PTT 2: Ctrl-Capslock Alternate PTT 3: Alt-Capslock Open/Close Radio: Alt-Ctrl-Capslock Cycle Radio: Alt-Shift-Capslock Cycle Babel Language: Left Windows Key Set Radio Left Ear: Ctrl-Shift Left Arrow Key Set Radio Right Ear: Ctrl-Shift Right Arrow Key Set Radio Both Ears: Ctrl-Shift Up Arrow Key Lower/Raise Headset, Mute/Unmute Spectators: Ctrl-Shift Down Arrow Key ADDITIONAL DOCUMENTATION Mission Maker API: http://acre.idi-systems.com/api/ Wiki: http://gitlab.idi-systems.com/idi-systems/acre2-public/wikis/home The wiki is still a work in progress and more information and tutorials will be added in the near future. WHERE TO PLAY As always, United Operations is the official ACRE community. You can find more information at http://www.unitedoperations.net/ on how to get their mod pack, access TS, and when game sessions occur. KNOWN ISSUES/LIMITATIONS/BUGS If you encounter a bug not found in this list please report them at the ACRE2 issue tracker here: http://gitlab.idi-systems.com/idi-systems/acre2-public/issues Limitation: No retransmission currently. Retrans is currently not implemented, it is a feature that will be available shortly though as it is something I consider critical. Limitation: When speaking on a radio and there is a radio nearby with its external speaker on you can not hear your own voice. This will be fixed in the future. Limitation: On JIP or disconnect, the ArmA3 engine occasionally stutters for less than a second as data synchronizes with the new player. This is being slowly fixed by BI with their new network engine changes recently in 1.44 Limitation: Some maps cause a modulation for voices on direct speaking when running quickly through buildings. Alternatives to correct this are being investigated If your dedicated server restricts the types of files clients can load, please follow this advice on how to prevent issues with ACRE2 where clients can not use their PTT key or hear radio squawks: The following is NOT a issue, and is a FEATURE in ACRE2: When you are in game and ACRE is connected you will NOT be able to hear people that are not in the game as well. This is meant as a failsafe to any issues where someone might be having connectivity issues with ACRE and it is designed to minimize and reduce situations that can reduce immersion. The following is NOT a issue, and is a FEATURE in ACRE2: ACRE simulates half-duplex radio communications as the real radios in real life do, and this may take new users a while to get used to. Half-duplex communications means only a single person can transmit at the same time, on the same radio net. The API provides the ability for communities to switch to full duplex if they require it. BASIC RADIO USAGE Radio documentation can be found on our wiki. Thank you for your support! - Jaynus & Nou THANKS Special thanks to JP and Hatchet, who have both been great recent additions in contributing to ACRE. All of the testers and their communities that have helped test ACRE2 and ACRE1 in the past. United Operations at http://www.unitedoperations.net/ for having us around and providing countless hours of testing and excuses to NOT work on ACRE. ;) Dslyecxi, for his motivation and encouragement, both for ACRE and ourselves. The entire CBA team for providing an amazing framework that has made addon development so much easier. Sickboy and the PwS crew for creating such a wonderful content distribution platform. Falcon, for all the maths. Impulse, for dealing with all the community stuff at UO. The rest of the Lovecave/Krause's Study @ UO for all your support and letting us have a place to vent about stupid $%@*. :D Mikero for his toolset that makes life easy. The Arma community on Skype, so much knowledge! All the supporters on Reddit, Facebook, and other social media that have really gotten excited! Armyguy, for being in charge of absolutely NOTHING. Bullhorn for extensive field testing with his community to determine what large communities used to other forms of communication need. Thanks! Toadball for all the documentation and videos. Tinfoilhate for extensive field testing of the mission frameworks and APIs Godhand and others for detailed real world experience and letting us pick his brain Anyone else we forgot to mention, we didn't mean to forget you! The F3 team for the extensive integration
  11. IDI Systems and the ACRE team would like to proudly announce that ACRE for Arma 3 is now currently being tested by our test groups and is in mostly stable condition! It is an almost direct port of ACRE 1.4 for Arma 2 and should be available soon for public release! More news to follow! Thank you to the community for your support and for BIS for their hard work and amazing products!
  12. noubernou

    ACRE2 Stable Release

    Tanoa support is now in the next release betas. Hopefully we can call this an RC and get it out the door soon for everyone.
  13. noubernou

    ACRE2 Stable Release

    We had auto-channel move in ACRE1 and no one used it. Also since TFAR requires specific TS channels it makes more sense for them to implement it. We've never found the need for it to be that strong with ACRE2.
  14. noubernou

    ACRE2 Stable Release

    Development has slowed down significantly the last few months, everyone got really busy with real life, and it turns out working on real radios is a bit time consuming for me... :P We have some plans though to give development a shot in the arm here after the next stable release. Hopefully going to be able to get some work done on it tomorrow. There is just a couple more features we want to add (mainly Tanoa support, and some options to disable some of the more realistic simulation aspects).
  15. noubernou

    ACRE2 Stable Release

    We have been in active development this whole time, it is just that there are significant changes in the next version and we really want to flesh them out. That being said though, things have been hectic with real life the last few months for everyone on the ACRE team. Luckily all good news for everyone, but still busy busy busy. We've been on the verge of a public release for 6 weeks now, we just need to get a couple more tests out and done. Also my real life stuff is that I am now working on programming real life radios.
  16. noubernou

    ACRE2 Stable Release

    Not possible.
  17. noubernou

    Line Drawing

    Map Tools in ACE2/3 solved this almost 6 years ago...
  18. This addon does a few things to the map: Removes satellite texture from any zoom level. Changes the color of the contour lines and hill numbers to make them more readable. Made forests more washed out and slightly dimmed the background color to be easier on the eyes. Adds in a ruler that you can draw on the screen. Adds in a compass that you can more easily use to align the above ruler. Adds in basic tools to draw lines. Map Images: These features do a few things. First off they allow easier reading of the map at close zoom, including determining the rise and fall of the land. It is now easier to also determine altitude, before the satellite texture would obscure the hill numbers and a lot of the contour lines would be lost in the textures as well. The forests could also obscure the contour lines so they have been made a little more washed out to provide better readability. The ruler tools allow you to do a number of LANDNAV type things, including the most important, resection. This was possible before but a bit more painful. Combining the ruler, compass and line drawing tools you can more easily triangulate your position. I also use the ruler and compass to plot polar fire missions as well as guage distance to targets while doing forward observation. To use the tools: Ruler: Hold the H key down and click on the map. A red dot will appear. This is the origin of the ruler. Hold the J key down and click at an angle off of the red dot. A ruler will be drawn stretching in that angle. The 0 point shows the angle in degrees and both Mil 6400 and Mil 6000. To redraw the compass you move it by using the H key again, repeating steps 1 and 2. To just redraw at another angle use the J key and click again someplace else and it will draw at that angle. There is no way to completely clear the compass, just repeat step 1 to place the origin point out of the way. Compass: Hold the K key and click. The inner compass rose is in in degrees, the outer one is in Mil 6400 To clear the compass hold L and click on the map. Line tool: Hold the [ key and click. A black dot will appear. This is the start of your line. To change color, do not move the mouse and click again, each successive click will switch colors, clicking to fast will place a marker. To complete the line hold the ] key and click where you want to end it. To clear a line hold the \ key and click on the map, it will continue to delete lines from the newest to the oldest. If you have any problems with this, mainly the clicks not responding, make sure the map is in focus by clicking around a few times in it. Issues: A non game affecting error will occur if you reverse steps 1 and 2 from the ruler script. Same goes for if you do step 2 before 1 the first time you do a line. This is only visible if you have errors turned on in the game. Key event handlers are not international specific, I do not know anyone that can help me test those very well, but I have had a Dutch and Polish player use them with out issue. The event handlers themselves, probably could be done a different way. They might interfer with other map addons in the future. Thanks: Zedic from the 7th Cav for doing the LANDNAV course and showing me how to actually use the ArmA2 contour lines and showing that yes, it sucks reading them as it is. Desdinova, also from the 7th Cav for beta testing for me. Everyone in my Field Artillery Platoon who helped me test the ruler and compass script over the past couple of months. You guys rock. Download: Map Plus v1.0 (Please Mirror) Install: Install as any other addon.
  19. Yea, and it has been over a year since the last April fools joke we did and somehow that is still being played out...
  20. How ACE3 integrates it is still up for debate. There are definitly some systems in ACE that would instantly benefit from this, like wind deflection and the lasers system (I wrote an example of the ACE laser system in Intercept). I also plan to look at how ACRE can benefit from this as well, mostly in making it easier to move more and more of ACRE into C++ and making the entire ACRE system more generic and decoupled from Arma. For other modders I do hope it gets picked up, and I hope it can bring in new talent. A lot of serious game modders are reluctant to take up Arma modding because of SQF and some of the performance issues that come along with it. By providing a native way to code game modifications I hope that people who disregarded the platform before will take a second look and maybe put their ideas into motion on this game platform.
  21. Not to toot my own horn (or the horns of the gracious people who have contributed to this project along with me), but it really is. This breaks the engine wide open for modding. One of the pet projects I want to work on using this is integrating JSBSim or some other fixed wing FDM to replace the normal Arma flight model for airplanes. That is totally doable now in a very easy, performant way.
  22. noubernou

    Scripting language for Take On Mars

    It looks like C++/CLI. It is basically a CLI (the .NET bytecode) version of C++. It is pretty nice, though it is not _standard_ C++ (and I believe it lacks a lot of features from C++/11 and C++/14 [and nothing from C++/17]).
  23. noubernou

    Scripting Discussion (dev branch)

    To be honest I sort of like it, though the RPT error is backwards, it complains about the type provided being the type expected, and the type expected being the type provided. But yea, it gives hard validation to input in a way that matches the rest of the language. I just wish there was a way to do it on non-optional params. Right now you can not define non-optional params as having a required type (which I guess kinda makes sense in terms of the SQF engine, in that it doesn't stop the actual execution, though that'd be nice too). The best would be if it threw the RPT error and threw an exception as well.
  24. Oh my, function keywords and returning variables! https://github.com/NouberNou/carma2#using-the-function-keyword
  25. carma2 A thinline object parser/translator for RV SQF offering a prototyped object system with automatic, unintrusive garbage collecting memory management. Github: https://github.com/NouberNou/carma2 The only dependency is CBA. Concept The concept of carma2 is to add a very low overhead, very simple object implementation in SQF. The focus is on maintaining as many paradigms with SQF as possible, so as to not create too much of a disassociation with base SQF. Implementation of objects is done in a very simple fashion that ultimately is closer to syntactic sugar than it is a "proper" object implementation, but through the help of helpers provides a robust object system. Objects are created using the new keyword and members and methods are accessed using the . operator and assigned/defined using the standard SQF = operator. The only major difference is that method invocation is done using () following the method name, instead of the standard SQF arg call function format (though it is entirely possible to invoke methods this way, though with some caveats). A simple carma2 example is below: _testObject = new carma2_object(); // create a new object from the default carma2_base object _testObject.myMethod = { player sideChat "hello world!"; }; _testObject.myMethod(); // calls myMethod and displays "hello world!" Method parameters can be accessed via the normal _this variable.Objects as such then are defined as they are created, similar to the Javascript prototype system. As such creating a new object of an existing type is as easy as follows: // using the code from above _anotherTestObject = new _testObject(); _anotherTestObject.myMethod(); // calls myMethod on this new object. Objects will copy their members (but will not copy their values) to the new object, and copy their methods as well. This means that you can easily define and create new objects. Type checking can be done via the special __prototype member in every object, which will contain the object that new was called on. Introspection can be achieved via using the normal allVariables SQF command on an object (carma2 objects are implemented as location objects, which have no in-game overhead).Method definitions can access their calling object via the _thisObj variable. For example: _testObject = new carma2_object(); // create a new object from the default carma2_base object _testObject.myMethod = { player sideChat format["myVal: %1", _thisObj.myVal]; }; _testObject.myVal = 2; _testObject.myMethod(); // calls myMethod and displays "myVal: 2" Objects can call a constructor like function on creation by assigning the special method __init. There are no destructors in carma2 as the system uses a garbage collecting reference tracker. Implementation of a special method for when the object is garbage collected (or the del keyword is used) is forthcoming, though programmers using carma2 should make sure to smartly implement resources that need to be freed in a way that is not dependent on the lifespan of the object.Usage Using carma2 is very simple. Launch with the mod enabled/included, as well as CBA. A simple usage example is here: #include "\x\carma2\rv\addons\lib\carma.hpp" CARMA_COMPILE("test.sqf"); That code will compile and load the file test.sqf. You can then access any globally defined objects compiled in there.The CARMA_COMPILE macro is a macro to carma2_fnc_compile. If you just wish to compile your code with out executing it (not often the case), you can pass an optional false argument. The compilation function will return the compiled results either way. Advanced Concepts Calling Parent Functions Calling the parent function of an overridden object method can be done via the __prototype member as seen below: _testObject = new carma2_object(); // create a new object from the default carma2_base object _testObject.myMethod = { player sideChat "hello world!"; }; _testObject.myMethod(); // calls myMethod and displays "hello world!" _anotherTestObject = new _testObject(); _anotherTestObject.myMethod = { _thisObj.__prototype.myMethod(); player sideChat "good bye world!"; }; _anotherTestObject.myMethod(); // calls myMethod on this new object, which invokes myMethod from _testObject, printing "hello world!" and then "good bye world!" ChainingChaining members is allowed if they are also objects (if they are not, undefined RPT errors may occur). _var = _testObject.myMemberObject.anotherMember; // accessing a members member. _testObject.myMemberObject.someMethod(1,2,3); // invoking a members method. As of the time of writing, method chaining produces syntax bugs. It will be fixed before release.Anonymous Objects Passing an object to a SQF function or a carma2 object method can be done anonymously via the new keyword. [new someObject()] call some_sqf_fnc; _myObject.method(new subObject()); PerformanceA often run into drawback with object oriented systems in SQF are the overhead that objects introduce, either through their programmatic implementation or through their in engine implementation. In carma2, the language strives to be as close as possible to the engine, to minimize overhead. To do this carma2 utilizes the native setVariable and getVariable SQF functions on native SQF objects, which in this case are locations. Locations in SQF add no apparent overhead to game performance, and are simply resident in the SQF engine's memory. As such, tens of thousands of them can be initiated with no performance impact. This is already being utilized in projects such as ACRE for implementing a fast, SQF native hash-map implementation. Because of this member variable access is a simple call to getVariable. Assignments are a simple call to setVariable. Invoking a method simply calls a wrapper function that creates the _thisObj special variable and then calls the arguments on a getVariable call. Overhead on method invocation is as little as 0.0077ms, and default single member access is often a third of that. This provides almost native SQF level speeds.
×