Tutorials & Guides / [LOCKED] Optimization for End Users

Author
Message
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 10th May 2017 01:25 Edited at: 10th May 2017 01:27
* * * * * * * * * * * * * * * * * 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

Attachments

Login to view attachments
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th May 2017 05:58 Edited at: 10th May 2017 08:08
Very nice guide Wolf, lots if useful info here.

For large objects that you don't want players to walk through, for example a row of houses, you would use box collision, but you can actually go a step further here.

Here's how i optimized the scene below:



The first optimization started in the actual creation of the models, each of these buildings believe it or not is just a facade, it's smoke and mirrors, you will never see the back, roof, or floor of the building, so i didn't build them into the model, here's how they look from behind:



This way i have reduced the poly count, and the texture space by at least a third.

The next optimization came in the way the object is configured for gameguru, in the .fpe settings i set collision mode to 11, which turns off all collision to the model, no collision box, no collision box polygon draws, a huge reduction in resources used.

"but Belidos, that means the player can walk through the building" i hear you cry.

True, but that's where the next optimization step comes in...

Next i placed the 5 buildings all nice and neat in their row, but there's no collision, the player can walk through them, no problem, i just added the invisible wall entity from the scenery folder to the scene, placing and scaling it flush against the front of the buildings, the invisible wall is a single plane comprising of 2 polygons, and a collision box comprising of 12 polygons, if i had added a collision box to the 5 buildings it would have totaled 60 polygons (12x5), so instead of 60 polygons of collision i now have 14 polygons doing the same job.

"but what if you need a back to the building and collision there too?" you ask.

Simple, i created this model:



It is simply two planes the correct size to fit 5 buildings between, i have inverted the normals so they face inwards (this makes it invisible in gameguru), and given it a tiny plain black texture (10px X 10px iirc), put it into gameguru with box collision, est voila we now have four sided collision around the buildings for only 2 extra polygons.

Granted individually it's not a massive decrease in polygons, but every little helps when trying to optimize a level.

Now that's what i call thinking outside of the box!

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.

Attachments

Login to view attachments
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 10th May 2017 11:27 Edited at: 10th May 2017 11:31
Thank you Wolf, I have learned something from this, Texture Mapping is the biggest issue I have, I am using Sketchup 2016 at the moment with a DirextX exporter, I would really like to learn how to create an ATLAS texture with Sketchup and Ultimate Unwrap 3D (I purchased the Pro version) it does actually import Sketchup Models but that is as far as I get, I can see my model but have no clue of what to do next, I think I have to map seams.

I have watched a few youtube videos but none seem to be sketchup > U3D > Direct X > ATLAS

oh I forgot to mention I also purchased Quixel Suite 2.0 I also have PS CS5.5 not sure which would be best to use Quixel or U3D ?
Welcome to the real world!
Windows 10 Pro x64 - Core i7-2600K @3.40GHz - 32.0GB RAM - GeForce GTX 950 2GB - 4x500GB SSD Striped
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th May 2017 11:51
Great thread Wolfe,great advice from you guys

@GraPhiX

this link will show you how to create a texture atlas in uu

http://www.unwrap3d.com/u3d/tutorial_texture_atlas.aspx

Dave
Windows 10 Pro
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 10th May 2017 14:26
I really love your tutorial. Nice work!
Do you know if there is any debug option for showing collision like in agk2?
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 11th May 2017 02:03
I'm glad to see this found some readers! Thanks!

Also thanks to whoever stickied it!


@Belidos: I'm impressed! That is remarkably thorough!
What about the staircases, isn't that a little iffy with the boxic collision?

@Graphix: Its quite easy, the ATLAS or any texture for that matter just includes pictures of whatever you need for the model. You can get a ton of raw material on www.textures.com if you want to go down the photosourcing route. This is done in a graphics model and for simple architecture, you can do it before you even unwrap. (Its not the true and correct way, but I do all my models like that.)
In UU3 you are simply unwrapping the model. I suppose this can be helpful. While I own UU3D myself, I tend to favour the uvmapper of fragmotion.
I'm not quite sure I understood your question 100% though.

@Corno1
Quote: "Do you know if there is any debug option for showing collision like in agk2?"


While there is still a chance Lee hid that feature some where I am almost entirely certain there is not. TBH, I'd not have much use for it personally...at least not for the type of game I make.



-Wolf

Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 11th May 2017 08:22 Edited at: 11th May 2017 08:23
Quote: "What about the staircases, isn't that a little iffy with the boxic collision?"


Well the staircase, steps really, on those models don't really need to be climbed, as the buildings can't be entered, so for rows with those i placed the invisible wall so its about half way through them, that way you can get close enough to the building to view details, but it won't feel like you are walking through them.

Obviously in 3rd person it would be different, you would have to put the invisible wall in front of the steps to stop them walking through them, but with first person about half way through works best with the first person field of view in my opinion.

If i was gong to use them in such a way as i would need someone to climb them i would probably separate them from the main model and give them their own polygon collision.


Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 11th May 2017 12:56
Just overlooked it and saved it in my favourites right away Great post!
Modder, Soundtrack Composer and now Game Developer. Well, sort of.

Windows 10 64bit - Intel Core i7-2600 CPU @ 3.40GHz, 8,0 GB Ram, Geforce GTX 1050ti

Youtube:
(Music Channel) The German Music Dude: https://www.youtube.com/user/DeutscherVolker
(Games and Mods Channel ) DK Productions: https://www.youtube.com/channel/UCIqwvScXnJL_zNYqSsfTCqA



Mrs Baird
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location: Cologne
Posted: 11th May 2017 18:24
Thanx, Wolf for hammering out this tutorial! Great one! And Thanx to Belidos for the insight on the smoke & mirrors.. I had the false idea that objects which cannot be seen are automatically taken out of calculation... Alas.
AMD Phenom II X4 965 Black Edition 4 x CORES / FPUs @3900 MHz - NVIDIA GeForce GTX750 Ti [2 GB] passive cooled - 8GB DDR 3 SDRAM - Win 10 Pro [64 Bit] - Audiosystem: Marian Marc Seraph AD2 - 2 x UAD-2 DSPs
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 12th May 2017 11:21
Great tutorials Wolf, you mentioned about collision :

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.

I have mentioned to Lee if we could have the option to alter the entities collision mode changeable in the Properties Panel, instead of having to go through all those FPE's, especially on a "busy" level. Also this would cure the problem of an artist updating their assets and when they redownload overwriting all those FPE's again.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 12th May 2017 13:09
Good article Wolf this will be handy for new and old users alike
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 12th May 2017 15:31
Thank you for taking the time to do this tutorial. Very informative!
PM
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 16th May 2017 04:00
You are all very welcome

Quote: "I have mentioned to Lee if we could have the option to alter the entities collision mode changeable in the Properties Panel"


This would be formidable!



-Wolf

Loretta
8
Years of Service
User Offline
Joined: 13th Aug 2016
Playing: Generation Zero; Skyrim SE , Fallout 4, In VR- Pistol Whip,
Posted: 13th Jun 2017 17:16
Thank you Wolf, really helpful!
ASUS ROG G20- Desktop Intel Core i7-6700 -3.4Ghz - 16GB Memory - NVIDIA GeForce GTX 970-4GB - Windows 10 64bit
PM
JackalHead
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location:
Posted: 21st Jun 2017 02:24
yup cutting off polies is the oldest trick in the book and works well. Example: Cut the bottom off of rocks houses etc unless your able to go into the house. Really anyything that goes into the ground shouldnt have bottom polies.
"So let it be written; so let it be done." Account got messed up with introduction to steam. I am Jackal
Joined 2nd Dec 2009.
PM
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 22nd Oct 2017 18:16
Hello!

For anyone interested: A second mirror for anyone who wishes to read or share this.



-Wolf

Login to post a reply

Server time is: 2024-11-21 09:05:52
Your offset time is: 2024-11-21 09:05:52