code34 248 Posted October 22, 2017 Bus message exchange Lastest version: 2.4 by Code34 Description OO BME is a class (object oriented) that permits to build a main BUS messages between clients & server and transfert data between clients & server. Like to Donate ? Donate with paypal Github: https://github.com/code34/oo_bme2.vr Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-CompilingFeatures: - build one main bus message - Works in local & MP - rewrite of BME 1.0 in OO way - Asynchronous remote execution - Synchronous remote execution (like promise in js) Licence: Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author Documentation: /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2016-2018 Nicolas BOITEUX CLASS OO_BME This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Function: _bme = "new" call OO_BME; Create a new bme object (require to create at same time a handler) */ /* Function : _result = ["remoteCall", ["remotefunction", parameters, targetid, defaultreturn, timeout]] call _bme; @remotefunction is a string declare in clienthandler or serverhandler file @parameters of remotefunction @targetid clientid of the target or 2 for server @defaultreturn : default return, in case of no return of the target @timeout: limit of time to wait for the answer of target */ /* Function : ["remoteSpawn", ["remotefunction", data, "target", playerid]] call _bme; @remotefunction is a string declare in clienthandler or serverhandler file @data paramters of remotefunction @target is a string ("client" or "server" or "all") declare the target where the remote function will be exectued @playerid (optionnal) is a scalar defined by the player id where the code should be executed */ How to declare remote functions =========================== You have to declare your remote functions as normal function with global declaration name The handler declaration must respect this syntax: remotefunction = { code to execute on other side } You can declare thoses functions directly in your code. Readme: /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2013-2018 Nicolas BOITEUX Bus Message Exchange2 (BME) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ Create a main bus message between clients & server Usage: put this code into your mission init.sqf call compile preprocessFileLineNumbers "oo_bme.sqf"; See example mission in directory Licence: You can share, modify, distribute this script but don't remove the licence and the name of the original author logs: 2.4 - fix remotecall, add timeout, switch to vr map, clean examples, add new oop, fix handlers with schedule code 2.3 - fix queueing, log, add new oop 2.2 - delete useless old handlers 2.1 - add remoteCall 2.0 - first implementation Examples /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2016-2018 Nicolas BOITEUX CLASS OO_BME This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "oop.h" call compile preprocessFileLineNumbers "oo_bme.sqf"; call compile preprocessFileLineNumbers "example.sqf"; sleep 2; bmeclient = NEW(OO_BME, nil); // First Example - remoteCall - synchronous call if(local player) then { private _count = 0; while {_count < 10} do { _result= ["remoteCall", ["getServerName", (name player), 2, "nothing"]] call bmeclient; hint format ["RemoteCall from client: %1", _result]; _count = _count + 1; sleep 1; }; }; // Second Example - remoteSpawn - asynchronous call if(local player) then { private _count = 0; while {_count < 10} do { _message = "hello server, remoteSpawn message send from client"; ["remoteSpawn", ["sendServerMessage", _message, "server"]] call bmeclient; _count = _count + 1; sleep 1; }; }; // Third Example - remotespawn - asynchronous call from server to client if(isserver) then { private _count = 0; while {_count < 10} do { _message = "hello client, message send from server"; ["remoteSpawn", ["sendClientMessage", _message, "client"]] call bmeclient; _count = _count + 1; sleep 1; }; }; 2 Share this post Link to post Share on other sites
kremator 1065 Posted October 22, 2017 I don't understand it...but looks impressive! 3 Share this post Link to post Share on other sites
code34 248 Posted October 22, 2017 Hi Kremator :) As this time, not really, cause there were a really big positive update on ARMA3 native netcode since 2 years. Share this post Link to post Share on other sites
pierremgi 4888 Posted October 22, 2017 Any example for applications? Because it seems a lot of work just for remoteExec a hint. Share this post Link to post Share on other sites
code34 248 Posted October 22, 2017 Lol yes i know :) BME is a very old netcode that was build before remotexec & BIS_fnc_mp, at the time where netcode of ARMA was very bad and i need something to stabilize it. For common usage, it s depricated, i still use it in some code, and publish it for who want to check. 1 Share this post Link to post Share on other sites
code34 248 Posted November 4, 2017 Hi guys, Just release the version 2.1 of BME This last release adds the support of synchronous call of remote function :) example: client side: _result= ["remoteCall", ["getServerName", name player, "server"]] call global_bme; will return directly the output of the server side function execution server side: BME_netcode_server_getServerName = { if(isNil "counterserver") then { counterserver = 0;}; counterserver = counterserver + 1; format ["hello %1, my name is server%2 and i return you a result", _this, counterserver]; }; Have fun Share this post Link to post Share on other sites
code34 248 Posted November 5, 2017 For more informations, on how it works, you dont need anymore to declare handler :) you juste have to call your target function with BME :D Share this post Link to post Share on other sites
code34 248 Posted November 5, 2017 just publish the hotfix for remotespawn and client that dont receive informations. Share this post Link to post Share on other sites
code34 248 Posted November 8, 2017 hi, im looking for any testers for this last release :) Share this post Link to post Share on other sites
Guest Posted November 8, 2017 The Armaholic mirror has been updated with the new version: OO BME2 v2.1.1 ** the version 2.1.1 is 'invented' by me to indicate the hotfix version Share this post Link to post Share on other sites
code34 248 Posted November 8, 2017 7 hours ago, foxhound said: The Armaholic mirror has been updated with the new version: OO BME2 v2.1.1 ** the version 2.1.1 is 'invented' by me to indicate the hotfix version LOL :) no problem with that ! nice workaround ;) Share this post Link to post Share on other sites
code34 248 Posted November 19, 2017 hi Dudes, Just release the 2.2 version: delete useless old handlers replace by an example file You don't have anymore to declare your remote functions with extra prefix. A global declaration of the function anywhere in your code, is enough to make it works. exemple: remotefunction = { your remote code }; Share this post Link to post Share on other sites
code34 248 Posted November 24, 2017 Hi Dudes, Just release the 2.3 version fix queueing, fix logs add new oop version i also create new git branch "develop" where will be done all next developement before release. If you have any requests dont hesitate to contact me. Share this post Link to post Share on other sites
Guest Posted November 24, 2017 The Armaholic mirror has been updated with the new version: OO BME2 v2.3 Share this post Link to post Share on other sites
code34 248 Posted March 1, 2018 Hi Dudes :) I just release the version 2.4: fix remotecall, add timeout, switch to vr map, clean examples, add new oop, fix handlers with schedule code Remotecall should be now totaly efficient and more interesting than arma remote function exec :) 1 1 Share this post Link to post Share on other sites
Guest Posted March 1, 2018 The Armaholic mirror has been updated with the new version: OO BME2 v2.4 Share this post Link to post Share on other sites
code34 248 Posted March 1, 2018 @foxhound thanks you for the follow :) Share this post Link to post Share on other sites