Migrating to UG-MP


So, you're a server developer and you want to migrate your server to UG-MP. Surely, this will raise quite a lot of questions. This guide will try to answer them all and should cover everything you need to migrate your server over to UG-MP.

Table of contents

  1. Wait... Can't we just copy our SA-MP gamemodes and use these and call it a day?
  2. Dealing with the vast amount of content UG offers, and other things to note when migrating
    1. So, how often do the model IDs change? Do I, as a server developer need to worry about it?
    2. Support patches for SA-MP features - how we ensure migration really is as simple as we claim it to be
    3. Vehicle modifications
    4. The deal with GetVehicleModelInfo
    5. The absence of SA-MP vehicle colours - and how to get around this for the time being
    6. Weather types above 21 - and why they don't work why you might think they would
    7. The conclusion
  3. Installing the server package
    1. Supported version(s)
    2. Installation instructions


Wait... Can't we just copy our SA-MP gamemodes and use these and call it a day?

Of course you can. If you just want to host your gamemode without any changes, this is all you need to know. We have left San Andreas content (peds, vehicles, weapons, animations, and everything else) as-is to allow you to do just that. The thing with UG content though is that the IDs may change (and so do other attributes such as vehicle names) You can read more about this in the next chapter. As for SA-MP plugins, all of which should be working on UG-MP. If you find an issue with an existing SA-MP plugin on UG-MP (preferably one which is open source), please open up a new entry on our bug tracker.


Dealing with the vast amount of content UG offers, and other things to note when migrating

So, your server probably has a lot of these static tables. On UG-MP, this is considered as bad practice and we strongly recommend you to stop using them. We are able to generate an internal list which can be accessed by natives such as GetValidVehicleModelAt, GetNumVehicleModels and the like. You should check out the native documentation section to learn more about what natives are available for you to work with. We will keep these lists up-to-date with every new version of the mod, so using them should help you a lot.


So, how often do the model IDs change? Do I, as a server developer need to worry about it?

Not too often, we have little reason to. This is not the real reason why you want to use these natives. We do however add new vehicles pretty often, and if you for example have car dealerships, wouldn't you want to sell all sport cars UG offers? This is where our internal tables are most useful. The IDs for vehicles haven't really changed since the mod's inception in 2015, while ped/weapon IDs were both organized in Snapshot 3 (and in a few versions after that). Something to note though is that we do plan on organizing the ped, weapon, and vehicle data properly in the future (if still possible). This will no doubt be very drastic for server developers, but other than that, that's basicly it. With that said, you shouldn't worry about drastic and unexpected changes to UG content (something the SA-MP team has a bad track record of).


Support patches for SA-MP features - how we ensure migration really is as simple as we claim it to be

In order to allow you to continue using all SA-MP features without having to worry about compatibility issues (and to ensure migration really is as simple as just copy and pasting your gamemodes), we had to do a LOT of support patches. We've spent months on these patches, and how the patches work really depends on what is being patched, but the general goal is to ensure things continue working in the same manner as the SA-MP developers intended - without exceptions. There are plenty of fun examples of our support patches in action, and we will cover some of them in the chapters below:

Stores and restaurants
As you know, it is possible to visit certain stores and restaurants in SA-MP, such as Ammu-Nation stores by default. In UG-MP you can still do this, even for stores and restaurants added by GTA: UG. We did an entire video on this topic which you can check out here:

Vehicle model streaming - ensuring vehicle models are only spawned when they are actually needed
With callbacks such as OnVehicleStreamIn and OnVehicleStreamOut you can detect whether a vehicle gets streamed in or out. This is not what we are on about here - as there is a completely different layer of vehicle streaming solely for models. When you boot up your server, you will notice a message saying...

Number of vehicle models: ...

This message basicly tells you how many vehicle models are preloaded. This tiny feature really helps in improving performance. Only the most used models are preloaded, and thus we had to patch this code on both the client and server to allow it to work with a variable number of vehicles.

Weapon support patches
Weapon support patches, including patches needed to simply use UG weapons to begin with, parachute synchronization, proper lag compensation (or bullet synchronization, as we and the SA-MP team call it under the hood), was one of the biggest challenges we had to overcome in order to get UG-MP ready for a release. If you want to see all this in action, go check out these video's:

Consider the fact that SA-MP's weapon-related features such as lag compensation and the weapons themselves simply wouldn't work properly without these patches. How much of a bummer would it be if weapons didn't even work properly? That would suck, wouldn't it?


Vehicle modifications

On UG-MP, it is possible to visit any tuning garage, including UG-exclusive ones and install your desired vehicle modification(s). This is true for all vehicles, including lowriders and street racers. The server will still validate vehicle modification IDs by using internal lists that we are able to generate with the press of a button. We did however make two distinct changes related to vehicle modifications:

  • On SA-MP, it is possible to crash players by installing invalid vehicle modifications. On UG-MP, this is fixed, and instead, a message is displayed when an invalid vehicle modification is installed. This means that you don't need to do any validation inside OnPlayerMod. The same validation is also present in AddVehicleComponent.
  • UG-MP introduces new vehicle modification slots. These are:
    • CARMODTYPE_UGMP_FRONT_BUMPER
    • CARMODTYPE_UGMP_REAR_BUMPER
    • CARMODTYPE_FRONT_BULLBAR
    • CARMODTYPE_BACK_BULLBAR
    • CARMODTYPE_SIDESKIRT_LEFT
    • CARMODTYPE_SIDESKIRT_RIGHT
    • CARMODTYPE_MISC1
    • CARMODTYPE_MISC2
    • CARMODTYPE_MISC3
    As you can see, we added slots for the front and back bullbar, and new slots for the front and rear bumper. The stock SA-MP slots for the front and rear bumper continue to work as they do in SA-MP - meaning they will still contain either the front bumper or front bullbar. CARMODTYPE_UGMP_FRONT_BUMPER and CARMODMODTYPE_UGMP_FRONT_REAR_BUMPER however can be used when you explicitly want to get the current front or rear bumper modification ID, and will never contain the bullbar modification IDs. The rest of the modification IDs should be self-explanatory.


The deal with GetVehicleModelInfo

In UG-MP, it is certainly possible GetVehicleModelInfo. We were able to write code to automatically generate a new list of data for all UG vehicles which is used by GetVehicleModelInfo. Although the native returns the same data as it does in SA-MP, one minor difference is that the internal list used in SA-MP is done by hand, and contains a handful of mistakes. You shouldn't really be concerned with this too much - as there aren't that many mistakes in the original list, but we still felt this was worth a mention.


The absence of SA-MP vehicle colours - and how to get around this for the time being

As you know, SA-MP has its own set of vehicle colours starting at 128 up to 255. Unfortunately, we were unable to include them in the initial version of UG-MP. This is because in order to include them, we would have to move our own vehicle colours so they start at ID 256. We use fastman92's limit adjuster (FLA) to allow us to use vehicle colours above 128, however back when we were still working on the client we found that the game still uses 8 bit integers to store vehicle colours. This meant that it would not be possible to use colour IDs above 256. With the release of FLA 5.1 in 2020, this was fixed. However, by that time we were finishing up the client, and by then we had long decided to not include support for SA-MP vehicle colours in the initial UG-MP release. Fortunately for you, you can still use the SA-MP vehicle colours by using the RGB values which can be found in a table on the SA-MP wiki, so we recommend doing this as a workaround for the time being.


Weather types above 21 - and why they don't work why you might think they would

As you may have heard, using weather types above 21 will not produce the result you might expect it to. You can read more about this by visiting our documentation section for weather types.


The conclusion

So, in conclusion you can indeed copy paste your gamemode into your UG-MP installation and call it a day. However, it is a little more complicated than just that. If you still have further questions, you can assume that if something is not covered on this article, it should function like it does in stock SA-MP. If that assumption does not answer it, you can always ask us in our official Discord channel. Now that we covered everything that you would want to know as a server developer, we will be covering the installation instructions for the UG-MP server package.


Installing the server package
Supported version(s)

UG-MP's server package can be installed on both Linux and Windows - and requires SA-MP 0.3.7 R2.1 to work. This is indeed unusual (and not a mistake) - as the client itself only works on SA-MP 0.3.7. This may be rectified in the near future to avoid confusion (if possible). Another thing to note is that the Linux server is linked against glibc 2.27, and that the Windows version is compiled using /MT, just like the client.


Installation instructions

Installing the UG-MP server package is as simple as extracting the contents of the package in your server root directory.