Varto
Хочете будувати кар’єру в Data Science та AI? Vodafone Big Data Lab відкриває новий набір —>

Real physics of an FPV drone in GTA San Andreas: how a Ukrainian developer created a full-fledged simulator inside the legendary game

Backend Developer Artur Shcherban has created a full-fledged FPV simulator right inside the legendary GTA San Andreas. His script for MoonLoader adds a quadcopter to the game with realistic flight physics, support for any controllers (from professional RC equipment to DualSense), and the ability to fly both in single player and on SA-MP servers.

Leave a comment
Real physics of an FPV drone in GTA San Andreas: how a Ukrainian developer created a full-fledged simulator inside the legendary game

Backend Developer Artur Shcherban has created a full-fledged FPV simulator right inside the legendary GTA San Andreas. His script for MoonLoader adds a quadcopter to the game with realistic flight physics, support for any controllers (from professional RC equipment to DualSense), and the ability to fly both in single player and on SA-MP servers.

The idea to combine two passions arose spontaneously during a break from his main job. The developer had solid gaming and development experience in GTA, which suddenly intersected with a new hobby.

"I think it's vital for all developers, sometimes their hands itch to code something for the soul. And so, my friend is interested in FPV drones, and I seem to have caught on - I bought a remote control, flew 50 hours in Liftoff. Plus, I have about 10 years of SAMP behind me: admins, client scripts, and even an anti-cheat for the project. And then one evening it all came together into one interesting puzzle," recalls Artur in his post on LinkedIn.

The script is created for the MoonLoader platform. It does not use the standard GTA transport physics, but calculates its own flight model: thrust, gravity, anisotropic air resistance, engine speed delay and ground effect. This allows you to do full flips and fly inverted.

The mod supports three classic modes (ACRO, LEVEL, HORIZON), contains 4 types of OSD interface, a built-in replay recording and playback system (with the ability to rewind), as well as a flexible settings menu for calibrating any remote or gamepad and sharing drone profiles.

However, the path to implementing the flying camera turned out to be difficult: “The physics came easily, the drone flew in a couple of hours. But the camera… The drone tilts, the picture is flat. I spent a long time pushing corners into the camera matrix in all possible ways, crashed the game ten times with my experiments, and then it dawned on me: my hook is called AFTER the frame is rendered. It updated the picture that is already on the screen. Great. As a result, the crutch from the bearded forum worked: you teleport the player to the object and turn on the regular camera “in transport”, because for the driver, the drone is just another machine. The only working option turned out to be the one that does not touch the camera at all.”

In addition to camera rendering, the game engine also had other surprises related to the internal mechanics of object positioning.

"I'll tell you about another bug that also got on my nerves. Near the roofs, the drone jerks down sharply. I think the collisions are buggy, I went through all the flags - it doesn't work. And this native function of setting coordinates "in the rat" landed the drone on the nearest roof, 60 times a second, so that it "doesn't fall under the texture". I deleted one call - and the bug that I had been racking my brains over for a couple of evenings disappeared. Base."

The result is a full-fledged and flexible FPV simulator inside GTA SA. The player can spawn a quadcopter, freeze their character in place, and take off.

"Now there is ACRO / LEVEL / HORIZON like on a real quadcopter, flight replays, a couple of OSD styles, flies from any controller, from hardware to Dualsense. Both in single and on SAMP servers. My favorite is flying under a bridge with three stars, while the cops below are running, bustling, throwing spikes and can't get to me."

The project can be found on GitHub .

Ukrainians created a combat FPV drone simulator that was purchased 10,000 times on Steam. Now the team is creating a new product for training drone operators
Ukrainians created a combat FPV drone simulator that was purchased 10,000 times on Steam. The team is now creating a new product for training drone operators
On the topic
Ukrainians created a combat FPV drone simulator that was purchased 10,000 times on Steam. The team is now creating a new product for training drone operators
Ukrainian developer creates construction simulator in the style of medieval illustrations
Ukrainian developer creates construction simulator in the style of medieval illustrations
On the topic
Ukrainian developer creates construction simulator in the style of medieval illustrations
Read the country's main IT news in our Telegram
Read the country's main IT news in our Telegram
On the topic
Read the country's main IT news in our Telegram

Have important news to share? Message our Telegram bot

Key events and useful links in our Telegram channel

Discussion
No comments yet.