Editing/Modding‎ > ‎

Optimization Hints

Making a map optimization friendly can be a huge boost in framerates for your map. When you run the map optimizer, it tries its best to find all areas that the playing area can reach. Basically, it starts at each player start-point and uses a path-finding algorithm to locate all edges that can be reached. It can take a while to do this. All edges outside this area (And all prefabs that it cannot reach) are not included in the collision map. Once it has found all lines and prefabs its possible to touch, it uses that as the game area. The smaller the game area the better. If any point on a line is included, the entire line is included.

Therefore, you should try to follow the following guidelines in keeping your map optimized.

  • Use the level-of-detail options in the various prefabs, to control which prefabs appear at which detail level. You can then put a lot of detail in your map at high detail mode, without worrying too much about how it will impact lower spec machines.

  • Don't allow access to areas that have a lot of complex collision geometry, but cannot be reached and are just for scenery. For example, if you have a nook in your map that cannot be reached by ships, and has a lot of complex geometric objects in it, you might want to use a simple solid prefab to block the entrance of that nook, so that all of the collision geometry inside the nook will be discarded when the map is optimized. If the pathfinding algorithm cannot 'reach' an area, those lines will not be used to compute collisions.

  • Often, there are hyperchannels leading in and out of the map, from a very long distance away. It is imperative that towards the edge of your minimap, you break these lines up a few times (with nodes and floor points), at least one time just outside your minimap area. So for example, just outside the minimap zone, add an additional point to each of these lines, and drop a node there.

    • Why? Because if any part of a line is inside the playing area, that entire line is considered part of the collision map. If its a really long line stretching really far, that entire line will be included, greatly increasing the size of your overall playing area, which degrades performance. Because the minimap area forms a final, solid area out of which nothing can escape, creating a hyperchannel node and floor point just afterwards ensures that the lines that extend out towards the distance are not included in the collision map.

Example image of the mining facility collision map after optimization: (Notice how all of the collision lines and prefabs outside the map have been removed from the possible collision map). You can get a collision map for any map you have or one you're making by pressing the console button (the ~ at the top left of the keyboard), and typing 'savecollisions' before loading the map in game. After doing this, a file will be created in the map's folder, called 'mapname_collisionlines.raw' These are RAW format triangles which you can import into programs like Blender3D (or other 3D packages) using the 'import' command. RAW TRIANGLES.

You can also use this to custom-fit when making custom prefabs for your maps!

This is what it's doing while it optimizes - the spiderweb is its basic fill routine, covering any place it can get to from the start point. It does this many times a second:

Cheap but effective!

Example of using a prefab to prevent unneccesary collision map from being exposed:

Starmap. I've drawn a red oval around the block (sunken under the hyperchannel) that was put there to prevent the collision lines from 'leaking' into the useless area.

Starmap, During scanning. Notice that the white cobweb of lines is blocked from entering that tiny zone. That means all of the collision stuff behind it will not be used in game, greatly speeding up the physics.


Comments