Jump to content

Search the Community

Showing results for tags 'glue'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Russian Section
    • Новости и объявления
    • Пиратия: Документация
    • Пиратия: Релизы
    • Пиратия: Разработка
    • Пиратия: Web
    • Пиратия: Помощь
    • Совместные проекты / набор команды
    • Доска объявлений
    • Программирование
    • Оффтопик
    • Корзина
  • English Section
    • News & Announcements
    • Guides
    • Releases
    • Development
    • Web
    • Questions & Help
    • Shared Projects / Team search
    • Paid services & Requests
    • Programming
    • Offtopic
    • Recycle bin
  • Portuguese Section
    • Dúvidas & Ajuda
  • Spanish Section
    • Preguntas y Ayuda
  • Servers
    • Russian servers
    • English servers

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Map glue and cut tool This tool allows you to cut square map sections from game client side .map and .obj files, as well as add fragments to existing maps, thus, combine several maps into one. With its help, for example, you can cut out a separate island or create a unified world map with three main continents and islands. The .map files contain all the basic information about the maps of the game world: 1) Areas of land and water; 2) ID of textures of the surface of the land; 3) IDs of regions from areaset.bin; 4) Terrain relief, heights; 5) Passable and impassable areas; 6) Combat and safe zones. The .obj files contain a list of all inanimate objects that are present on the map (buildings, structures, trees, plants, stones, etc.). The tool itself is not a complete program in the traditional sense, it is rather a set of programming codes, software development kit (SDK), that allows you to work with maps - the user have to independently write a program that will create the required map. The programming language is C++, and the programming environment is Visual Studio 2019 Community. Thus, basic knowledge of the C++ language is required to use this tool. API The toolkit is mainly represented by two classes, which are located in the Map.h file: 1) pkodev::MapFile – class for working with maps in the format .map; 2) pkodev::ObjFile – class for working with maps in the format .obj. These classes have the same interface (they have the same methods for working with maps) In addition, the pkodev::point structure is defined in the Map.h file, which describes a point with coordinates (x, y). Since, basically, you need to edit .map and .obj files at the same time, the pkodev::MapWrapper class was defined, which encapsulates the pkodev::MapFile and pkodev::ObjFile objects within itself, and ensures that they are modified at the same time. Has the same interface as these classes. In the process of working with maps, various errors may occur. To handle them, the pkodev::map_file_exception and pkodev::obj_file_exception classes are defined, which inherit from the std::runtime_error class. MapFile::MapFile(), ObjFile::ObjFile() Create an empty map with zero size. MapFile(unsigned int width, unsigned int height), ObjFile:: ObjFile(unsigned int width, unsigned int height) Create an empty map with dimensions width x height. void MapFile::load(const std::string& path), void ObjFile::load(const std::string& path) Load the map from a file. Throws pkodev::map_file_exception and pkodev::obj_file_exception, respectively. void MapFile::save(const std::string& path), void ObjFile:: save (const std::string& path) Save the map to a file. Throws pkodev::map_file_exception and pkodev: :obj_file_exception, respectively. MapFile MapFile::cut(const point& start, const point& end), ObjFile ObjFile::cut(const point& start, const point& end) Cut out a square section of the map. start - start coordinates (x0, y0), end - end coordinates (x1, y1). Throws pkodev::map_file_exception and pkodev::obj_file_exception, respectively. void MapFile::glue(const point& pos, MapFile& map), void ObjFile::glue(const point& pos, ObjFile& map) Add a square section to the map. pos - coordinates at which to place the section, map - the section to glue. Throws pkodev::map_file_exception and pkodev: :obj_file_exception, respectively. void MapFile::del(const point& start, const point& end), void ObjFile::del(const point& start, const point& end) Remove a square section from the map. start - start coordinates (x0, y0), end - end coordinates (x1, y1). The section is replaced by the sea. Throws pkodev::map_file_exception and pkodev: :obj_file_exception, respectively. void MapFile::clear(), void ObjFile::clear() Remove the map and free memory. Class pkodev::MapWrapper has a similar interface, but there is a difference in the load() and save() methods: the path to the file is specified without the extension. Examples of usage Cut a map section Let's write a program that will cut the "Isle of Fortune" out of the "Deep Blue" location. Accordingly, we need to work with the files darkblue.map and darkblue.obj. Open Visual Studio 2019 Community, create a C++ console application project and add Map.h and Map.cpp files to the project, or load a ready-made project from the attached .zip. The program algorithm will be as follows: 1) Open files darkblue.map and darkblue.obj; 2) Cut out a map section from them with coordinates x0 = 1430, y0 = 1675, x1 = 1780, y1 = 2025; 3) Save the section to the files fortune.map and fortune.obj. Write the code: #include <iostream> #include "Map.h" // Entry point int main(int argc, char* argv[]) { try { // Create an object for simultaneous work with .map and .obj files pkodev::MapWrapper darkblue; // Load a map from "darkblue.map", "darkblue.obj" files darkblue.load("C:\\pkodev\\Client\\map\\darkblue"); // Cut "Isle of Fortune" from the map pkodev::MapWrapper fortune = darkblue.cut({ 1430, 1675 }, { 1780, 2025 }); // Save "Isle of Fortune" to the "fortune.map", "fortune.obj" files fortune.save("C:\\pkodev\\Client\\map\\fortune"); } catch (const pkodev::map_file_exception& e) { std::cout << ".map file error: " << e.what() << std::endl; return 1; } catch (const pkodev::obj_file_exception& e) { std::cout << ".obj file error: " << e.what() << std::endl; return 2; } catch (...) { std::cout << "Unknown error!" << std::endl; return 3; } return 0 } As a result, we will get a map (screenshot from YAMMI): Glue several maps into the one map Now let's try to glue some maps into the one map. For example, let's create an array of "Isles of Fortune" from the island we got in the previous example. The program algorithm will be as follows: 1) Create an empty map with a size of 1024 x 1024; 2) Load "Isle of Fortune" from files fortune.map and fortune.obj; 3) Place the "Isle of Fortune" at coordinates (128, 32) on the map; 4) Place the "Isle of Fortune" at coordinates (512, 320) on the map; 5) Place the "Isle of Fortune" at coordinates (128, 576) on the map; 6) Save the map to array.map and array.obj files. Write the code: #include <iostream> #include "Map.h" // Entry point int main(int argc, char* argv[]) { try { // Create an empty map 1024 x 1024 pkodev::MapWrapper map(1024, 1024); // "Isle of Fortune" map pkodev::MapWrapper fortune; // Load the "Isle of Fortune" map from "fortune.map", "fortune.obj" files fortune.load("C:\\pkodev\\Client\\map\\fortune"); // Adding several "Isles of Fortune" to the empty map map.glue({ 128, 32 }, fortune); map.glue({ 512, 320 }, fortune); map.glue({ 128, 576 }, fortune); // Save the map map.save("C:\\pkodev\\Client\\map\\array"); } catch (const pkodev::map_file_exception& e) { std::cout << ".map file error: " << e.what() << std::endl; return 1; } catch (const pkodev::obj_file_exception& e) { std::cout << ".obj file error: " << e.what() << std::endl; return 2; } catch (...) { std::cout << "Unknown error!" << std::endl; return 3; } return 0; } As a result, we will get a map (screenshot from YAMMI): Download the tool (9 KB)
×
×
  • Create New...