This thread is to throw out some of the knowledge that not only applies to FPSC but is required for games design in general. Some things are not always obvious as you cant see them under the hood so to speak.
________________________________________________________
1. Collision and physics:
________________________________________________________
There is always a heap of advice about improving performance in FPSC from keeping entity's low poly to making dynamic entity's static and turning off physics etc, some have their own methods and preferred ways of reducing the weight on the engine.
One very important and necessary factor always seems to be overlooked......physics collision.
I only ever see two settings being used again and again, box or poly.
There are actually other collision settings which can be used to reduce the calculations required for physics in FPSC.
Unless you really need to get under that table to find something its always best to use box collision on static immobile objects, the player wont notice that the round table has a box around it, nor will they notice that the car they just jumped up on is using a reduced collision envelope.
There are five collision settings you can use.
For static objects the collision works as follows:
1 is Polygonal collision
2 is box collision
3 is reduced collision
For dynamic objects
3 is cylinder
4 is sphere
Any other value is defaulted to reduced
Always take the time to think about how you want the player to react with objects in your level, you really dont need poly collision on everything in your game and using reduced will often be enough for any complex static object.
When you have hundreds of objects in your level design and reduce the collision on these the engine has less to calculate in real time and your frame rate will benefit greatly.
If your entity is small/medium sized and dynamic turn off collision completely via via script.
________________________________________________________
2. How to make a character walk/run on large entity's
________________________________________________________
Three different methods to have npc's move freely on larger entity's
Its well known that npc's have issues with any surface larger than 100"x100" (one segment) they will either run on the spot or worse...bounce up and down or fall through the floor completely. I myself have had to face this many times, particularly with terrain and the only solution was to slice up larger meshes and create individual segments from the larger model.
Fpsc has lots of hidden gems which can be utilised to make things work, not perfectly but still usable, and this is a couple of them.
Here's the simplest and most effective method:
Replace the appear script with appearantigravity.fpi, this will turn off floor logic and will maintain character height in the level allowing the npc to move entirely freely, even allowing character to cross from entity to segment and vice versa.
This can be used with both dynamic and static entity.
Another way if you want the npc to use null space (stay within a boundary or prevent them walking off the entity)
Place your terrain or whatever entity you want to use in the editor, your entity should be dynamic, this wont work for static and your character will simply fall through it when it spawns. Next you want to go down a level and place some floor segments underneath the area you want your character to move around in on the entity above, this has an advantage that npc's will stick to this particular area due to null space.
Open your character .fpe and in :orientation change offy =0 to 100. This will raise the character one level in the editor. Place your character on the level of the floor segments. When you first place the character in editor you wont see it, its above the level your placing it on, however when you raise the level in editor you can see the character fine and will be able to edit and move it around as usual.
When you test the game your npc should have collision with the entity its standing on and should be able to move around freely over the area represented by the segments placed on the level below.
It should be noted that as the entity is dynamic it does not use poly collision so its best to use this in areas that dont have too large a height difference, its barely noticable in areas where the terrain or whatever your using rises and falls by around 10-25" and its really not noticable at all to player collision. It gets obvious when the height starts to exceed 30" so use it only in more level areas.
You may also find that characters do not attack and run at you as much if the player is on the same surface, they will for sure strafe etc but aren't as aggressive in pursuing you for some reason, this can be cured by having the player on different surfaces or segments around the terrain the npc's are on or it might be fixed by better scripting I haven't had the chance to go too deep with this one yet.
Here's the really weird part, the npc is using collision with the terrain not the segments below, if you place standard segments next to your terrain and place same on level under it, the character will walk off the terrain and fall through the segment floor down onto the level underneath where it begins to act normally, as if no offset existed....go figure.
Please don't try to use this with huge full map sized terrains that have mountains (make these separate entity's)you will not get it to work. It is perfect for smaller wasteland style areas.
I do think a better workaround to this in some situations is simply to place segments and then dynamic terrain entity with collision turned off directly on top of these but you will get parts of the segment floor poking through the terrain and I have noticed that the npc seems to use an average from the height of the terrain which simply looks better.
I discovered this when I had to have collision on road entity's which would be destroyed revealing a crater beneath so I didn't have that option, if you wanted to blow things up and still have characters move around on them before destroying (such as floors which reveal traps etc this is definitely the way to go and it may have other uses I havent thought of yet.
More coming soon
Awesome! Its one of those threads.