Jump to content

Spiderswine

Member
  • Content Count

    5
  • Joined

  • Last visited

  • Medals

Everything posted by Spiderswine

  1. Hey Guys, i love playing Arma, but there is one thing that always bothered the hell out me... Why we have no way to save player data like custom weapon configs, player outfits etc with our account and access them on multiple multiplayer servers like "King of the Hill" or "Altis Life"? Over the past months i've tried to figure out a way to make this happen. I found the wonderful Add On https://github.com/playnet-public/ArmA3URLFetch, which gives us the possibility to access API Endpoints from your local machine in multiplayer missions. The last days i developed an open django api endpoint, which can be requested by the player in the mission and there fore, there can be exchanged data, without the need of a local database. Of course, there's the question on how to authenticate the unique player in the mission. I'm trying to rebuild an OAUTH like workflow, where the local server acts as an authentication provider, by calling the api endpoint as well. Here's the workflow: In my opinion, this new approach gives mission creators a very powerful tool... Creators can now access every possible player information through one endpoint from multiple servers: Here's a multiple server setup: This gives mission creators the ability to share player information across every server of their mission and maybe host a mission website to access player information outside of Arma. At the moment i've developed a "proof of concept" iteration to ask for feedback if there is a need for such a system. I'm looking forward to your feedback and i would love to implement such a system in an upcoming multiplayer scenario. Here's an example example multiplayer mission. Here's the open django api endpoint. Best Regards, Luke PS: Sorry for the bad paint pictures, i'm broke 😉 Here is how its done: (authentication stuff is still in work...) Call the authentication in the initPlayerLocal.sqf and give player action (just for testing purposes) player addAction ["Handle Request", { [] spawn it_fnc_handleRequest }]; // handle the authentication [] spawn it_fnc_handleAuthentication; define the handleAuthentication function _cliendid = [ "http://192.168.0.102:8000/api/auth", "GET", ["uid=xyz"], true ] call a3uf_common_fnc_addClient; [ _cliendid, ["Content-Type: application/json"] ] call a3uf_common_fnc_setClientHeaders; _response = [ _cliendid ] call a3uf_common_fnc_clientRequest; _test = parseSimpleArray _response; _next = _test select 1; _u = _next select 0; _auth_token = _u select 1; diag_log "AUTH TOKEN"; diag_log _auth_token; _token_string = format["token=%1", _auth_token]; _cliendid = [ "http://192.168.0.102:8000/api/check", "GET", ["uid=xyz", _token_string], true ] call a3uf_common_fnc_addClient; [ _cliendid, ["Content-Type: application/json"] ] call a3uf_common_fnc_setClientHeaders; _response = [ _cliendid ] call a3uf_common_fnc_clientRequest; _test = parseSimpleArray _response; _next = _test select 1; _u = _next select 0; access_token = _u select 1; diag_log "ACCESS TOKEN"; diag_log access_token; define the handleRequest function _cliendid = ["http://192.168.0.102:8000/api/user", "GET", [], true] call a3uf_common_fnc_addClient; _auth_string = format ["Authorization: Bearer %1", access_token]; [_cliendid, ["Content-Type: application/json", _auth_string]] call a3uf_common_fnc_setClientHeaders; _response = [_cliendid] call a3uf_common_fnc_clientRequest; _test = parseSimpleArray _response; _next = _test select 1; _u = _next select 0; _name = _u select 1; hint format["Hello %1", _name]; diag_log "REQUEST"; diag_log _auth_string ; diag_log _response; define endpoints in views.py # api endpoint for user to access saved informations @api_view(["GET"]) def user(request): print(request.headers) token = request.headers.get("Authorization").split(" ")[1] # find the player by given access token try: player = Player.objects.get(token=token) # get the player # except User.DoesNotExist: except: # player with given token not found, return error return Response({'error': 'Player with token not found'}, status=HTTP_400_BAD_REQUEST) return Response({"name": player.name})
  2. Spiderswine

    Http requests extension

    Hey MechSlayer, today i was trying to implement your module into my recent project, and with static routes it works fine, but when im trying to call dynamic routes i can't receive valid data. Here's my get request: "ArmaRequests" callExtension "0|GET|https://jsonplaceholder.typicode.com/posts/1/|null" it seems to have a problem with routing, the request with the following url, https://jsonplaceholder.typicode.com/posts, works just fine. Best Regards, Luke
  3. Hey guys, at the moment i am working on an idea to implement a working weapon smithing solution which i was looking forward for a long time. Recently the function "addWeaponWithAttachmentsCargo" was implemented and finally i saw my chance to create the script. Above you can see the existing iteration for this workbench. At the moment you can open the dialog and attach all the compatible items to the players weapon. In the following link you can see an existing multiplayer mission, where the system was implemented: https://github.com/LukasMarschall/Arma3BattleRoyale/tree/master/IslandThunder.Malden/dialogues Looking forward to see your opinion and feedback. Cheers, Luke
  4. Thanks for posting, but my aim was to set up a navigation system for players on a server, luckely this works now a bit better ;)
  5. Hey Folks, recently i was playing a bit with setting up the dijkstra algorithm in arma. With the following code you will be able to navigate from your position to a marker on the map. Have Fun! Video Tutorial: Tutorial on YouTube Parts of the Algorithm: Create Road Map, Gets all connected roads on the map and save them in an array Run the Dijkstra Algorithm, Defines the graph for the RoadMap with recent starting point Finding the Path, Gets the position of the destination marker on the map and finds the shortest path Create Local Markers, Create markers for every path node Delete Markers on Passing, When passing the navigation markers they will be deleted from the gui Create Road Map // Create Road Map _roadMap = []; _nextRoads = []; _finishedRoads = []; _startRoads = player nearRoads 10; _firstRoad = _startRoads select 0; _nextRoads pushBack _firstRoad; _iterationCounter = 0; while {_iterationCounter < 1000} do { _nextRoad = _nextRoads deleteAt 0; _connectedRoads = roadsConnectedTo _nextRoad; { _distance = _x distance _nextRoad; _roadMap pushBack [_nextRoad, _x, _distance]; if((_finishedRoads find _x) == -1) then { _nextRoads pushBack _x; }; } foreach _connectedRoads; _finishedRoads pushBack _nextRoad; _iterationCounter = _iterationCounter +1; }; Run the Dijkstra Algorithm // Run the Dijkstra Algorithm _startRoads = player nearRoads 10; _startRoad = _startRoads select 0; // Init Distances _distanceArray = []; _workQueue = []; _distanceArray pushBack [_startRoad, 0, null]; _visitedRoads = []; _visitedRoads pushBack _startRoad; _workQueue pushBack [0, _startRoad]; while { count _workQueue > 0} do { _workItem = _workQueue deleteAt 0; _actualRoad = _workItem select 1; // Get the connected Roads out the RoadMap { _road = _x select 0; _connRoad = _x select 1; _connDistance = _x select 2; if ((_road == _actualRoad) && !(_connRoad in _visitedRoads)) then // Find Connected Roads, not yet visited { _visitedRoads pushBack _connRoad; // Save connected road as visited // Calculate Distance between the Roads _roadDistance = _connDistance; // Search for Parent in Distance Array and get his Distance { _parentRoad = _x select 0; _parentDistance = _x select 1; _parentParent = _x select 2; if(_parentRoad == _road) then { _roadDistance = _roadDistance + _parentDistance; // Add distance of parent to new distance }; } foreach _distanceArray; // Save new Road in Distance Array _distanceArray pushBack [_connRoad, _roadDistance, _road]; // Add connected road to Distance Array _workQueue pushBack [_roadDistance, _connRoad]; // Add connected road to queue }; } forEach _roadMap; if(count _workQueue > 0) then {_workQueue sort true;}; }; Finding the Path // Now Finding the Shortest Path to Destination _destinationPath = []; _destinationLength = 0; _startNode = _distanceArray select 0; // Get the Destination Node from Marker _destinationMarker = allMapMarkers select ((count allMapMarkers) -1); _nearestDestinationRoad = (getMarkerPos(_destinationMarker) nearRoads 10) select 0; _selectedNode = []; // Find DestinationRoad in Array { _nodeRoadx = _x select 0; if(_nodeRoadx == _nearestDestinationRoad) then { _selectedNode = _x; } } foreach _distanceArray; // Get the Distance to Destination _destinationLength = _selectedNode select 1; diag_log format ["StartNode: %1, SelectNode: %2, DestinationLength: %3", _startNode, _selectedNode, _destinationLength]; // Get the Path to Destination while{!(_selectedNode isEqualTo _startNode)} do { _nodeRoad = _selectedNode select 0; // Select the Road in the Node _destinationPath pushBack _nodeRoad; // Save the Road in the Path _nodeParent = _selectedNode select 2; // Node Parent to find // Find Node Parent in Distance Array { _nodeRoadx = _x select 0; if(_nodeRoadx == _nodeParent) then { _selectedNode = _x; } } foreach _distanceArray; }; _destinationPath pushBack (_startNode select 0); Create Local Markers // Create Local Markers to navigate to the path { _streetMarker = "VR_3DSelector_01_exit_F" createVehicleLocal getPos(_x); // _mapMarker = createMarkerLocal ["markername",[getPos(_x select 0) select 0,getPos(_x select 0) select 1]]; // _mapMarker setMarkerShapeLocal "ICON"; // _mapMarker setMarkerTypeLocal "DOT"; } foreach _destinationPath; Delete Markers on Passing // Delete Local Markers when passing them [] spawn { while{true} do { _nearestObjects = nearestObjects [player, [], 10]; { if(typeOf _x == "VR_3DSelector_01_exit_F") then { deleteVehicle _x; } } foreach _nearestObjects; sleep 0.1; } }
×