Jump to content

Search the Community

Showing results for tags 'sdk'.



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 2 results

  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)
  2. Инструмент для обрезания и склеивания карт Данный инструмент позволяет вырезать квадратные фрагменты из файлов карт клиента .map и .obj, а так же добавлять фрагменты уже к существующим картам, таким образом, объединять несколько карт в одну. С её помощью, например, можно вырезать отдельный остров или создать объединенную карту мира. В .map файлах содержится вся основная информация о картах игрового мира: 1) Области суши и воды; 2) ID текстур поверхности суши; 3) ID регионов из areaset.bin; 4) Рельеф местности, высоты; 5) Проходимые и непроходимые участки; 6) Боевые и безопасные зоны. В .obj файлах находится список всех неживых объектов, которые присутствуют на карте (здания, постройки, деревья, растения, камни и тому подобное). Сам по себе инструмент не является законченной программой – пользователь должен самостоятельно написать программу, которая создаст требуемую карту. В качестве языка программирования используется C++, а средой программирования выступает Visual Studio 2019 Community. Таким образом, для использования данного инструмента потребуются базовые знания языка C++. API Инструментарий представлен двумя классами, которые находятся в файле Map.h: 1) pkodev::MapFile – класс для работы с картами в формате .map; 2) pkodev::ObjFile – класс для работы с картами в формате .obj. Данные классы обладают одинаковым интерфейсом. Кроме того, в файле Map.h определена структура pkodev::point, которая описывает точку с координатами (x, y). Поскольку, в основном, требуется одновременное редактирование .map и .obj файлов, был определен класс pkodev::MapWrapper, который инкапсулирует внутри себя объекты pkodev::MapFile и pkodev::ObjFile, и обеспечивает их одновременное изменение. Обладает таким же интерфейсом, как и указанные классы. В процессе работы могут возникнуть ошибки. Для их обработки определены классы исключений pkodev::map_file_exception и pkodev::obj_file_exception, которые являются наследниками класса std::runtime_error. MapFile::MapFile(), ObjFile::ObjFile() Создать пустую карту с нулевым размером. MapFile(unsigned int width, unsigned int height), ObjFile:: ObjFile(unsigned int width, unsigned int height) Создать пустую карту с размерами width x height. void MapFile::load(const std::string& path), void ObjFile::load(const std::string& path) Загрузить карту из файла. Выбрасывают исключения pkodev::map_file_exception и pkodev::obj_file_exception соответственно. void MapFile::save(const std::string& path), void ObjFile:: save (const std::string& path) Сохранить карту в файл. Выбрасывают исключения pkodev::map_file_exception и pkodev::obj_file_exception соответственно. MapFile MapFile::cut(const point& start, const point& end), ObjFile ObjFile::cut(const point& start, const point& end) Вырезать квадратный фрагмент карты. start – начальные координаты (x0, y0), end – конечные (x1, y1). Выбрасывают исключения pkodev::map_file_exception и pkodev::obj_file_exception соответственно. void MapFile::glue(const point& pos, MapFile& map), void ObjFile::glue(const point& pos, ObjFile& map) Добавить на карту квадратный фрагмент. pos – координаты, по которым разместить фрагмент, map – добавляемый фрагмент карты. Выбрасывают исключения pkodev::map_file_exception и pkodev::obj_file_exception соответственно. void MapFile::del(const point& start, const point& end), void ObjFile::del(const point& start, const point& end) Удалить с карты квадратный фрагмент. start – начальные координаты (x0, y0), end – конечные (x1, y1). Фрагмент заменяется морем. Выбрасывают исключения pkodev::map_file_exception и pkodev::obj_file_exception соответственно. void MapFile::clear(), void ObjFile::clear() Удалить карту и освободить память. Класс pkodev::MapWrapper обладает аналогичным интерфейсом, но есть разница в методах load() и save(): путь до файла указывается без расширения. Примеры использования Вырезание фрагмента Напишем программу, которая вырежет "остров Удачи" из локации "Великий Синий океан". Соответственно, нам необходимо работать с файлами darkblue.map и darkblue.obj. Открываем Visual Studio 2019 Community, создаем консольное приложение C++ и подключаем файлы Map.h и Map.cpp, либо загружаем уже готовый проект из архива во вложении. Алгоритм программы будет следующий: 1) Открыть файлы darkblue.map и darkblue.obj; 2) Вырезать из них фрагмент с координатами x0 = 1430, y0 = 1675, x1 = 1780, y1 = 2025; 3) Сохранить фрагмент в файлы fortune.map и fortune.obj. Пишем код: #include <iostream> #include "Map.h" // Точка входа int main(int argc, char* argv[]) { try { // Создаем объект для одновременной работы с .map и .obj файлами pkodev::MapWrapper darkblue; // Загружаем карту из файла darkblue darkblue.load("C:\\pkodev\\Client\\map\\darkblue"); // Вырезаем остров удачи pkodev::MapWrapper fortune = darkblue.cut({ 1430, 1675 }, { 1780, 2025 }); // Сохраняем остров удачи 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 } В результате получим карту (скриншот из YAMMI): Склеивание карт Теперь попробуем склеить несколько карт в одну. Для примера создадим массив "островов Удачи", из острова, который мы получили в прошлом примере. Алгоритм программы будет следующий: 1) Создать пустую карту размером 1024 x 1024; 2) Загрузить "остров Удачи" из файлов fortune.map и fortune.obj; 3) Поместить "остров Удачи" по координатам (128, 32) на карту; 4) Поместить "остров Удачи" по координатам (512, 320) на карту; 5) Поместить "остров Удачи" по координатам (128, 576) на карту; 6) Сохранить карту в файл array.map и array.obj. Пишем код: #include <iostream> #include "Map.h" // Точка входа int main(int argc, char* argv[]) { try { // Создаем пустую карту 1024 x 1024 pkodev::MapWrapper map(1024, 1024); // Остров Удачи pkodev::MapWrapper fortune; // Загружаем остров Удачи из файла fortune.load("C:\\pkodev\\Client\\map\\fortune"); // Добавляем несколько островов Удачи на пустую карту map.glue({ 128, 32 }, fortune); map.glue({ 512, 320 }, fortune); map.glue({ 128, 576 }, fortune); // Сохраняем карту 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; } В результате получим карту (скриншот из YAMMI): Скачать инструмент (9 Кб)
×
×
  • Create New...