Back to Main Page

In Development.

I will use this page to log the development of another mod to pass some time with. This is going to be a mod that lets you view what every CCTV camera in the game world sees.

It should be interesting to watch the world go by from the comfort of your CCTV operator's chair... hopefully.


CCTV Watcher - Your eye on the GTA V World

A long time ago, I had a crazy idea, let's collect the location of every CCTV camera in the map... so I did. Props only appear in the map when you are within a certain distance, so how was I going to cover all that map, to find all those locations?

I did it with what I called my Scanning Drone, which wasn't a drone at all, it was the player and a camera suspended a fixed number of units above the map looking downwards... but it worked.

Starting in the lower left corner of the map, it advanced across the map 50 units at a time. When it reached the right hand edge, it moved up 50 units and scanned across the map again. The GTA V map is approximately 8200x11400 units, which equates to 164x228 (37392) scanning positions and at 30fps, that's around 20 minutes. As I am sure you can imagine, forcing the game to load map data that fast is also incredibly unstable and there were numerous crashes along the way.

But in the end, I had a list of 697 camera locations, the model hash and the street name in a file. As with my World Guide Locations, I imported them into my tracker programme to get this image showing all 697 locations. Each colour is a different type of camera. (Big image, opens in a new Tab) - Update: New image shows 1614 current locations.

So I am sat here today, annoyed at ignorant people who can take the time to ask questions but giving some thanks in return is too much trouble, and thought... let's make this CCTV Watcher mod.

So this is the start of that mod.

First order of the day was to strip the location text file down to bare essentials, so that was no problem. I made a slight alteration to my quadrant search system for this mod, to work with a CCTV Struct instead of a WorldLocation Struct, although that might become a CCTV class, depending on how I decide to control the camera system. It's easy to switch types, so it's not a problem right now.

First video of the search system in place for the camera locations. Just thinking, it would be cool if this was something accessible through the phone, like one of those Internet Webcam searchers.

Update: Seems my celebration was premature. I have just discovered that my scanning system didn't collect any cameras from interiors. The bank I walked around in this video had 4 inside, which means other banks probably have them inside as well, plus possibly clothes shops and supermarkets. Guess it's a good job I have a mod that lets me find those kinds of things. :D WGS to the rescue! I just have to make a unique key from the ones I already have, so I can identify the new ones... a pain though, that's for sure.


I am thinking of storing the cameras by zone, a bit like it is done in Sleeping Dogs. In that you could access collections of cameras in different zones of the map. The difference is, GTA V has a lot more zones and a lot more cameras. Plus it has a lot more types of cameras, there are single-fixed, double-fixed, wall-mount, ceiling-mount, pole-mount etc... plus there are dome cameras as well. For each camera I will need to work out the centre of the lens position and the angle the camera is pointing in, so that I can get the correct view for each one. The dome cameras will be PTZ (Pan, Tilt, Zoom) cameras, so you will be able to control and change their views.

I think there's a CCTV scaleform, there's definitely a CCTV timecycle modifier, so I can get a visual appearance that looks interesting. The key factor will be the interface and how that lets you choose between the cameras etc...

Mon 4th June 2018: Today's progress... if you can call it that. Seeing as my scanning mod didn't work as well I thought it had, there was only one other alternative, scan for them at ground level from a car. So it's now 3:32am when I am writing this and I started doing that around 8pm last night. Just to make things even more fun, my windows tracker app had a bug that was stopping the trail from showing up and my Tracker mod was crashing at a certain location in the map. Both of which turned out to be stupid mistakes, the kind I make a lot and that cost me so much time. The tracker mod was crashing because of this zone name "Chiliad Mountain State Wilderness". I was using the wrong name to set the maximum length of 32 characters and that name is 33 characters. So a single character extra caused a crash, small things, big problems.

But at the end of many hours scanning, I found that I was missing a few locations./understatement At the current count, I was missing 260 to be precise, as I now have 957 CCTV camera locations. Still, it was a sunny day in Los Santos, so the car-oof was off, the radio was on and I got to see every street in the map... again. It's currently a 74KB data file but when I compress it, it will probably be closer to 30KB, which is fine. My WGS locations are 56KB and there are close to 1900 of them.

So I have the lens offsets to calculate for 4 cameras and then I can start testing camera positions. I can honestly say, I have no idea how to handle this many cameras in a UI. When I have collected them all, I might see if I can split them into interior and exterior cameras... not sure yet.

Update: Luckily, I decided to test the positions I got from ZM3 before doing the final cameras and it's a good job I did. The values I got from ZM3 were wrong. Anyway, I can now get the lens position and cast a line of sight ray from that position that matches the camera angle. This was an important step because this confirms the rotations are correct, which means when I place a camera at that location, it will show the correct view.

The dome cameras will use a slightly different system, as the camera needs to be placed at an offset based on the radius of the dome, so the line of sight indicator doesn't work with these yet.


While I am testing, I am probably going to add a control where you can simply switch to the nearest camera, just to confirm things are actually working. That might be my next step tonight... I also have to work out how to handle cameras that are a pair in a single prop, hopefully the values might be friendly enough that I can just negate some values to allow it to switch to the other camera, we shall see. But overall, happy with progress so far.

Tue 5th June 2018: Well last night was stress filled with these damned cameras. PTZ cameras proved to be a pain and I have had to resort to an unpleasant trick to get them working for now but at least they work. So out of the 18 camera props, I have just 2 left to deal with and those are the camera pairs. There's a domed pair and a fixed security pair, that's today's task. Once that's done, I can then consider how best to let you access them all.

As you can see from this video, at the moment, a small indicator appears where the camera is and you press Gamepad A to switch to that camera. Which is fine as long as the cameras are at ground level, so that needs more work. Anyway, just a short video showing the different cameras and how they work. Luckily this one place had all three cameras in close proximity to each other.


The biggest problem I have at the moment, is setting the initial direction of the dome cameras. That is set on a prop level and for most props, they have a specific direction, so the view is predictable. With the ceiling mounted domes, they have no direction, so they all get placed facing the same way. That means in the left corner of a room, the view might be towards the centre of the room but in the right corner, the view is towards the wall. The only solution I can think of right now, is to store the view rotation on a per-camera basis... or see if raycasting will identify the best angle. That's probably tonight's task.

Update: Paired cameras are now fully-functional, each with their own independent rotation (for PTZ cameras) and zoom level. So you can get a pair of PTZ cameras, set them to two rotations and zooms and those remain set until you exit the cameras. You press one button to activate a camera and then for paired cameras, that same button toggles between the two, so that works nicely. So after just a couple of days, this is at a great stage with all the main camera functionality in place. PTZ cameras will show with a clear screen whilst the fixed cameras show with scanlines, just something else that separates the camera types.

Wed 6th June 2018: Got the overlay mode in-place last night and I'm happy with how it works. It pulls in all the nearby locations from my quadrant search system and displays them relative to the player's position and rotation. Small indicator arrows show if the camera is above or below you and as you get near a camera, the alpha fades lower to leave the nearest camera more prominent.

Also got the demo mode in but I am not overly happy with that. Teleporting causes visible screen glitches, even when the screen is fully faded out, so that's really annoying. (Update: This was actually being caused by me not drawing the screen-blanker while selecting a new camera and is now fixed) To avoid the infinite loading screen problem with the faded screen, I have implemented a secondary screen-blanker that kicks in when the screen is faded out. So the main screen fades back in but the blanker remains in place. After a further second, that fades out to show the visible screen behind it. This gives the world chance to load and for any spawning peds (like shopkeepers) chance to land on the ground. Speaking of shopkeepers, I can't work out why they speak to the player when EVERYONE_IGNORES_PLAYER is set to true.

When you're in demo mode, it will pick a random camera, teleport you there and leave you in control of the camera (if applicable). You simply press a button to pick a new camera, or exit back to where you were before entering demo mode. I have done this via the cheat option, which is actually really annoying because unless you have used the mouse, the cheat option won't work. That's why the screen wiggles just before the cheat box appears in the video.

Short video (2m) showing the overlay and demo mode.

Since uploading that video, I have made some minor changes to alpha levels of the overlay, just to get better transitions between alpha levels and to make the player indicator less intrusive when there are no cameras nearby... not worth making a new video for though.

One camera type that does concern me, is the PTZ camera. The camera is placed at a rotation that matches the rotation of the prop. This is fine for 90% of the time but the dome ceiling cameras have no specific direction, so what might face into the store from the left, is facing the wall on the right. I'm not sure if that's something I can override with a raycast check before I switch to the camera or not, so that's something to be tested.

I was actually discussing this mod with Tobsi Cred yesterday and he mentioned something that was discussed during the OnFoot camera development. That was using the CCTV cameras in that mod. The theory of that is ideal, the reality of it is somewhat different. Many of the cameras don't face where you walk, some are on the top of multi-storey car parks, others are inside shops and stores. So while you might be near a camera, there's no guarantee it can see you.

One other thing I did think about doing info wise, was adding a GetNearestLocation() function to my World Guide System, so the random camera mode could possibly identify nearby locations. I thought that might be useful if a camera pointed at somewhere interesting and you wanted to visit that location. I was thinking of adding that anyway, just so you could get nearby info while you were travelling round the map... so that's probably tonight's task.

The last idea that popped in my head last night, was locking some of the CCTV cameras behind a security lock, requiring you to pass a hacking process to get access to them. I thought it might be interesting for the banks and shops, but that would also mean knowing that a camera was in a bank or a shop of course.

Fri 8th June 2018: Camera detection ran into some problems due to the collision not being loaded for the interior walls, which was causing the checks to fail. But because I am using my own screen-blanker, I have unlimited time to play with, without having to worry about the infinite loading screen problem.

I added the GetNearestLocation() function to the WGS and then added some more as well, including a GetNearestLocationToExcluding(Vector3 position, Location locationType, float radius). With that, I am now able to get a location but I can exclude things like ATMs, which can interfere with getting valid locations.

The last thing I am probably going to change, is the random camera. Because I am picking by zone first, it actually limits the range of randomness down quite a bit, especially if a zone only has 1 or two cameras. What it means is that instead of a 1 in 957 chance of seeing that camera repeated, it's actually only 1 in however many zones there are, something like 90... ish.

I also did an experiment last night. I extracted around 10,000 ymap files using Codewalker and scanned them for cctv props. It found over 1300 possible hits but while they appear in CW, they don't appear in the game. So I presume that under certain conditions, additional cctv props are added to the existing collection of world props. It may be in multiplayer because the ymaps and camera props started with hei_, which I assume is a "Heist" prefix.

Sun 10th June 2018: I think I have to consider this finished. I have sat here for a couple of days and can't honestly think of anything I can add to it. I did further tests on the ymaps and nothing I find in there appears in the game. I even tried enabling the MP maps and still got nothing. I mean, here's a prime example. The inlay shot is what Codewalker sees at this location but that dome camera just isn't there in the game, as you can see in the main image. (opens in a new Tab)

So I don't know where or when they appear, they could be mission specific, I honestly don't know.

So there you have it, one week, mission accomplished... I guess it's one less thing on my "To be completed" list. I had thought about a hacking screen/game to get into secure cameras like the prison or banks but in reality, they would just be something I would just turn off anyway. It has the manual view mode, it has the controllable demo mode and it has the timed demo mode. I can't see the point in adding things that other people might like, because other people won't get to like or dislike them anyway.

Functionality Info Update:

Thanks to the PropRestorer ymap mod posted on modding sites, an additional 560 (approx) CCTV cameras have been added to the mod.

Update 18-03-2020: A comment on YouTube reignited some minor interest in this, which has resulted in some changes being made... quite a lot of changes actually.

Transition into and out of CCTV view is now done behind fading screens. This makes it look better, particularly when you come back out of a viewing mode.

Player location is now restored using PositionNoOffset, meaning the player appears stood on the ground, instead of dropping in.

Gameplay camera pitch and heading are saved when a CCTV camera is viewed or demo mode is activated and restored when you exit those modes.

Checking is now done for the CCTV camera props existing, meaning you don't get missing CCTVs being highlighted if the PropRestorer mod isn't present. Ini file option let's you turn on the highlighting of where these props should be.

Overlay marker alpha is now proximity based using a very simple check: Math.Abs(OffsetFromWorldCoordinate.X + OffsetInWorldCoordinate.Y). I clamp the result into a workable range, normalise it and then do 1f - value to create the alpha modifier (with a .1f bias to make them solid sooner). So they now fade out as they get to the limits of being displayed.

Overlay and camera indicators can now be set as separate colours per camera type in the ini file, to make identifying the camera type easier before you view it, useful if you only want to view zoom or PTZ cameras. Colours can be read as either RGB values (255,255,0) or named colours from the Windows KnownColor collection, e.g. Dark Khaki.

Camera effects (like scanlines) are now set in the ini file as well. You can choose any of the timecycle modifiers, such as "NG_Filmic21" and the amount as a value of 0 to 100. The amount gets converted to a 0 to 1f value when it has been read in.

Tequi-La La interior is now loaded when a relevant camera is viewed, as some of the cameras were inside that interior.

Viewing control has been changed to holding Sprint for half-a-second while you are stood still. Various checks are in place for other conditions that will make viewing impossible, like running, ragdolling, aiming etc...

I did consider whether to release this mod or not but I'm not convinced it's a good idea. I think it's pretty unique, it has a shitload of time invested in it (and I mean a real ton of time) and it's interesting watching the world happen... I just don't think I can deal with the level of distrust I have for the GTA V community now. This means any changes I make, essentially end up in a mod that never gets used, which is why I can't motivate myself to create anything new now.

Update: I have been using the prop restorer ASI instead of the YMaps and it seems that this method can just suddenly stop working and lots of props will disappear.

Update: F**K!!! Added 28 new cameras that are placed around the Diamond Resort, which I thought was a good thing. Discovered that when MP maps aren't enabled, those cameras still get taken into consideration when trying to find the nearest camera, thereby affecting the cameras that are there in SP mode. What makes it worse is I can't find any native that tells me if the MP maps are loaded or not. There's a native that says "Are you online?" but it always returns True, so it probably just checks if you're online in a general sense, not as in "Are you in GTA Online?".

I really don't want the QSM doing prop checks on locations... there must be some way to tell if the MP maps are enabled.