{"id":17224305,"url":"https://github.com/tederis/mtasa-detour","last_synced_at":"2025-04-14T00:36:37.923Z","repository":{"id":200742840,"uuid":"706158214","full_name":"tederis/mtasa-detour","owner":"tederis","description":"The server extension for MTA:SA that adds a navigation mesh","archived":false,"fork":false,"pushed_at":"2023-10-28T13:39:00.000Z","size":1225,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:52:03.654Z","etag":null,"topics":["lua","mtasa","navigation","server"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tederis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-17T12:16:15.000Z","updated_at":"2025-01-05T14:18:44.000Z","dependencies_parsed_at":"2023-10-21T16:37:26.756Z","dependency_job_id":"a6b73521-eb97-44c4-accf-a9594e927438","html_url":"https://github.com/tederis/mtasa-detour","commit_stats":null,"previous_names":["tederis/mtasa-detour"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tederis%2Fmtasa-detour","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tederis%2Fmtasa-detour/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tederis%2Fmtasa-detour/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tederis%2Fmtasa-detour/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tederis","download_url":"https://codeload.github.com/tederis/mtasa-detour/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248803162,"owners_count":21163999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","mtasa","navigation","server"],"created_at":"2024-10-15T04:10:45.248Z","updated_at":"2025-04-14T00:36:37.901Z","avatar_url":"https://github.com/tederis.png","language":"C++","funding_links":[],"categories":["Other"],"sub_categories":[],"readme":"# mtasa-detour\nThe server extension for MTA:SA that adds navigation mesh tools.\n![social_mini](https://github.com/tederis/mtasa-detour/assets/12121551/0e0ab1af-3a07-4456-8934-4ab82acbc54f)\n\nStatus\n======\n\nWork in progress.\n\nBuild instructions\n======\n\n* Clone the repository.\n* Download premake5 executable and put it in the project's root folder.\n* Generate a project using the premake5 executable.\n* Build a project\n\nThere are two APIs that can be exported: Lua and native C. Lua is used by default. To generate native API functions you need to execute premake5 with the following arguments: \n```\npremake5 --navapi=native\n```\n\nInstallation\n======\n\n**NOTE:** The module is memory intensive and server must have at least 600 MB of free process memory. This limitation will be omitted later.\n\nCopy(unzip) the contents of navmesh.zip into the server\\navmesh\\ directory. This directory must contain three files: cols.col, defs.xml and nodes.xml.\n\nWindows\n-\n32 bit: Copy 32 bit navigation.dll into the server\\mods\\deathmatch\\modules\\ directory.\n\n64 bit: Copy 64 bit navigation_64.dll into the server\\x64\\modules\\ directory.\n\nThen, add the following line in *mtaserver.conf*:\n```xml\n  \u003cmodule src=\"navigation.dll\" /\u003e\n```\n\nLinux\n-\n32 bit: Copy 32 bit libnavigation.so into the server\\mods\\deathmatch\\modules\\ directory.\n\n64 bit: Copy 64 bit libnavigation_64.so into the server\\x64\\modules\\ directory.\n\nThen, add the following line in *mtaserver.conf*:\n```xml\n  \u003cmodule src=\"libnavigation.so\" /\u003e\n```\n\nDescription\n======\n\nThis project aims at cover the wide spectrum of applications. Its kernel is the navigation mesh tools that allow to effectively find a path between world space points and query auxiliary data on a pregenerated data set.\n\nIt consists of two parts: *game assets aggregator* and *server module*. Сonsider them in more detail.\n\nGame assets aggregator is responsible for loading game assets, their processing and creating compact files contain all data necessary for the navigation mesh generating. It is placed in a separate tool called **builder**. Before a server is available to generate a navigation mesh this tool should be used to build a game data. For generating a game data run builder.exe with the following arguments:\n```\nbuilder -g GTASA_DIRECTORY -o SERVER_DIRECTORY\n```\n\n**NOTE:** You do not have to build the data yourself. The pregenerated data is available in the Releases section(see navmesh.zip).\n\nServer module is responsible for the actual navigation mesh processing, including the navigation mesh building. Immediately after the launch of server navigation mesh is unloaded. To use it you have to build it (see *navBuild* function) or load from a file(see *navLoad* function). Once that is done all navigation mesh functions become available. \n\nVideos\n======\n[https://youtu.be/8QdN8mQOP5w?si=TV2siFsuudmuf7r2](https://youtu.be/8QdN8mQOP5w?si=R34wqrx0_34XwEYp)\n\n[https://youtu.be/40tvi-jHtNY?si=9wB57lJb-6nrqrma](https://youtu.be/40tvi-jHtNY?si=9wB57lJb-6nrqrma)\n\nLua functions\n======\n```lua\nbool navState()\n```\nThis function is used to return the current state of the navigation mesh. Returns *true* if the navmesh is loaded, *false* otherwise.\n\n```lua\nbool navLoad(string filename)\n```\nThis function is used to load(reload) the navigation mesh from a previously generated file. Returns *true* if the navmesh is successfully loaded(reloaded), *false* otherwise.\n\n```lua\nbool navSave(string filename)\n```\nThis function is used to save the navigation mesh to a file. Returns *true* if the navmesh is successfully saved, *false* otherwise.\n\n```lua\nbool navBuild()\n```\nThis function is used to build the navigation mesh. The function is not saving a navigation mesh into a file, you can use *navSave* for this. Returns *true* if the navmesh is successfully built, *false* otherwise. Note that this function is CPU extensive and the building process can freeze your server for a while. In the next version the building process will be asynchronous.\n\n```lua\ntable navFindPath(float startX, float startY, float startZ, float endX, float endY, float endZ)\n```\nThis function is used to find a path between world space points. Returns table of points if the path was successfully found, *false* otherwise.\n\n```lua\nfloat, float, float navNearestPoint(float x, float y, float z)\n```\nThis function is used to find the nearest point on the navigation mesh to a given point. Returns position if the point was successfully found, *false* otherwise.\n\n```lua\nbool navDump(string filename)\n```\nThis function is used to dump the entire navigation mesh into a Wavefront *.obj* file. Can be used for the debug purposes. Returns *true* if the dump was successfully created, *false* otherwise.\n\n```lua\ntable navCollisionMesh(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, float bias)\n```\nThis function is used to dump collision vertices that are found in the region into a table. Can be used for the debug purposes. Returns a table of vertices if the dump was successfully created, *false* otherwise.\n\n```lua\ntable navNavigationMesh(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, float bias)\n```\nThis function is used to dump navigation mesh vertices that are found in the region into a table. Can be used for the debug purposes. Returns a table of vertices if the dump was successfully created, *false* otherwise.\n\n```lua\ntable navScanWorld(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)\n```\nThis function is used to find objects in the specified region. Returns a table of model IDs in the following format: { { model }, { model }, ... }.\n\nC functions\n======\n```C\nbool navInit()\n```\nThis function is used initialize the navigation system. Returns *true* if the navmesh is initialized, *false* otherwise.\n\n```C\nbool navShutdown()\n```\nThis function is used destroy the navigation system. Returns *true* if the navmesh is destroyed, *false* otherwise.\n\n```C\nbool navState()\n```\nThis function is used to return the current state of the navigation mesh. Returns *true* if the navmesh is loaded, *false* otherwise.\n\n```C\nbool navLoad(const char* filename)\n```\nThis function is used to load(reload) the navigation mesh from a previously generated file. Returns *true* if the navmesh is successfully loaded(reloaded), *false* otherwise.\n\n```C\nbool navSave(const char* filename)\n```\nThis function is used to save the navigation mesh to a file. Returns *true* if the navmesh is successfully saved, *false* otherwise.\n\n```C\nbool navBuild()\n```\nThis function is used to build the navigation mesh. The function is not saving a navigation mesh into a file, you can use *navSave* for this. Returns *true* if the navmesh is successfully built, *false* otherwise. Note that this function is CPU extensive and the building process can freeze your server for a while. In the next version the building process will be asynchronous.\n\n```C\nbool navFindPath(float* startPos, float* endPos, uint32_t* outPointsNum, float* outPoints)\n```\nThis function is used to find a path between world space points. If *outPoints* is *NULL*, then the number of points is returned in *outPointsNum*. Otherwise, *outPointsNum* must point to a variable set by the user to the number of points in the *outPoints* array, and on return the variable is overwritten with the number of points actually written to *outPoints*. Returns *true* if the path was successfully found, *false* otherwise.\n\n```C\nbool navNearestPoint(float* pos, float* outPoint)\n```\nThis function is used to find the nearest point on the navigation mesh to a given point. *outPoint* must point to a preallocated array of three float32 numbers. Returns *true* if the point was successfully found, *false* otherwise.\n\n```C\nbool navDump(const char* filename)\n```\nThis function is used to dump the entire navigation mesh into a Wavefront *.obj* file. Can be used for the debug purposes. Returns *true* if the dump was successfully created, *false* otherwise.\n\n```C\nbool navCollisionMesh(float* boundsMin, float* boundsMax, float bias, uint32_t* outVerticesNum, float* outVertices)\n```\nThis function is used to dump collision vertices that are found in the region. Can be used for the debug purposes. If *outVertices* is *NULL*, then the number of vertices is returned in *outVerticesNum*. Otherwise, *outVerticesNum* must point to a variable set by the user to the number of vertices in the *outVertices* array, and on return the variable is overwritten with the number of vertices actually written to *outVertices*. Returns *true* if the dump was successfully created, *false* otherwise.\n\n```C\nbool navNavigationMesh(float* boundsMin, float* boundsMax, float bias, uint32_t* outVerticesNum, float* outVertices)\n```\nThis function is used to dump navigation mesh vertices that are found in the region. Can be used for the debug purposes. If *outVertices* is *NULL*, then the number of vertices is returned in *outVerticesNum*. Otherwise, *outVerticesNum* must point to a variable set by the user to the number of vertices in the *outVertices* array, and on return the variable is overwritten with the number of vertices actually written to *outVertices*. Returns *true* if the dump was successfully created, *false* otherwise.\n\n```C\nbool navScanWorld(float* boundsMin, float* boundsMax, uint32_t* outModelsNum, uint32_t* outModels)\n```\nThis function is used to find object models in the specified region. If *outModels* is *NULL*, then the number of models is returned in *outModelsNum*. Otherwise, *outModelsNum* must point to a variable set by the user to the number of models in the *outModels* array, and on return the variable is overwritten with the number of models actually written to *outModels*. Returns *true* if the dump was successfully created, *false* otherwise.\n\nLicense\n======\nThis repository is licensed under the GNU General Public License v3.0. Please review the license before using or contributing to this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftederis%2Fmtasa-detour","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftederis%2Fmtasa-detour","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftederis%2Fmtasa-detour/lists"}