Jump to content
Phodex Games

Performance Issue

Recommended Posts

Hi there,

 

I am wondering if I am doing something wrong, or if I expect too much from Leadwerks...

I built a small medivial house, just to play around. Soon I recognized that I got trouble with perfromance, very low FPS in Debug and normal run mode. So I started testing Leadwerks Performance a bit. I dont have experience with other engines, Leadwerks is the first I get my hands on. Well to move on, I rebuilt the whole house, creating models with less polygons and I also disabled most of the shadows.

 

I posted a view screenshots where you can see my poly count and fps rate. I dont really understand why its lagging. Even if I just place a single house I get only 30 FPS. Ok the textures need some optimization but about 500 MB memory usage in summary isnt that much, even if its much for those few houses. I am a bit disappointed. How should I ever create a livley city when the performance is that bad?

 

I searched the web for what poly counts are common and found out that 10k polygons are ok for a detailed character, for a prop its suggested to be 500 -1.5k. So 7k for a whole house really isnt much. So am I doing something wrong? huh.png Because I cannot believe Leadwerks performance is that bad. dry.png

 

I need to add that if I decrease the resolution of my project to standart (something like 1024 x 768) it runs smoother, but for the city map I still get FPS drops and a maximum of 30 - 40 FPS which is not optimal. But still it needs to run smooth on a 1920 x 1080 resolution! I also want to add that If I activate static shadows for all the props build around the house (Planks, Lamp, Windows, etc.) the framerate is like hell. I dont think I can do something so wrong with just a single house and some textures, but I am glad if I am wrong happy.png

 

A few more Infos:

 

- I dont use any extra shaders

- there are two point lights per house

- I set the screen resolution to 1920 x 1080

- even if I export the game and run it I get 20 - 30 FPS (for the "city" map)

- My specs: Intel Core i5-3570K CPU @ 3.40 GHz, 8 GB Ram, Windows 7 64 Bit, Nvidia Geforce GTX 960 4G (4 GB Vram)

- I use specular and normalmaps for all textures

- The houses dont have an interior

 

I really appreciate if you are able to help me. If you need some more info please tell me. I just want to make a awesome game... rolleyes.gif

post-17271-0-68360100-1464283100_thumb.jpg

post-17271-0-43407100-1464283120_thumb.jpg

post-17271-0-39588200-1464283132_thumb.jpg

post-17271-0-03582000-1464283145_thumb.jpg

Share this post


Link to post

Well your graphics card looks ok. I am getting a steady 60 fps from a level with 8 buildings and a terrain sized 512 by 512. I have the screen set at 1024 by 768 Fullscreen. I have only one spotlight so far but there will be many more. pointlights can be heavy on fps.

Most of my textures are 512 by 512 with a couple at 1024.

Share this post


Link to post

I recommend posting your project so others can try it. I don't see anything out of the ordinary except your framerate.

Share this post


Link to post

First of all thank you for your replies smile.png.

 

So after my last post I was able to fix some issues myself, but I still have problems with the performance. In my playerscript the multisamlpe mode was set to 16, decreasing it to 1 fixed my problem with the high video memory usage. Now I just have 70+ MB and it also improved my performance. With a single house I get my 60 FPS. But If I build, like 16 houses, I get massive FPS drops, lags an bad performance at all sad.png. I also tried to decrease my poly count but this didnt brought a improvement aswell.

 

I will add some more screenshots.

 

@cassius

I have a maximum of 10 active pointlights in the town scene. My textures for the brushes are 512 x 512 and most textures for models are 1024 x 1024.

 

@Thirsty Panther

Thank you will give that a try if I have some time.

 

@Josh

I will create a project I can share with the others, but it can take a few days.

 

@reepblue

Thank you aswell will take a look at it smile.png

 

So that is my current state. Furthermore I want to ask what the limitations of leadwerks are. Maybe you can tell me Josh. I you do everything right, are you able to build a city as big as in games like Skyrim or Oblivion? Whats the limit? I am very interested in this how capable Leadwerks is.

 

Thank you all for your help.

post-17271-0-51579100-1464779194_thumb.jpg

post-17271-0-85053600-1464779199_thumb.jpg

Share this post


Link to post

I have never played a game with hundreds of buildings but I would imagine some of them are not models but just background drawing like hills in a skybox.

Share this post


Link to post

Check the program log in the editor and confirm the Nvidia card is being used and not the Intel graphics. The performance you describe is reasonable for integrated graphics, but not a GPU.

Share this post


Link to post

I have never played a game with hundreds of buildings but I would imagine some of them are not models but just background drawing like hills in a skybox.

 

Yeah, but 16 buildings like that shouldn't have any noticeable performance drop, especially with a video card like his.

 

 

 

In your Nvidia control panel, do you have 'triple buffering' or any settings like that enabled? I'd start by trying to restore default video card settings through the Nvidia control panel.

 

I remember I had some really bad performance issues with my Leadwerks games, then I found out it was just some dumbly modified settings. Similiar issue too, everything was fine except FPS.

Share this post


Link to post

@Josh

That is what my log says:

Syncing Workshop Items...

Initializing OpenGL4 graphics driver...

OpenGL version 450

GLSL version 450

Device: GeForce GTX 960/PCIe/SSE2

 

So I think my GTX 960 is the active graphic device.

 

I think what Crazycarpet wrote fixed my problem. I am not 100 % sure if the performance is alright now. In the first 10 - 20 seconds after I run my project I still get some fps drops and lagging but after a while I have constant 60 FPS. This is great smile.png, but I still am a bit sceptic. Maybe my eyes fool me but I seem to see micro framedrops, this may happen because my project was lagging all the time and I just think it lags...

Well the future will show, when I added more assets and build a real small town.

 

But what was the exact problem now??

 

I will also post a link where you can download my project, containing my "city". Because I would like to see if it runs smooth on other systems aswell now.

 

Grab it here: https://www.dropbox.com/s/kp5079mxejfmwse/ShareProject.zip?dl=0

 

P.S.: I dont know if it is normal but in Debug mode I only get 20 - 30 FPS. The 60 FPS I was talking about are in normal Run mode.

Share this post


Link to post

Performance in debug mode is pretty much meaningless. It will always run slow in debug mode.

Share this post


Link to post

Yeah, I don't know. I'll look more into it later out of curiosity because I'm on a GTX 970 and even in release mode I get the odd big lag spike. Very simple scene...

 

Edit: Just noticed that this tiny little scene has 674 entities, that's a lot of entities for such a simple, small scene.

You should read what Panther suggested: http://www.leadwerks.com/werkspace/topic/13854-performance-question/

 

I'd recommend collapsing your houses into one model, so hundreds of entities aren't created for each house.

- If you have a lot of modular pieces, I would advise to combine them in your modeling program and export that. Piecing modular bits together in LE will create too many entities. If you export with all separate modular entities, this is where the collapse feature will shine and turn them into one entity.

Share this post


Link to post

I get steady 60fps until I get outside the city and everything is in the scene, then it drops to steady 30fps. I think it might be due to vertical sync. If I just missed a vsync the system will wait as long as 16.6ms(assuming 60hz) for the next vsync. If I disable vsync I get about 53fps (dipping to ~48fps every now and then). FX 8120 and R9 380.

vsync on

l9tRJNP.png

 

vsync off

RAAK6YQ.png

Share this post


Link to post

I get steady 60fps until I get outside the city and everything is in the scene, then it drops to steady 30fps. I think it might be due to vertical sync. If I just missed a vsync the system will wait as long as 16.6ms(assuming 60hz) for the next vsync. If I disable vsync I get about 53fps (dipping to ~48fps every now and then). FX 8120 and R9 380.

vsync on

 

Even with VSync off it has spikes when everything's rendered, I'm fairly certain it's because it's handling most of 674 entities at once.

I think if he takes snapback.pngtjheldna's advice and exports those houses that are made up of hundreds of pieces into one model the performance issues would be fixed.

 

Although I've had issues with VSync in the past so I wouldn't be surprised if it was playing a role.

Share this post


Link to post

Ok thanks for all the help I think this will fix my problem. I once read that CSG brushes are better for performance than Models. Thats why I created a mixture of both. CSG brushes and some props I add to the Brushes. Well will try that out. I actually prefer to make a house just as a single model, this makes it easier for me smile.png. Thank you all again.

 

P.S.: Stupid Question: How to disable Vsync in Leadwerks?

Share this post


Link to post

UPDATE: I merged all the models and made a single house model and it runs waaays smoother now. I am not done with the texturing yet, but I think the merging helped a lot. I attached a pic with much more houses than before and runs with smooth 60 FPS even in debug mode, thats awesome.

post-17271-0-37128700-1464875900_thumb.jpg

Share this post


Link to post

At this point I don't see anything wrong with your map. I am also confused about the performance because my Intel integrated graphics are getting 20-30 FPS, which means your card should be much faster.

 

You also don't have any point lights in the shot above, so I would take your original map, hide all point lights, and measure the difference. You do have a lot of them in there, but most are being culled by the occlusion system.

Share this post


Link to post

To disable VSync open your Main.lua file and scroll down to your App:Loop () function, in that function you'll see context:Sync (true), change ot to context:Sync (false).

 

Josh, i'm fairly certain his performance issues were caused by most of 647 entities being culled, then all of them being rendered the next frame when most of the scene comes into view. Theres no way you didn't get serious spikes on your Intel on board. I got them on my GTX 970. Nothing too crazy but definitely some very noticeable lag spikes you shouldnt get in a scene that size, unless of course it has hindreds of entities in suxh a small space.

 

I tried the map without poont lights, same issue.

Share this post


Link to post

If you unparent the entities and set the small objects' view ranges to near, the scene manager will skip those objects when they are far away without ever even iterating through them. You could do this in code in a step after loading the map if you wanted.

 

647 is rather a lot to have all in the immediate vicinity. The Zone had about 2000 entities I think, but they used distance culling so there was never that many immediately around the player.

Share this post


Link to post

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.

×
×
  • Create New...