* * * * * * * * * * * * * * * * * Previous Tutorials: * * * * * * * * * * * * * * * * *
OLD [FPSCREATOR related]
getting Modelpack 6 and 28 shader ready
general advice
Spawning Ghosts and Visions like in some horrorflick
Creating a Ghost Character
Keeping up motivation / getting a game done
Do you're transparent plant textures hide the ones behind them?
Dealing with the 1,85 Memorycap
Lightmapping
Mapdesign 1
NEW [GAME GURU related]
Converting EAI Weapons to GG (or others)
Importing Models with multiple textures
Notes on Lightmapping
Converting character models to corpses for level design
************************** Optimization for end users **************************
D I S C L A I M E R
This thread is a tutorial and every helpful hints from other users are very welcome. However, this topic is about methods of optimization for
end users
only. As I hope for this to turn into a decent collection of tips and tricks, that should also be enjoyable in the future, any and all discussion about how GG's engine has to change and how it should be more like this or that other engine will be regarded as
offtopic and removed.
Part I : Introduction
Skip to
II if you want to get to the meat of things!!
So! You've been working very hard on your game idea, have been pouring a couple hours into that map you are really proud of and are now wondering why its only running @ 20 FPS ?? Blimey, you say to yourself! How can this be possible!! Its just a little forest map! Why does this lag when I can run skyrim at 60 FPS?!
Well my friend! The reason is twofold. First, you are running a really weak engine when you view it from any modern standard. That's simply the truth.
The second reason is that you probably don't have the faintest clue about mapdesign and basic video game optimization. You just dragged in a bunch of highpoly trees from the default library, didn't you?
Don't worry! I'm here to help! Are you already an advanced user and find this belittling intro offensive? Well...cut me some slack! It was tongue in cheek
There are a few things I'd like to talk about in the introduction:
First of all, if you don't even know what is going on here.
Click this link for an excellent article on FPS/Framerate.
Its always important to manage ones expectations. I can tell you everything I know about polishing your levels and I'm confident that you can squeeze a lot of FPS's out of them if you follow these steps. BUT Game Guru
IS a very substandard engine and performance
IS its biggest issue. There are several primary reasons for that.
1. Its 32 bit.
2. It runs on Direct X9
3. Unless you specifically pay attention to this, every new art asset you add to your map comes with its very own, separate (and often uselessly high res) texture maps.
4. Its a small engine largely developed by a single person and thus far behind the multicore wizardry of big studio engines.
If you are into game development for a while you will find the following logic throughout the boards. (Not only on GG boards.) A new member is infuriated that his game only runs at such a low frame rate when he can run the latest crysis (or whatever game is state of the art when you are reading this). Experienced users tend to groan at this but it makes perfect sense from his perspective. Why can this look so amazing and run so smooth while my own work runs so shoddy? The answer is that the big studios pour resources way beyond your likely yearly income into the cross plattform optimization of their games and engines. The way the levels in a far cry game are constructed and the way they are rendered can not be compared to how most indies design theirs. Its always a good idea to compare your frame rate to other indie games with similar resources rather than the latest AAA blockbusters.
Part II : Basic optimization with sliders
Rejoice! There are some basic things you can do to improve your FPS using nothing but the sliders. (The sliders are the colourful bars you see when you hit "TAB" in test game mode.)
A lot of your games visual aesthetic is decided here and trust me: Using the default settings is always wrong.
always. So play around! I'm not going to go off on a tantrum on how to set the mood for a scene, I'll just stick to optimization related stuff.
* Camera Distance: This adjusts how far the camera can see. The draw distance! Here you can already buy a lot of frames. This slider is especially usefull for indoor levels where you can drag that bar almost all the way down to zero. Try a setting of around 10. Here its best to just go into the longest hallway/room of your level and look all the way down to the opposite wall. Now lower the value until that wall disappears, then increase it until you can see the wall again. You'd be surprised how low a value you can go with but still see all of your levels.
Now, this is a little bit more tricky for outdoor worlds, but only a smidge. You might think that you really want that huge draw distance. But you really don't in most cases. Try lowering it and not only will your framerate improve but, for most levels, you can really go all the way down to around 30 before object popping becomes a nuisance. Notice that GG is currently not the best engine for amazing vistas, in case you do insist on an insane draw distance. If you do want to pull this off regardless, I'd advise you to work with LOD levels and billboards...but more on that later.
A lower draw distance is best to be paired with a decent fog setting. You'd be surprised how poignantly you can set a levels mood using the fog, including indoor levels! Older users might remember an old PS1 title that intuitively used fog to hide a very low draw distance: The original silent hill game. This can be replicated here if you wish.
* Effects: By the time I am writing this, certain effects are still very performance hungry. Its up to you to decide which ones to keep and which ones to deactivate, here is an overview of some real frame rate hogs:
Bloom: A standard effect in videogames. However GG's bloom is really eating up those frames so I advice to turn it off for now.
SAO: This is ambient occlusion. Some people really like it, others don't even notice it. Play around with the slider, if you find the effect not noteworthy, turn it off.
Lightrays: A beautiful effect when mixed with foliaged but it can also buy you 1 to 3 frames if you deactivate it.
DOF: Depth of Field, this effect simulates human eyeballs focusing by blurring distant models. Its an iffy effect IMHO and I usually turn it off. Its rather performance hungry too.
* Terrain and Water: GG's terrain has always been a huge performance hog. Depending on your settings, (you can adjust the resolution of the water effects in the setup.ini if you have not yet done so.) the water is as well. If you are working on an indoor level, shut one or both off when not needed.
There are scripts coming with GG: GoInside.lua and GoOutside.lua that turn these features on and off again. (You can guess which one is which.)
Do this as well if the player enters a building or similar where he can not immediately see the terrain or when he is too far away from water to see it. Experiment around with it.
For quick tests: You can hit
F11 and turn off water and terrain while in test mode.
Part II : Basic optimization. A note on map design
Its always good practice to read a few tutorials on leveldesign if you want to make a game, even if you are among those who are less interested in the visual aspects of making a game. The level is not just a visual thing but also an element of gameplay. It is also an aspect of how well your game will run.
If you are looking for tutorials, its a good idea to read older ones. For UE3 or the source engine. Its simply the truth that GG is not the cry engine and you should be able to adjust to that. While you're at it, replay some of your favourite pre 2008 titles and really pay attention.
That being said, here is what you need to pay attention to:
Polygons: Every model you add will add "triangles" to the scene. A 3D scene is made up of thousands of little triangles that make up a wireframe.
While here as well as everywhere else, looks can be deceiving, you can usually tell that a model has many polygons if it is detailed.
Have you ever wondered why so many games add a silly amount of boxes and barrels to their levels, even when they don't make any gameplay sense? Because they are also easy to do and have very little polygons..yet they fill up the level.
Now...I don't necessarily advice you to fill stuff up with boxes n' barrels, just figured you should know that.
Try to use as few very detailed models as possible. Also don't try to make huge forests with very detailed trees. Without quality LOD meshes and treebatching this is certainly not something you want to try in Guru.
Example of Polygons
Polygon clusters: A lot of simple models in a single place make a polygon cluster. You can have a few of these but if your whole map is made out of them, it will lag! Not just because of the polycount but also because of the collision. Its good practice to have a hallway or a simple passage to create some space in between detailed areas.
Textures: Most games,especially older ones use a certain amount of lower res textures/materials all across the map (remember WADs??
) GG has the flaw that nearly every model you put into your map will add a full texture only used by this single model.
Now some users like Bugsy, rely on using a handfull of 4 or 2K textures for most models in the map but the vast majority of users just drops in stuff they got from the store without questioning the impact that might have on their performance/memory.
A lot of items on the store that would look nearly identical using a 512² or 1024² res texture yet they come with a 2k or 4k texture.
I understand that artists want to present the product as crisp as possible and its always way easier to downgrade a texture than upscale it but most users neither check on nor even consider this. Just browse textures and see what you can adjust for your game.
Part III : Real Optimization for advanced users
In this section I'm assuming that you are entertaining game design as a somewhat "serious" hobby and are not afraid to delphe into some "finicky" stuff. I also assume that you got the basis of texturing, modeling and importing/exporting from GG down. I'll still keep it simple as most of it really is rather basic. I hope this will be somewhat helpful for you!
Collision: Ah yes, this is a big one! A lot of GG games lack because of the applied collision. If you ever used the unreal engine you will know that here you are applying collision meshes to your models. This means that your lovely detailed models usually have kind of an invisible model applied to it which is the actual gameplay collider. You would be surprise how simple the collision environment of a AAA shooter is despite the map being cluttered with objects. In GG this is different and usually entirely neglected. There is a good chance you, dear reader, never even thought about this before I brought it up.
In Game Guru, nearly all objects have polygonal collision, that means, in a manner of speaking, the engine has to load the mesh twice if collision is happening. This is the reason why you might get severe lag spikes whenever you are close to a complex 3D mesh. A good example for this would be the corpse on the gurney in my game "Redacted : Hired Gun".
Now I advice you to go through the FPE's of your models and set the collision accordingly.
If you believe that you rather have pixel perfect collision in your game, trust me, this is neither necessary nor noticeable.
In general, small ground clutter (twigs, bushes, paper, pencils and so forth) require zero collision. This also takes care of odd bumping around when the player moves through.
Slightly larger ground clutter (cans, larger tools, small cardboard boxes, so forth) can all go with boxic collision. In fact, a huge amount of things are best with boxic collision.
Most items can go with reduced collision. this option calculates a simpler mesh for a complex mesh. This is not always a good choice...just test it, if you find yourself being stuck or running in an invisible wall, use polygonal collision.
Cylindrical and spherical collision for objects that are this shape and larger. (a barrel for example).
Polygonal collision only for things the player will jump around on or walk through (like a premade hallway for example.)
A chair with basic collision attached (source: UE4)
The shelves in the background of
this picture for example could use entirely boxic collision. Including all the items on it.
If you are making a city level in most GG set ups currently installed, all the wires hanging from buildings you can not reach, every skyscraper, every piece of clutter on the ground has polygonal collision. This does, of course have an impact on your framerate. There is some huge improvments that can be made here.
Adjusting collision is easy: You open your fpe (notepad) and change the following line:
collisionmode = number
Here are the values: (please correct if there is a wrong value)
collisionmode = 0 BOXIC
collisionmode = 1 POLYGONAL
collisionmode = 2 SIMPLIFIED
collisionmode = 3 CYLINDRICAL
collisionmode = 4 SPHERICAL
collisionmode = 11 (or string of ones and zeroes) NO COLLISION
LOD Levels:
If you are a modeller, adding Level of Detail meshes to existing stuff you have or to all new stuff you might create is always a good idea. How to do this is fuel for its own tutorial though, if you don't know already. I'm just bringing it up because most meshes out there don't have them. (granted, neither do most of mine but hey! I'm lazy!)
ATLAS Textures:
If you are a modeller and you are making clutter or architectural packs for GG its good practice to have a single High res textures where you'll got everything you need on that map rather than many smaller ones (or worse, many large ones for small props). Tons of games do this. This greatly improves "RAM efficiency".
Delete unnecessary faces:
This is a suggestion that can lead to quick regret because I'm telling you to delete parts of your models
. This is only for advanced users that model entire parts of levels. Any faces (polygons if you are wondering, this isn't that Travolta/Cage movie) that the player can not see could be deleted for increased performance.
And that is it for my little tutorial. Please let me know if this has somehow helped you or even better: If you got even more ways to increase FPS in your game.
If I made some mistake, please let me know that too so I can correct it.
Happy developing!
-Wolf