Load map add-ons only when player is in range

OK, I’m new to server development. Unlike many of the newbies I have seen around our universe, I am in no real hurry to open my doors to the rest of the world. I want to get it right. So I have a bunch of questions, ideas, musings and brain droppings. I’ll be posting some of the things I have been pondering. :thinking:

I want to have a good variety of interiors and custom map additions. But those take a good bit of resources. Is there a way to limit when a map add-on is loaded, like only when there is a player around to see it? It’s kind of silly to have a bunch of things in the city if the bulk of the players are up in the county.

Another option I was thinking about, can map add-ons be loaded an unloaded at will from a script? I was thinking tying something into an AOP script could load and unload items depending on where the AOP was set. Unload the zones that are not in play. That would serve also as an incentive to herd the cats to where you want them to play.

1 Like

Map addons already only ‘load’ when you’re nearby, as GTA uses a streaming game engine.

If you’re thinking this is somehow not the case, make sure you’ve made a cache file for your resource (see save_gta_cache) and that the streamingExtents for .ymap files don’t somehow fill up the entire map.

OK now I feel like a moron. I just assumed that the more you tack onto a server, the more RAM is used and the more load on your server’s hardware. Is that not the case?

I think I understand what save_gta_cache <resource name> does. It helps things load quicker on the clientside for the player by creating a cache. How does this address the workload for the server?

Or am I just wrong? I can accept that. :slight_smile: I admit freely that I am new and have no idea what I am doing with some of this stuff. This is why I am not in a hurry.


Disclaimer: I am neither a developer nor a programmer.
</dave>

I believe this may be something you can look to as a reference.

And it looks like I’ll have to re-read the console commands again…

Nope, it’s a file saved on the client that you then copy to the server and add to the resource so any clients loading in later don’t have to preload stuff.

Not really, ‘streamed’ maps are only really existing on the client, the server has nothing to do with this other than delivering the data to clients as requested.

So, essentially, for each of the maps and MLOs, I should:

  1. Run save_gta_cache <resource name>
  2. Copy the resulting cache data somewhere in the resource
  3. Win at life

By this logic, the number of maps and MLOs should not impact the server as much as i thought.

I’m still learning all I can on optimizing scripts. I want to have a good variety of things for players to do without breaking the server hardware.

Thanks, Bubble. :slight_smile:

… and add it in file for the fxmanifest, but yeah.

This mainly makes it so that it won’t have to download this data on load (see ‘Preloading collisions’ stage during loading) but only when a player gets nearby: these cache files contain data on when and where stuff should be loaded, but if it’s not present the game will download it on first join (and then cache it for later use, of course) and then reload from cache when getting close.

2 Likes