Jump to content
The Dark Mod Forums

Avoiding sudden framerate drops


grayman

Recommended Posts

On my (old) computer, any framerates above 10 are relatively smooth. I can get up into the 60s from time to time, but on the other hand, I can also suddenly drop to 0.

 

I have two areas in my vert map that I'm battling with at the moment. I've made as many brushes into func_statics as I can, added as much visportaling as makes sense (it all works), but when I initially enter these areas via doors, the framerate drops to zero when the doors' visportals open. Both areas involve skyportal textures; one area has drizzle rain and the other has heavy rain splashes on a glass ceiling (no rain, though).

 

On my computer, dropping to 0 FPS is the kiss of death. It can sit at 0 for a while as I slowly move around, but if I ever get the FPS back up (by going into a corner, say), it stays up and I can leave by the entry door, shut it, turn around and open it again, walk all around, and FPS stays up in my normal 10-20 range.

 

So my question is: when entering a new area for the first time, are there ways to keep the framerate up, i.e. preloading textures, blah blah? What is the engine doing differently when you enter an area the first time as opposed to entering it the same way later?

 

Thanks.

Link to comment
Share on other sites

You might place indoors out of sight a tiny set of brush faces textured with outdoor textures but I've not tried that idea. The idea being of course that most of those outdoor textures get loaded into memory before opening the door so hopefully not such a big impact all at once.

 

On both the rain and splash patches you can add the following properties to help performance:

 

dist_check_period 0.25

dist_check_xy 1

hide_distance 200

 

Adjust the values as you think fit.

 

AI slow down performance even if not present. On AI you can add these properties to improve performance:

 

max_interleave_think_dist 1000

max_interleave_think_frames 16

min_interleave_think_dist 200

 

For some AI you can add:

 

neverdormant 0

 

They will freeze and not think or patrol or do anything when out of sight. It is recommended you only do this on AI where this will not tbe noticeable, perhaps a static sentry. For instance you do not want a player to wait forever for a patrolling AI to pass not knowing he is frozen in another room.

Link to comment
Share on other sites

Also, if you convert brushes into func_statics, combine them into as little func_statics as possible, opposed to having 100 func_static beams. Spawning an entity takes quite a long time, spawing several hundred of them even takes a second on my fast CPU.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Thanks for all the suggestions. (And so fast, too.)

 

I'll start implementing and see what happens.

 

I'm hoping to start beta tomorrow night, but I have a bunch of stuff to complete to hit that. Getting hung up on this performance issue at the last minute wasn't in the plan.

Link to comment
Share on other sites

Also, if you convert brushes into func_statics, combine them into as little func_statics as possible, opposed to having 100 func_static beams. Spawning an entity takes quite a long time, spawning several hundred of them even takes a second on my fast CPU.

Hmmm, so what your saying is if you have a room full of beam brushes, make them into one big FS..?

Link to comment
Share on other sites

I think the rule of thumb is: "If it can't be scissored by a visportal then draw it all at once to reduce batching and draw calls"

 

So I'd say yeah...

 

???

 

The Performance wiki seems to confirm (with caveats):

 

But be careful to use r_showtris = 3 in the console to check the results. It sometimes happens that large func_statics get processed through visportals. For example, an L-shaped room with the ceiling criss-crossing with beams all converted to one giant func_static and all within the portal area sealed by the door. Yet outside one could clearly see all their tris. By splitting the beams into two groups, one in each 'leg' of the L so making two separate func_statics, they were effectively as good and no longer showed outside. So don't be tempted eg, to convert all trim throughout a house into one giant func_static.
Edited by nbohr1more

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Yep, if you can see part of the func_static the whole thing is rendered. Even behind closed door/portal.

 

Also I try to group them, not just lob them all into one func_static.

 

Say if you have a T, 2 beams that touch. Their polys will get cut up where they touch and create more tris. So if you have a bunch of them you get fewer tris by making all the non-touching vertical pieces one func_static and making all the horizontal pieces a second func_static.

 

They onyl cut tris inside their own func_static. So another func_static touching it won't be cut up.

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Yep, if you can see part of the func_static the whole thing is rendered. Even behind closed door/portal.

 

Also I try to group them, not just lob them all into one func_static.

 

Say if you have a T, 2 beams that touch. Their polys will get cut up where they touch and create more tris. So if you have a bunch of them you get fewer tris by making all the non-touching vertical pieces one func_static and making all the horizontal pieces a second func_static.

 

They onyl cut tris inside their own func_static. So another func_static touching it won't be cut up.

 

I just realized this a couple days ago when looking at how one of my complex func_statics was nearly pure white on the screen with all the tris. Since it's high up on a ceiling, I figured eliminating all the places where the brushes touched would help.

 

And it did. You don't notice the 1/2-unit separation between brush faces, and the number of tris dropped considerably.

 

So that's another trick you can use to bring down tris.

Link to comment
Share on other sites

My performance issues are solved.

 

I ended up using the "boxed-in with visportals" method and the "include new textures before you need them" method.

 

There's a slight speedbump when entering these rooms now, but it's certainly not bringing the machine to its knees.

 

Thanks to all.

 

Oh, and I found out that rain falls from the back of rain patches (as does snow from snow patches), so I flipped my rain patches and now that little ascending movement at the spawn of a rain streak is gone. Maybe it helps performance, maybe it doesn't.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 3 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...