Convert huge amount of MTA/SA-MP objects into another type

Veröffentlicht von Knogle am

Right now i finished the first version of my small and tiny offline object converter for SA:MP/MTA:SA, because our favourite map converter convertffs.com is dead.

The purpose of this program and tutorial is to create a simple object converter for myself but now i want to share it, maybe its useful for someone

Another reason is the huge amount of objects i want to convert and the conversion by using online converters takes a huge amount of time due to the upload/download speed of the client.Its meant to be a commandline tool because i love simple stuff and i love SSH/CMD so why not?

Most online converters were not able to convert more than 5000 objects because they stop working or you get some connection timeout because of the slow upload.

So i decided to create a small C based converter by using fscanf and sscanf to parse the values out of the input and convert it into the desired output.

My tool is available for Linux and Windows at the moment, a Mac OSX version is not planned.
Note! This program is in Beta state so it may contain bugs, please report them if you encounter any malfunction.

You can report bugs via E-Mail: webmaster@knogleinsi.de or by replying in this topic.

I did not pay attention of efficieny because even with 100.000 objects in worst case, meaning MTA:SA to SA:MP the average time for a conversion is around 1.6 seconds.
The execution time of this program is O(3n) in best case and O(6n) in the worst case (MTA:SA (XML) to SA:MP CreateObject)

The goal is to support features like the conversion of Vehicles,Peds/Actors, Pickups and more, like the MapConverter Plugin you can find in here.

I also want to cover more types of objects.

And the most important reason: I dont want to spent all my time, uploading and converting it somewhere.

Usage of this tool is quite simple.

Let’s check the readme..

 

 Copyright (C) 2017 Fabian Druschke (Knogle)
    ​
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    ​
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    ​
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/
    ​
    ​
    ​
    ​
    Compiler settings:
    ​
    Linux: gcc simpleconverter.c
    Windows MinGW: gcc simpleconverter.c
    ​
    ​
    Usage:
    ​
    Linux: ./a.out foo.map
    ​
    Windows: a foo.map
    ​
    Output file output.txt will be written into the same directory.

Running it..

Filename is converter.exe and the parameter the input filename.

(You can also use a batch file to execute it)

converter.exe objects.map

Now you choose the input objecttype and the desired output.
Now the conversion is done! Simple, isnt it?

Done!

 

Now you are ready to use this tool.

 

I did not use any XML Parser because for this simple use, because it would be way to difficult in to implement it in C!

Input sample, MTA SA 1.0 map:

<object id="object (des_ebrigroad07) (1)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1135.2" posY="-866.29999" posZ="62.5" rotX="0" rotY="0" rotZ="314"></object>
        <object id="object (des_ebrigroad07) (2)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1135.3" posY="-866.20001" posZ="72.7" rotX="0" rotY="0" rotZ="313.995"></object>
        <object id="object (des_ebrigroad07) (3)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1140.6" posY="-871.40002" posZ="66.1" rotX="90" rotY="0" rotZ="313.995"></object>

​

 

And our PAWN SA-MP output.

 

CreateObject(16358,-1135.199951,-866.299988,62.500000,0.000000,0.000000,314.000000);// (des_ebrigroad07)
    CreateObject(16358,-1135.300049,-866.200012,72.699997,0.000000,0.000000,313.994995);// (des_ebrigroad07)
    CreateObject(16358,-1140.599976,-871.400024,66.099998,90.000000,0.000000,313.994995);// (des_ebrigroad07)

 

 

I hope its useful for someone, like written in the license I will publish updates weekly in this topic and refresh the github repository.

Download:

https://github.com/Knogle/SimpleConverter

Source only:

http://pastebin.com/LAMxv5hi

 

Kategorien: Software

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.