thehankinator Posted November 18, 2015 Share Posted November 18, 2015 I'm having trouble fixing a performance issue in my game (House of Pain). Seems like everything is fine (~60fps) until I spawn an enemy. Then it drops to 30fps. In my AI script I've commented just about everything (UpdateWorld, UpdatePhysics, Draw, etc) so I don't think that is the problem. On the enemy I set Cast Shadows to None. I've played around with the Collapse function on the model but the model is no longer visible when I collapse it. I don't know how to interpret the statistic information that well, I don't think my batches are unreasonable. I don't have any post processing effects (that I am aware of). I've tried disabling all lights except ambient but appeared to make no difference. Does anyone have an idea what else I can look at that would cause such a big hit to performance? Thanks Quote Link to comment Share on other sites More sharing options...
Gonan Posted November 19, 2015 Share Posted November 19, 2015 There is some tuning that can be done in the monsterai.lua functions.each alive monster looks for targets and selects the closest. But instead of searching a big area for all targets , start with a smaller area and if you find a target or many, just chose one. If you don't find a target repeat for a bigger area. When there are lots of monsters in the world the finding of an enemy is much quicker and more relevant. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted November 19, 2015 Author Share Posted November 19, 2015 There is some tuning that can be done in the monsterai.lua functions.each alive monster looks for targets and selects the closest. But instead of searching a big area for all targets , start with a smaller area and if you find a target or many, just chose one. If you don't find a target repeat for a bigger area. When there are lots of monsters in the world the finding of an enemy is much quicker and more relevant. Thanks for the advice. In this case though I've disabled all the update functions in my AI script so I don't think it's an AI problem. Quote Link to comment Share on other sites More sharing options...
Josh Posted November 19, 2015 Share Posted November 19, 2015 It could possibly be physics calculations if you have a lot of high-poly physics shapes. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
thehankinator Posted November 19, 2015 Author Share Posted November 19, 2015 It could possibly be physics calculations if you have a lot of high-poly physics shapes. How many polygons is a lot? Quote Link to comment Share on other sites More sharing options...
thehankinator Posted December 10, 2015 Author Share Posted December 10, 2015 I had two problems going on. I fixed one of them and now I have narrowed this issue down to Follow(). If I reduce my level to nothing but flat plane, the performance issues go away. What kind of things could be making Follow so expensive? Quote Link to comment Share on other sites More sharing options...
Rick Posted December 10, 2015 Share Posted December 10, 2015 Are you calling Follow() every frame? Not sure but if that could cause an issue but might want to check that out. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted December 10, 2015 Author Share Posted December 10, 2015 Are you calling Follow() every frame? Not sure but if that could cause an issue but might want to check that out. Nope, only calling Follow once. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted December 20, 2015 Author Share Posted December 20, 2015 I've cut down to bare bones now. I compared the zombie to a crawler. The crawler runs at 60fps but the zombie slows down to 30fps. They have the same script so it seems to indicate that there is some difference between the artwork. I checked the settings on the materials for both models, they are the same. What settings on the model or materials could cause such a difference? I'd upload the project but I don't think Josh would want me to upload the zombie/weapons DLC. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 20, 2015 Share Posted December 20, 2015 Bone count? I think each bone becomes an entity and LE doesn't seem to do well with a ton of entities. 2 Quote Link to comment Share on other sites More sharing options...
shadmar Posted December 20, 2015 Share Posted December 20, 2015 What happens if you do the zombies mdls only, no prefab with script attached? Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
thehankinator Posted December 20, 2015 Author Share Posted December 20, 2015 Bone count? I think each bone becomes an entity and LE doesn't seem to do well with a ton of entities. Are the bones the subchildren in the entity hierarchy? If so the zombie definitely has more bones than the crawler. What happens if you do the zombies mdls only, no prefab with script attached? I dropped the models in with the script attached, still run at 60fps. Then I created a prefab of one of those models and loaded it at runtime, 60fps! I set all the bones (what I think are bones anyway) to prop (so the bullets would hit the zombies) and still 60fps! I noticed that the original prefab has entries in the hierarchy like "hitbox_lthigh" but the model does not. All the hitbox_* elements have their collision set to none. Where would those hitbox_ elements come from? It's the DLC so I couldn't have opened the .mdl file and messed around with the file at all. I checked the other zombies from the DLC it's the same thing, prefabs have hitbox_ entries but not in the models. I cannot delete the hitbox_ entries with LE editor so I cannot know if that is the problem. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted December 24, 2015 Author Share Posted December 24, 2015 After changing the zombie prefab I am noticing that the framerate drops to 30fps for about 10 seconds after shooting over the head of the zombie(same with crawler but not as bad). Seems like it has to do with the World:Pick in FPSGun.lua, doesn't make sense that it continues to drop the FPS for 10seconds or so afterward, not should that call be that expensive right? As a sanity check I ran the First Person Shooter tutorial with no modifications at all. Seems like I am hitting 30fps pretty often. So maybe I am just chasing my tail here? I have a Radeon 6870(by no means a high performance card anymore) but I know the scene in the tutorial is far less complicated than say something like Killing Floor 2 (which runs fine). So what's the deal? AMD's implementation of OpenGL? Leadwerks Engine? Something else? I took some screenshots from the tutorial, does anyone else see fps drop in the same places? Garage flashlight on: At the control panel, flashlight OFF, did not yet activate control panel: Quote Link to comment Share on other sites More sharing options...
Josh Posted December 24, 2015 Share Posted December 24, 2015 It would be interesting to see a side by side comparison of those two models. If you just upload the map I can install the DLC and open the map. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
thehankinator Posted December 24, 2015 Author Share Posted December 24, 2015 It would be interesting to see a side by side comparison of those two models. If you just upload the map I can install the DLC and open the map. Download here: https://drive.google.com/file/d/0B8AlYY49_v2bdm0wWmctVm1sRVU/view?usp=sharing I deleted the Addon directory from the zip, hopefully that doesn't mess it up more than it already is. Try commenting/uncommenting the different prefabs starting on line 35 in Scripts/Game/Survival.lua. Also try shooting over the heads of the crawlers, the framerate drags for about 10secs after each shot. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 24, 2015 Share Posted December 24, 2015 Ah, I actually DO know what's going on here. If any decals are present, the renderer performs a blit on an extra buffer in order to render to allow decals to render to the normal component of the gbuffer. If a single decal is onscreen, this rendering pathway is used, otherwise the extra step is skipped. On my machine there is a very small decrease in speed while any decals are visible (~5%) but it might be worse on other hardware. You won't see much of a hit for each decal (unless you use a lot) but it's just a matter of whether any are onscreen at all, since the renderer can not read from and write to a texture simultaneously. I bet if you comment out the decal creation code in the FPSGun script this will go away. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.