Back to Main Page

This is a short page about a small collection of mods and windows apps made recently.


Creating a Racetrack Overlay with the help of LCA

The recent Nordschleife addon map briefly spiked my interest in GTA V again, briefly being the most appropriate word. A suggestion was made about having an overlay that showed where you were on the track. There's a couple of things this requires but on the whole, it's a fairly straight-forward process.

1) Get an image of the track.

2) Get the player's position in the world.

3) Draw a marker on the image that represents the player.

The most important part of this process is getting an accurate image that matches the game data and synchronising the positions between game and image. LCA records quite a lot of information, some of which is interpolated position data. That means if I drive a route, I have an accurate path that represents that route. I already had an app that could turn some of the LCA data into a telemetry style output, so I decided to add another feature that would turn the data into a track layout image.

The image is self-calibrated by the app, by scanning for the extremeties and creating an origin from that data. By making the overlay mod use the same process, the player's position is guaranteed to be in sync with the overlay image.

So the first task is to drive a lap of the track and that creates the replay data the app uses. Loading that data into the app, generates an initial 1:1 image at full scale. Whilst that's nice, it doesn't fit on your screen very well and it's also far too big memory wise. So I added a scale option on each window, so you can rescale the image to the best size. Once you have chosen the size, you can save the image as either a PNG or JPG.

Once I have the image, I load that into Photoshop and apply a saved action to add an outline and drop-shadow to it, just to make it a bit more visible on the screen.

The next task is to create a config file for the overlay mod, so for that I use another app, the overlay manager. The app is fully drag&drop capable and can detect two types of dropped data, the replay data and the overlay image. Dropped images are displayed on the screen, just so you know you have the right one.

Update 29-03-2019: The app can now detect all 3 types of data being dropped onto it, replay data, overlay image and configuration file.

This is an actual-size image, it only has a small UI.

You can see the data loaded, the image displayed and the Name set. You can choose the overlay to be displayed on the Left or Right here but the mod lets you toggle that with a button press now anyway, I added that before packing everything up again. The config data is serialised into XML, which makes for easier management in the mod. I don't like XML, it's a bloated, wasteful data-storage format but it made this a bit easier.

So by this time, we have the image, we have the data and we have the config. All we have to do now, is run the mod and switch on the overlay. The longest part of the process, is driving the original lap. It helps if you drive in a slower, more stable vehicle. My original Nordschleife map was one of the replay files from the videos I uploaded, so they're biased towards the racing line. I need to drive a centre-line lap but that's going to need about 12 - 15 minutes of careful driving.

The whole process, from start to finish on the Monaco addon map, can be seen in this video. It's only 6 minutes long, so you can tell it's not a long process at all. But what you end up with, is a system that you can just plug overlays into and they will always be accurate to the player's position. It makes it feel a bit more like a racing game and a lot less like GTA V.

That's pretty much it really.