betostafe / castlesand

Automatically exported from code.google.com/p/castlesand
0 stars 0 forks source link

Rendering from VBO #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What about moving the rendering to VBO or the Draw Arrays at least?
It would boost FPS majorly and it's not so hard to do it.

Original issue reported on code.google.com by lucjansu...@gmail.com on 6 Nov 2011 at 6:35

GoogleCodeExporter commented 9 years ago
First of all, current FPS is limited to 30 to reduce GPU load, but in fact the 
game only needs 10fps, as the games logic is being updated at that pace. So 
first measure would be to switch to event-base render (once logic stepped -> 
render), that would ease up load on GPU.

Next, with our current settings the majority of load is on Terrain (updating 
all the tiles, calculating tiles/vertices revelation and HitTesting for units 
~=40% of all), so there's no bottleneck in rendering.

Concluding: Even with current not optimal render the average GPU is not the 
bottleneck, hence the optimization is required in some place else.

Outcome: We are open to contributions and if someone wants to rewrite our 
rendering to VBO or DA or DL - he/she is welcome, but that won't give any 
noticeably effect on performance. It would be better to optimize Terrain 
access, prebuffer FOW and multi-thread what is possible.

Thanks for your suggestion though, it's nice to see people care about the 
project! :)

Original comment by kromster80@gmail.com on 7 Nov 2011 at 8:04

GoogleCodeExporter commented 9 years ago
I'd just like to add that when I turn the FPS limiter and VSync off my 
mid-range GPU renders the game at 130-200 FPS :P So rendering really isn't a 
big issue as Krom said.

If you zoom out it is possible to make the rendering slow down, I find this 
usually occurs when there are 1500 - 2000 sprites on screen at once, and that 
is a LOT so I don't blame it for lagging. An example is the multiplayer 
Bannockburn. There are thousands of terrain objects on the lower half of the 
map, so at 1920x1080 and 2000 sprites I only get 20 FPS... which is still 
faster than the game speed so it doesn't matter much. 4000 sprites and I only 
get 10 FPS.

If we move to a nicer scaling algorithm for zooming out (so the shadows and 
water look nicer) then we might need rendering optimisations. But for now it's 
fine.

As Krom said if you or someone else would like to write it like this then 
please feel free

Original comment by lewinjh@gmail.com on 8 Nov 2011 at 2:06

GoogleCodeExporter commented 9 years ago
I do agree though - 4000 sprites at 10fps is far from great, but the game is 
not meant run in these conditions. The zoom feature is a nice "bonus".

Original comment by kromster80@gmail.com on 8 Nov 2011 at 5:30