Author Topic: Optimization for newbies  (Read 364 times)

0 Members and 1 Guest are viewing this topic.

Offline Mehis

  • ****
  • Posts: 400
  • Gender: Male
  • lolbai
  • Respect: +88
Optimization for newbies
« on: January 07, 2012, 03:28:00 AM »
+10
Piece of advice before starting to read this.

If something doesn't work, don't give up. Optimization is part of mapping, what you want to learn. Without, people will complain about the lag. Which usually comes to removing your map or fixing it by decompiling, which makes it even worse.

Func_detail

Func_detail, is a brush entity, which doesn't counter with vis leafs. You could imagine it as it was not there. You can see through it, but not go through it. Like invisible wall, without being a wall.

Here is an example of func_detail and a world geometry.

World geometry (left), Func_detail (Right)
Those boxes, corners highlighted with blue lines are leafs. They show what you can see and what you can't. Lets say there is a prop other side of the room, but you cannot see there. But, it doesn't mean the leaf you are IN can see it. If the leaf cannot see it you are in, neither do you. This is already calculated when you compile your map, that's why it's important to keep your map clean.

Obviously the left one is bad. This is because it tries to calculate what player can see on those little leafs. This will result in compile log error WARNING: Cluster portals saw into cluster (usually). It basicly says, that there are too many leafs clustered together. In-game this usually causes huge fps drops, invisible walls, etc. Even problems, which doesn't have to do anything with the leafs. If you don't get this error, it doesn't mean your map can have these mistakes. VVIS (The leaf calculating program.) would take longer to compile your map. (No, VVIS does not compile your map. There are two other programs, which does own sections of your map.)


Here, you have made an 90 degree arch. If you would now compile it without turning it into func_detail, it would take longer time to compile.
You could turn it as it is to func_detail. But, i'd rather do this: Taking the whole arch apart and make each section of it func_detail.
Press Ctrl+U. It ungroups the arch to their own smaller sections. Like this:

Now, simply click each section and press Ctrl+T. This creates brush entity. Select from the dropdown list func_detail. Repeat. (No, you don't have to press Ok or anything to apply this.)
If you want to move it around like arch again, select all the section and press Ctrl+G. It will group them back together.
The main point is to func_detail every single brush on it's own.

This next picture, is a demonstration what you should func_detail and what not.

Everything small or complicated should be func_detailed. Small slopes like this is usually func_detailed. However, if the slopes are big enough to block player's view, you can leave it as world geometry.

Func_detail these.
· Stairs
· Slopes
· Small geometry
· Complicated geometry
· Pillars, supporters, etc.
· Thin brushes

These you MUST func_detail. (func_detail is like every other brush entity. Other entities like func_brush, func_illusionary, too doesn't counter with leafs. If you want to make them func_brush for an example, it will act like func_detail. Func_detail is just the cheapest version of all of them.)


More examples:
Spoiler (click to show/hide)

Read more about func_detail in this link: https://developer.valvesoftware.com/wiki/Func_detail

Fade distance

Fade distance is the most easiest part of optimization. With fade distance, all props (Some entities. This includes, weapons, healthstations, etc.) fades away. This means that the prop isn't rendered anymore in certain distance.

Simply go into prop's properties and choose your fade distance.


600-1000 indoors
1000-3000 outdoors
You'll just have to experiment and find the right one.

Helping VVIS

In this section, you'll have to use your brain and know something about HINT and SKIP textures. Skip, like the name, is nothing, skipped. It doesn't do anything. It's not rendered. When map compiles, all faces with SKIP gets removed completely (You cannot use SKIP texture like nodraw. E.g, for optimization purposes). They aren't there anymore. Hint however, 'blocks' leafs from going through it. It cuts them into own seperate pieces.


Lets say you compile your map, you use mat_wireframe 3, but you can still see the barrel from the other side of the wall. This means, that the leaf you are in, can see the leaf where the barrel is. You don't want it to do that.

You fix the problem, by adding a SKIP textured brush like in the picture and making one of the sides HINT texture.

Imagine it as a wall, you can't see it and you can go through it.

If player can go over the wall, you just put another one like this. Imagine it as a ceiling, you can't see it and you can go through it.

Now the 'player-leaf' can't see the 'barrel-leaf'.

This doesn't mean, that the leafs must be blocks. This is perfect example.

The players cannot see each other, until one of them steps inside the hint brush.

Areaportals

Areaportals are used to block player's view to the other side of the areaportal. They are usually placed on doors, windows, small cracks, etc. The engine in-game calculates what player can see and what not.
Just make a brush size of the door and texture it with areaportal texture. Ctrl+T and from dropdown list select func_areaportal. Make sure that initial state is closed. (If the door is closed.)

Here is an example. We could simply put an func_areaportal on the door, but OH NO! There is a gap in the wall! If we would compile the map without fixing the gap, it would crash the game. That's why there is func_areaportalwindow for the gap.
(Imagine the void as skybox.)



Now when it's fixed, you can happily play your map.

Example what areaportals do.

When the door is closed, both barrels aren't rendered for the player. When the door is opened, player can only see the white barrel. If the player moves more to the left, the brown barrel would be rendered eventually. Cool isn't it?

Occluder

Occluder is mostly used when you cannot use areaportals. It calculates, if the player can see all the content what's inside it.
Pretty much works like areaportal. Make a brush bigger than the model, use occluder texture on it. Ctrl+T, func_occluder.

Example:

Even, if the leaf where player is standing can see the leaf where the prop is, engine calculates, if the player can see it or not. In this picture can't.

Others

Connecting walls like this, optimizes your map too. It saves one face from rendering. It might not sound much, but it makes the map more clean.


Nodraw. Simple as that. Apply nodraw texture on every face where player can't see. This includes unreachable places such as roofs and skyboxes.

I would appreciate a sticky. Ask any questions about optimization.

Finish time: 2 hours and 21 minutes.
« Last Edit: January 07, 2012, 03:53:26 AM by Mehis »

Offline jimonions

  • the text below is true
  • *****
  • Old Forum MemberWindows User
    View More Badges!

  • Posts: 822
  • Gender: Female
  • the text above is not true
  • Respect: +589
Re: Optimization for newbies
« Reply #1 on: January 07, 2012, 03:55:44 AM »
0
stickied

The last one with the 2 walls connecting is critical in larger maps. that one face is gonna save your stuff.
But for smaller maps I like to ignore it because Im very lazy and cant be bothered to enter vertex edit mode.

(JBanned) .:RND`=- DJ myppl8: if i eva become supa admin id ban moo and make hima guest

Offline Tezuni

  • *****
  • Posts: 618
  • Gender: Male
  • Respect: +162
Re: Optimization for newbies
« Reply #2 on: January 08, 2012, 11:23:16 AM »
0
well i only knew about nodraw and area portals, this is quite helpful.

Offline Deacon

  • The righteous rise, with burning eyes
  • ***
  • DonatorDWO Player
    View More Badges!

  • Posts: 4482
  • Gender: Male
  • of hatred and ill-will
  • Respect: +1788
Re: Optimization for newbies
« Reply #3 on: January 08, 2012, 11:29:53 AM »
0
I've read through the developer wiki several times (but lack the patience to map) and this is something I had never seen (nor i suppose bothered to have checked). Very good work. Add to the rnd wiki.

Offline ursus

  • ***
  • Linux UserCat LoverWindows UserOld Forum Member
    View More Badges!

  • Posts: 4393
  • Gender: Male
  • drunkposting is the music of the soul
  • Respect: +1518
Re: Optimization for newbies
« Reply #4 on: January 18, 2012, 06:32:17 PM »
0
This is incredibly helpful, and you deserve a lot more credit for this than you're getting. Thanks.

Offline WarEclipse™

  • **
  • Posts: 85
  • Gender: Male
  • Hello, I'm WarEclipse.
  • Respect: +4
Re: Optimization for newbies
« Reply #5 on: January 24, 2012, 04:15:22 PM »
0
stickied

The last one with the 2 walls connecting is critical in larger maps. that one face is gonna save your stuff.
But for smaller maps I like to ignore it because Im very lazy and cant be bothered to enter vertex edit mode.

 :trollface:

Offline Shawn

  • ******
  • Windows UserOld Forum Member
    View More Badges!

  • Posts: 2675
  • Gender: Male
  • IGM: Shawn /Steam ID: Shawnchapp
  • Respect: +373
    • The Vault
Re: Optimization for newbies
« Reply #6 on: January 25, 2012, 08:33:24 AM »
+1
This is incredibly helpful, and you deserve a lot more credit for this than you're getting. Thanks.

I agree http://wiki.randomgs.com/index.php?title=Optimization_for_newbies

(Didn't have time for editing so if someone would like to feel free to do so, Also Mehis you have some broken links.

Offline Mehis

  • ****
  • Posts: 400
  • Gender: Male
  • lolbai
  • Respect: +88
Re: Optimization for newbies
« Reply #7 on: January 25, 2012, 10:24:09 AM »
0
I agree http://wiki.randomgs.com/index.php?title=Optimization_for_newbies

(Didn't have time for editing so if someone would like to feel free to do so, Also Mehis you have some broken links.

Broken links? That's weird.
I noticed how much fail I was by adding so many ,'s.

Spoiler (click to show/hide)

Offline Shawn

  • ******
  • Windows UserOld Forum Member
    View More Badges!

  • Posts: 2675
  • Gender: Male
  • IGM: Shawn /Steam ID: Shawnchapp
  • Respect: +373
    • The Vault
Re: Optimization for newbies
« Reply #8 on: January 25, 2012, 12:08:29 PM »
0
Broken links? That's weird.

Mhmm some of the pictures are missing (Or it's just my fail computer refusing to load them.)

Offline Deacon

  • The righteous rise, with burning eyes
  • ***
  • DonatorDWO Player
    View More Badges!

  • Posts: 4482
  • Gender: Male
  • of hatred and ill-will
  • Respect: +1788
Re: Optimization for newbies
« Reply #9 on: January 25, 2012, 04:59:53 PM »
0
Spoiler (click to show/hide)

But your drivers...the best.

Offline Monorail Cat

  • "We do these things not because they are easy, but because they are mlg pro" -JFK
  • *****
  • Windows UserDonator
    View More Badges!

  • Posts: 913
  • Gender: Male
  • PANZERKAMPHWAGON SCHADENFREUDE
  • Respect: +503
Re: Optimization for newbies
« Reply #10 on: November 24, 2012, 06:17:02 PM »
0
I really like your help, it's very... Helpful.  But, I have a question. 

This doesn't mean, that the leafs must be blocks. This is perfect example.

The players cannot see each other, until one of them steps inside the hint brush.

How do you know the correct angle to place that hint/skip?


Offline jimonions

  • the text below is true
  • *****
  • Old Forum MemberWindows User
    View More Badges!

  • Posts: 822
  • Gender: Female
  • the text above is not true
  • Respect: +589
Re: Optimization for newbies
« Reply #11 on: November 24, 2012, 06:38:27 PM »
+1
it can be at any angle you want but 45 degrees is optimal in most situations.

(JBanned) .:RND`=- DJ myppl8: if i eva become supa admin id ban moo and make hima guest

Offline Travelsonic

  • *****
  • Posts: 743
  • We're gonna need a new obstacle course...
  • Respect: +78
Re: Optimization for newbies
« Reply #12 on: May 27, 2013, 09:54:35 AM »
0
Why the fuck didn't I +1 this thread before?  :D
lim ( Δ :trollface: -> 0 ) (:trollface: + Δ :trollface:)² + :trollface: = :trollface: