.kju 3245 Posted March 14, 2012 Excellent work there Scott! I am wondering if you have an idea how many people tried and how many use Arma2NET at this point? With the state and issues of the TOKH JVM and the preference of some like Xeno in .NET, I would expect some people to look into and use it. Especially with the excellent presentation and guidance you provide here. The other part is are you yourself mainly developing the Arma2NET wrapper itself or do you use it also for other Arma projects of yourself? Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 14, 2012 Not sure how many people use it exactly, but you can get a general idea from looking at https://bitbucket.org/Scott_NZ/arma2net/downloads which has download counts for each item. I am developing the Arma2NET wrapper itself, mostly because I don't have any ideas for side projects at the moment. Share this post Link to post Share on other sites
.kju 3245 Posted March 14, 2012 Thanks Scott. Things I could think of would MP save, stats tracking, in general MP persistence. In general I think the wrapper will remain useful in the future (TKOH/A3). So I am very happy to see it progress. :) Share this post Link to post Share on other sites
wobbleyheadedbob 10 Posted March 14, 2012 Thanks Scott. Things I could think of would MP save, stats tracking, in general MP persistence.In general I think the wrapper will remain useful in the future (TKOH/A3). So I am very happy to see it progress. :) Ditto this! Projects like these are the ones that have the potential to take the engine to a whole new level. Keep up the good work! Share this post Link to post Share on other sites
mcpxxl 2 Posted March 14, 2012 This fine pice of software brings a big smile into my face :D Thanks for the short response in case of sample file ! MCPXXL Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 15, 2012 I have started playing around with SQL Server Compact Edition and have managed to get database insertion/retrieval working from Arma 2 as a proof of concept. So we could use this to store player data when they leave and then retrieve it when the player rejoins for a bit of MP persistence. _n = ("Arma2net.Unmanaged" callExtension "MPDatabase ['Insert', 'Scott', 1, 2, 3, 'Radio', '1 mag', 'akm']") hint ("Arma2Net.Unmanaged" callExtension "MPDatabase ['Select', 'Scott']") hints ["Scott", 1, 2, 3, "Radio", "1 mag", "akm"] Share this post Link to post Share on other sites
jedra 11 Posted March 15, 2012 I have started playing around with SQL Server Compact Edition and have managed to get database insertion/retrieval working from Arma 2 as a proof of concept. So we could use this to store player data when they leave and then retrieve it when the player rejoins for a bit of MP persistence. _n = ("Arma2net.Unmanaged" callExtension "MPDatabase ['Insert', 'Scott', 1, 2, 3, 'Radio', '1 mag', 'akm']") hint ("Arma2Net.Unmanaged" callExtension "MPDatabase ['Select', 'Scott']") hints ["Scott", 1, 2, 3, "Radio", "1 mag", "akm"] Wow - that is very cool indeed! Where does it store the connection string? Share this post Link to post Share on other sites
nuxil 2 Posted March 15, 2012 good work. altho. take care of little bobby. we dont want him to drop anything :) Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 15, 2012 I'm thinking of storing the connection string in a text file. And Bobby is taken care of, I'm using prepared commands. Share this post Link to post Share on other sites
.kju 3245 Posted March 15, 2012 Very nice Scott :bounce3: I had one more idea - maybe you can give an estimate if it would work and make sense: There is something we call AIO/All In One config. It is basically a memory dump of the config space currently active. More see: http://forums.bistudio.com/showthread.php?125943-How-to-create-an-AllInOne-config Currently there are two ways: 1) Dump to rpt 2) Write to clipboard The later is faster, yet requires user input, while one wants to have the processes automated (via autotest). The former needs so adjustments in the formatting due the limit of the rpt and noise present in the rpt. What do you think? Share this post Link to post Share on other sites
jedra 11 Posted March 15, 2012 To get AIO to dump into a database would be fantastic - it would also be something useful to Sickboy for the online config browser - might cut out quite a few conversion steps for him. Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 15, 2012 It would work, but I'm not really sure what you're after here, you'll have to elaborate :P Share this post Link to post Share on other sites
.kju 3245 Posted March 15, 2012 a) Directly write strings from the game to an external file. b) Possible speed benefit. c) Easier to post process the result. d) Easier to add a pipeline afterwards to do further tasks. Does that help? Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 15, 2012 (edited) Yeah that would be a good and simple task. I'll write a plugin and then sign it using Arma2NET's key so it'll be able to write to the host PC without the sandboxing interfering. Edit: Something like this? using System.AddIn; using System.IO; using System.Reflection; using AddInView; namespace WriteToFilePlugin { [AddIn("WriteToFile")] public class WriteToFile : Arma2NetAddIn { public override string Run(string args) { File.WriteAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "WriteToFile.txt"), args); return null; } } } Writes a file named WriteToFile.txt to the plugin's folder. Called like: _blah = ("Arma2Net.Unmanaged" callExtension "WriteToFile blah") If you'd like to test it, I uploaded it to https://bitbucket.org/Scott_NZ/arma2net/downloads/WriteToFilePlugin.dll Simply create a folder named "WriteToFilePlugin" inside the AddIns folder and pop the dll in there. Edited March 15, 2012 by Scott_NZ Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 16, 2012 I have written some more documentation about some of the 1.2 changes, the explicit plugin/CLR activation and the SQF generator. https://bitbucket.org/Scott_NZ/arma2net/wiki/Activation#!activation https://bitbucket.org/Scott_NZ/arma2net/wiki/Sqf_expressions Share this post Link to post Share on other sites
Scott_NZ 10 Posted March 30, 2012 Arma2NET has been updated to version 1.3 with the following changes: - Small string formatting changes. (ability to escape ' or " characters) - Finalised the Arma2NET API. - Plugins can now have code execute when they are deactivated. (via Deactivate() method) - Logs are now archived into a Logs folder after they reach a day old. Logs are stored for 7 days. This behaviour can be changed by editing NLog.config. Some minor logging performance improvements. ZIP archive: https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NET-1.3.zip Installer: https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NetInstaller-1.3.msi I updated all of the files on the Downloads page to work with 1.3. I also had a play with SQF dialogs, and have managed to create a (basic) Python REPL using Arma2NET and the PythonPlugin. It mostly works but it's far from finished: http://dl.dropbox.com/u/8707714/arma2oa_2012_03_27_22_11_13_901.png Share this post Link to post Share on other sites
kremator 1065 Posted March 30, 2012 This is very exciting - I wish I had the coding knowledge to be able to use it ! Over to you coding gurus ! Thanks Scott Share this post Link to post Share on other sites
Guest Posted March 30, 2012 Updated version frontpaged on the Armaholic homepage. Arma2NET v1.3.NET Framework 4 Client Profile Share this post Link to post Share on other sites
firefly2442 6 Posted April 1, 2012 Do you run Visual Studio 2010 Express? https://gist.github.com/ab84ae35eeb946ae76fd Just curious because I'm having some problems running the Build.bat script. I grabbed the latest cloned code from bitbucket. For the .NET client profile, it asked to repair or remove it so I'm pretty sure this is already installed via the .NET 4.0 framework installer. The next step is the Build.bat but this fails. I tried opening the Arma2NET.sln solution but it says that some of the projects (in particular the unmanaged project solution) cannot be opened because this type of project is not supported (.vcxproj). Not sure if this is a limitation from VS2010 Express or not... I'm interested in writing a MySQL plugin that uses Arma2NET in order to replace this: https://dev-heaven.net/projects/arma2-mysql The code is all there (public git access). In particular, the portion that connects to a MySQL database and runs commands and such. I'm not sure if that's something that you can easily take in and make a plugin (it looks like you're a whiz at .NET). Or, I can take a crack at it if I can get this build issue straightened out. Cheers. :) Share this post Link to post Share on other sites
Scott_NZ 10 Posted April 1, 2012 (edited) I use Visual Studio 2010 Ultimate. As for Express, since it comes in several editions which specialise in a particular language (Visual C#, Visual C++ etc), it does seem to explain why the vcxproj isn't supported - you can't compile a C++ project in Visual C# for example, because Visual C# only supports C#. Professional and above supports all of the languages in one package. You would be correct about the Client Profile being installed via the full installer. The Client Profile is a slimmer version of the full framework, aimed at clients/desktop users, and doesn't contain unnecessary stuff typically aimed at servers. As for why it fails to build, the Arma2NET solution expects a key to sign the projects with (referred to by the solution as Arma2NetKey.snk - I don't version this). You can either provide your own key to sign the projects with (you can create one from your Project Properties -> Signing -> Sign the assembly and click <New...>, or use snk.exe) or you can configure the solution not to sign the assemblies at all. Arma2NET uses signing to decide whether to sandbox plugins or not. If you sign Arma2NET using your own key, and then sign your plugin using the same key, Arma2NET will run your plugin with no sandboxing if the keys match (it also does other checks to verify the authenticity, see AddInManager.cs). If you don't sign your plugin using the same key, the plugin will be run in a sandboxed configuration. If you don't sign the Arma2NET assemblies themselves, all plugins will be run in a sandboxed configuration. Your MySQL plugin will probably be crippled via sandboxing if the key isn't recognised by Arma2NET. You can either sign it using the same key as the Arma2NET key, or make the following change in AddInManager.cs and then recompile it: change private static bool VerifyAddInStrongName(AssemblyName assemblyName) { byte[] keyAddIn = assemblyName.GetPublicKeyToken(); byte[] keyAddInManager = typeof(AddInManager).Assembly.GetName().GetPublicKeyToken(); if (keyAddInManager == null || keyAddIn == null || !keyAddInManager.SequenceEqual(keyAddIn)) { return false; } string assemblyFile = Path.Combine(PipelineBaseDirectory, "AddIns", assemblyName.Name, assemblyName.Name + ".dll"); bool wasVerified; return StrongNameSignatureVerificationEx(assemblyFile, true, out wasVerified); } to private static bool VerifyAddInStrongName(AssemblyName assemblyName) { return true; } You can check whether a plugin was sandboxed or not by opening Arma2NET.log in the Arma 2\Expansion\beta\@Arma2NET folder. If/when you've got your plugin working, I can sign your plugin using my key to have it recognised by the official Arma2NET so it will be usable by others (short of distributing your own signed version, but I would prefer that you didn't do this for authenticity reasons and possible problems in the future). Cheers :P Edited April 1, 2012 by Scott_NZ Share this post Link to post Share on other sites
firefly2442 6 Posted April 1, 2012 Thank you very much for the detailed explanation. I disabled signing on all the projects in the solution (that loaded) and changed the code for that function to return true always. Turns out I do have Visual Studio C++ Express edition installed already but as you mentioned opening any project type is a limitation of the free express version. For some reason I can't seem to open the Arma2Net.Unmanaged code in VSC++ 2010 express. In running the Build.bat script, there are still some warnings about not being able to find certain files: CSC : warning CS1668: Invalid search path 'C:\Program Files (x86)\Microsoft Vis ual Studio 10.0\VC\atlmfc\lib' specified in 'LIB environment variable' -- 'The system cannot find the path specified. ' [C:\Users\Patrick\Documents\Visual Stu dio 2010\Projects\Arma2NET\Arma2Net\Contract\Contract.csproj] https://gist.github.com/c542b2c88c7e3f8ef08c However, curiously the Arma2NET.Unmanaged project seems to create a .dll after running Build.bat. I followed the rest of the steps after this for the example but in loading the game up, nothing is displayed via the hint. I suspect these warnings are preventing something from compiling. I assume the Build.bat script does the same thing as building all the projects individually in Visual Studio? Would it be possible to provide unsigned binaries of the necessary DLL files? I think this would make it a lot easier for people (like me :) ) who want to write plugins to use this system. Cheers. Share this post Link to post Share on other sites
Scott_NZ 10 Posted April 2, 2012 (edited) Your cloned files should look mostly similar to this: http://dl.dropbox.com/u/8707714/a2n.png http://dl.dropbox.com/u/8707714/a2ncontract.png http://dl.dropbox.com/u/8707714/a2nunmanaged.png I'll get working on an unsigned version now. Edit: here you go: https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NET-1.3-Developers.zip To anyone else reading this, download https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NET-1.3.zip instead. Edited April 2, 2012 by Scott_NZ Share this post Link to post Share on other sites
firefly2442 6 Posted April 2, 2012 Yep, mine look essentially the same (except I don't have a .user file in the Contract folder). Hmm. Well, anyway, I was able to use the unsigned DLLs and got the example working so on to MySQL stuff. Thanks! :) Share this post Link to post Share on other sites
firefly2442 6 Posted April 9, 2012 Have you done any testing using this on a Windows dedicated server? I'm curious because I have a compiled version of some code working on a retail copy of A2:OA. When I move that over to another computer running Windows and a dedicated server, it doesn't seem to work. I believe the system has all the appropriate .NET dependencies. Would I need to natively compile it for each computer? I guess I'm not sure how the compilation process works for C#, if it dynamically or statically links in the dll files. Cheers. Share this post Link to post Share on other sites
kremator 1065 Posted April 9, 2012 So is this the idea guys? I have a windows dedi server, and I run your scripts/code on it. I then fire up a mission that is coded to use the scripts. I play for a while, and it can record positions/health of everything and I shut down mission and server. The next day I boot the server, run your scripts and then the mission and VOILA everything is back the way it was when I left ? If this is so, and you want a noob (so things should be foolproof!) to help out running things .... just ask. Share this post Link to post Share on other sites