-
Posts
14 -
Joined
-
Last visited
StiviK's Achievements
Square (6/54)
21
Reputation
-
I mean the modules find's the neighbour node of a node by looking at the edges of a node. The edges of a node are defined in the graph, the defined edges are only realistic reachable nodes. Which means if the Input graph (sa_nodes) is correct, what you described should not happen.
-
The return value of the function is a table with this structure: { { x1, y1, z1 }, { x2, y2, z2 }, ..., { xN, yN, zN } } (where N is the count of the used nodes in the Route) @Jayceon are you trying to use the functions server-side or client-side?
-
You should see a message like 'MODULE: Loaded "Pathfind Module" (1.00) by "Jusonex, StiviK"' in the console, otherwise it was not loaded! Did you add it to your mtaserver.conf! Or try 'loadmodule ml_pathfind_TYPE.dll' in the console.
-
An example script directly not, but here is it how i use it in my Gamemode: function GPS:constructor() -- Check if module is loaded if not loadPathGraph then outputDebugString("GPS module not loaded. Continuing without...", 2) return end -- Load path graph self.m_GraphId = loadPathGraph("files/paths/sa_nodes.json") end function GPS:destructor() if unloadPathGraph then unloadPathGraph() end end function GPS:getRoute(callback, from, to) if not findShortestPathBetween then return false end return findShortestPathBetween(self.m_GraphId, from.x, from.y, from.z, to.x, to.y, to.z, callback) end
-
The grapsh needs to be a json file (like this https://raw.githubusercontent.com/eXo-MTA/ml_pathfind/v1.0.2/test/sa_nodes.json), i hope you unterstand the structure. By the way, Windows 64bit builds are now available: https://github.com/eXo-MTA/ml_pathfind/releases/tag/v1.0.2
-
Hello, We, the eXo-Reallife team, would like to release a module that is also used on our server. It is a pathfinding module developed by Jusonex and StiviK. The module uses the A * algorithm. (https://en.wikipedia.org/wiki/A*_search_algorithm) We use this for our GPS: Why did we develop a module for this and did not simply write a script? This has a very simple reason. The module calculates the routes in your own threads, which has the advantage that it is much faster than a script, and secondly, you can calculate how much routes as you want side by side. This will not cause any lags etc.! What are the features of the module? The module can load several graphs / nodes side by side The module calculates the routes in its own threads Very useful API functions (such as findNodeAt or getNodeNeighbors) What are the main features? int loadPathGraph (String pathToGraphFile) This function loads the graph from the given file and returns a GraphId which you need for all other functions. If something does not work, false is returned. bool findShortestPathBetween (int graphId, float startX, float startY, float startZ, float endX, float endY, float endZ, function callback) This function finds the shortest route between the points. (Unfortunately, no vectors can be handed over!) The callback function is called when the calculation is finished. As an argument, either a table is returned that contains all nodes, or false if no route is found. bool unloadPathGraph (int graphId) You can use this function if you no longer need and want to unload the graph, it returns true if everything is fine, false if an error has occurred. You will find all the other functions that are included in our documentation. Why is the eXo team releasing all this? Well, that has the simple reason, we want to share our work with others and not just keep it for us! We hope we can enrich you with it and vlt. Even help! Where can I download the module? The whole module is open-source and can be viewed in our GitHub organization. It's released under the MIT License. GitHub organization: https://github.com/eXo-MTA Repository: https://github.com/eXo-MTA/ml_pathfind Download the module (Windows / Linux): https://github.com/eXo-MTA/ml_pathfind/releases Nodes of all roads in SA: https://github.com/eXo-MTA/ml_pathfind/blob/master/test/sa_nodes.json If you find any mistakes or suggestions, you can simply create a new issue and we will look into it. So now that's it, have fun with the module! - StiviK and the eXo-Reallife team (Original thread in German: https://www.mta-sa.org/thread/36365-release-mta-sa-pathfinding-module/?postID=407938#post407938)
- 30 replies
-
- 19
-
"I didn't know NVidia GeForce GT 630M also had 4 GB, I have 1 GB D:" I also didn't know it ^^ I have 2GB but MTA shows 4GB - StiviK
-
Hello, I create a class which can create moveable dxElements. It is very easy to use. If you don't know what i mean, just watch one of the Videos -- create dxMoveableElement dxMoveable:createMoveable(int w, int h, bool withAlpha) --destroy dxMoveableElement:destroyElement() -- how to draw the moveable myMoveable = dxMoveable:createMoveable(259, 254, true) dxSetRenderTarget(myMoveable.renderTarget, true) dxDrawRectangle(0, 0, 259, 254) dxSetRenderTarget() myMoveable.posX, myMoveable.posY = 100, 500 -- default (0, 0) addEventHandler("onClientRender", root, function () dxDrawImage(myMoveable.posX, myMoveable.posY, myMoveable.w, myMoveable.h, myMoveable.renderTarget) end) To move the Elements just press F2. Old Video: New Video: Download: https://community.multitheftauto.com/index.php?p= ... s&id=10330 - StiviK