Post feature RSS Welcome to the SGW3 Improvement Project

A brief look at how SGW3: IP came to be, and what it does.

Posted by on


I started development on this mod following the release of the 1.4 patch for SGW3 on the 5th of September. It was a decent patch. smashing bugs and improving load times. But it failed to properly address the single biggest tech/design issue in the game; one that has plagued it since launch. That problem is NPCs disappearing, and failing to appear until the player is close to them. Like a very mild version of Homefront: The Revolution's spawning issues. The developers had promised they were looking into the issue. And as far as I can tell, they did make some attempt to solve it. But it is was still an issue. An issue that was composed of multiple niggles around the same key issue.

Now You See Me, Now You Don't:

The game was fun, but there was this regular annoyance. You'd send your drone to survey a base, and when you called the drone back, the NPCs would despawn because you were outside their active radius. You could tag enemies, climb a hill for a better shot, and when you looked through the scope they'd be gone. Irritating. Immersion-cracking. The game also had overly aggressive timers which would cause NPCs to be despawned if you sidestepped behind a large bush.

Eurogamer released a video criticizing the game for despawning NPCs they were trying to shoot.

In All Fairness:

In fairness, you couldn't shoot further than 150 meters in Far Cry 3. Enemies often don't spawn until you're quite close to bases in Metal Gear Solid V. Open world games have always tried to balance draw distance with performance. And CI Games are trying to keep this game running stably on underpowered Jaguar console CPUs. I'm not in any way inferring that CI Games are lazy or incompetent. They have their reasons. They do care about their game. And it's a pretty good game underneath the tech issues. That's why this mod exists in the first place. I want to make a good game better.

Last Train to Modtown:

The great thing about PC gaming is that if we have a difference of opinion with a developer, we can turn to mods. After playing SGW3's very fun Sabotage DLC, I started poking around in the files trying to figure out how the spawning system works. My first success came from modifying the AIArena.lua file, which allowed me to partially prevent the game despawning NPCs. By default, the game will despawn NPCs if they are occluded for longer than 2 seconds. I raised this timer to 240 seconds. Suddenly NPCs were no longer disappearing because I'd walked behind a small slope.

But this wasn't good enough. Many areas had NPCs that wouldn't spawn until you were 150 meters away. Some areas had NPCs that would disappear when you were 200 meters away.

I needed access to the AIZone entities within each level. These entities controlled NPC spawning. (I still don't fully understand how they work. There are other factors that prevent NPCs spawning, and I think it's partially linked to the game streaming regions as you travel through the map.)

Because we don't have access to the game's CryEditor files, I was forced to extract the raw xml data for each level, and covert it from binary format, and then modify it manually with a text editor. I found the AIZone entities, but I faced a problem. There were hundreds of them for each map, many with unique min-max values, and determining which one corresponded to which area was borderline impossible. Also, I didn't fully understand what fSpawnZoneDistMax and fSpawnZoneDistMin actually meant. They're just variables. I still can't figure out where they're used, and it's possible that a lot of code is stored in the game's EXE or something. Regardless, these AIZone entities ranged from tiny to reasonably massive. I chose to overwrite them with 800 and 500 meters respectively. Which is a really unwise blanket approach. It could cause all sorts of potential issues.

However, I made the changes, did some testing, and was generally pleased with the results. It's not perfect. But the NPCs now spawn much further, render much further, and don't vanish because you crouched behind a bush. I feel it greatly enhances the overall feel of the game, and it's something people have been asking for since release. Does it completely eliminate the issue? No, and I don't think it's actually possible to completely eliminate it. However, it does significantly alleviate it.

368070 20170910153731 1

With this mod, NPCs you tag with your drone now stay tagged. They don't vanish because you were operating the drone 400 meters up the road.

NPC spawn distance improvement - Mod DB


I hope that eventually CI Games improve the game to the point this mod isn't needed. But until then, I'm proud to present a mod that attempts to improve a really good FPS game that bit off more than it could chew. A welcome throwback to crazy ambitious Eastern European FPS games of yesteryear. It has character. It has charm. And now it has charm that doesn't regularly disappear at 200 meters. I just hope the mod doesn't completely break the game in some way I haven't forseen. Feedback is very much appreciated.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.