Most Wanted Map Loader

Map configuration

  • SmartCulling - Enabling this option makes objects not get drawn if they're out of view. Note that "objects" in this case refers to individual .fbx files! Split your map to best make use of this option.
  • AggressiveCulling - SmartCulling but per mesh instead of per .fbx. This might be more inaccurate and end up not drawing some meshes at the edges of the screen, but might heavily increase the framerate on large maps.
  • MinimizeGameMemoryUsage_MW - Most Wanted only, disables the loading of the original track entirely, and just loads FRONTEND/PLATFORMS/NextGenSky.BIN for the sky. This can cut about 300MB of memory, use this if your map is making the game use more than ~3.5GB of memory
  • DrawDistance - Objects this far away from the camera that don't have LODs are not drawn. Note that this also refers to individual .fbx files.
  • LODDistance - Objects this far away from the camera draw their LOD instead of the high quality model. This option has no effect on models that don't have LODs.
  • MapOffset - The coordinates the track should spawn at. Usually set somewhere above the game's most common spawn point, so the car spawns at the map's origin when you go in-game, but markers from the vanilla map don't overlap with the new map. Assuming the map's origin is where you want the car to be, it should be 1762 -2508 500 for Most Wanted, 3400 -320 500 for Carbon, and 0 0 0 for ProStreet. 3970 -360 500 works for World, if you're running an offline server with the default spawn near the Welcome to Palmont race.

Lighting

The lighting parameters provide a bit of customizability for baking some basic shading into your map, as long as UseShading is set to 1. The parameters are as follows:

  • SunPos - The forward vector for the direction the sun is pointing
  • SunColor - The RGB color from 0-255 that the sun should cast onto the surfaces it hits
  • ShadowColor - The base color that should be applied to surfaces that the sun does not hit

LOD support

You can add LODs to your map by specifying a MapModel#LODPath along with MapModel#Path.
If an object is out of LOD distance, this LOD model will be drawn instead, which can have a massive performance benefit.
Note that if you have an LOD model specified, that model will always be used for draw distance and culling checks, so if the LOD model is too small, it will make the high quality model disappear when it shouldn't.
LODs are also very useful for managing memory usage, as the high quality models are not loaded in at all as long as their LOD is drawn, similar to how GTA games handle map streaming. Take a look at my San Andreas port for an example of this.
To build on the memory usage point, you can specify multiple smaller models under one shared LOD like so: MapModel#Path, MapModel#Path2, MapModel#Path3, etc. This reduces the initial memory usage that comes with loading in new models and speeds up the loading process, as each model is loaded on a separate CPU thread. Check my Liberty City HD port for an example of this.

Collision meshes

Collisions are one of the most important parts of a map, so getting this part wrong can easily ruin the experience. Here are a few tips on how to best optimize your collisions:

  • DON'T just shove a copy of the original model in as the collision mesh!! This works for initial testing, but is bound to have major issues for any complex maps. The mesh has to be fixed up manually to work better in the NFS engine.
  • Try to simplify the collision geometry as much as possible. Get rid of small details, merge vertices, etc.
  • Vertical surfaces with a height larger than 0.25m are registered as "barriers". These are walls that cars can collide with.
  • Due to engine limitations, these barriers cannot be sloped! Keep this in mind, as it is likely going to be the cause of 99% of weird collision behavior. If you have a wall with a sloped top or bottom, split the collision into many smaller quads instead. Though if you're making a NFS style map, then just extending the collision height way above the wall will work as well, as that's how the vanilla map is set up, and you probably don't want cars to be able to fly out of bounds anyway.
  • Note that this game doesn't support ceilings! If there's a low ceiling then cars will simply teleport above it, so delete any such surfaces.
  • The game also doesn't like overlapping surfaces very well, so if you have, for example, a ramp, make sure to delete any collision surfaces directly below it, otherwise the car might stick to that surface and simply pass through the ramp.
  • To assign different material types to a surface, simply rename the material you're using to a SimSurface type, e.g. grass, asphalt_no_leaves, etc. You can find a list of these in VltEd.

Other useful tips

  • You can use the ShowCollisions option in the global config to take a look at your collision mesh as a wireframe. Cyan represents floor collision, dark blue represents barriers. This option will come at a performance cost on large maps but can help identify any issues with barriers.
  • The DebugDisplay option in the global config (Most Wanted & Carbon only) makes you able to see the amount of models and textures currently loaded. This can be especially useful for testing heavier maps that have LODs.
  • If you're getting low FPS, a quick way to find out the cause of it is pausing the game. If your framerate suddenly jumps up when the game is paused, you have an unoptimized collision mesh. If the FPS stays roughly the same, the visual mesh is too heavy.