Jump to content

- - - - -

Performance: GC is being made on a potato.


goblinson crusoe hex tile-based rpg performance
4: Adsense

Performance: GC is being made on a potato.

I haven't posted about GC in awhile. I have done work (most of it regarding the combat system) but a lot of the work is still "on paper" as opposed to "in the game".
The performance of the game has been a concern of mine for quite some time now. Granted, my dev machine is not a powerhouse. In truth, it is the polar opposite of powerhouse, unless your definition of "powerhouse" is "HP laptop from Costco with the finest integrated onboard Intel graphics." If that's your definition of powerhouse, though, you have worse problems than I do.
Anyway, the performance is crap. I mean, really. It's crap. I added the grass model you see in the shot above, and my framerate plunged to, like, 11. Sometimes 8. (This is in borderless full-screen, so 1366x768 on my lump of clay.) As you can imagine, testing out combat configurations and systems at these rates is frustrating, so often I'll disable vegetation and replace the hex tile material with plain white when testing that stuff. Still, in the back of my mind lurks the thought that it just isn't performant enough. People with roughly my system specs should be able to play a game of this level of graphical fidelity, and expect at least a somewhat decent level of performance.
I had fastcall22 do a test on his computer, and he said he was getting a pretty consistent 144 fps at 2560x1440 resolution. He's got a Nvidia GTX 1070 card. So, right now, about the best I can say is that depending on your system specs, you can expect somewhere between 5 and 144 fps playing my game. That's just... I don't know. Kinda scary.
What's the thought on ignoring shitty laptops from Costco with integrated Intel graphics? I mean, I know they're garbage. But still... 5 fps, on a machine purchased in 2015. Thoughts?
The alternative would be to scrap the quad-planar tile material and use traditional models, but everyone I talk to (including myself; yes, I talk to myself) likes the quad-planar tiles. They're kinda cool, and certainly unique. I don't really want to give them up. But if it comes down to that, or fielding a shitload of complaints about crappy performance, then I'd say I need to do what I have to. Assuming this thing ever releases, anyway, which given my glacial pace of development is looking highly doubtful.

Mar 30 2017 06:21 AM

The important lesson here imo is in future to be thinking about performance from the start, and as you go, and constantly monitoring as you add new features. The best way to work imo is to design according to your target platform, not design and then 'hope for the best' (many products have sunk this way). Consider not only average frame rate, but also frame spikes which could cause dropped frames.

That said :) , what is your target platform and graphics API? I'm guessing PC, which may mean you have more tricks available than if you were say, targeting OpenGL ES 2.

If you have access, try out a graphics debugger program to gain more info on what is bottlenecking and causing frame spikes. If you don't have this, try running the game with a very low resolution to see whether you are fill rate limited. If you are fill rate limited do what you can to reduce this .. e.g. optional simpler fragment shaders etc. If it runs slow even at low resolutions, look at how many draw calls you are making, how you are batching things, how you are optimizing static scenery, how complex are your vertex shaders / models, what method are you using for animation etc.

And it almost goes without saying of course profile profile profile for all the CPU stuff.

/edit - I just had time to have a quick look at it seems as though you say are using some kind of LOD system already. If your doing a lot of texture blending for the tops of hexagons, can you cache the results in a terrain texture for the tops? And obviously you only need low mipmapped versions in the distance. For the goblins, you could use different textures for the different types / selected ones, it could be faster, but that totally depends on the shader you are using. For distant goblins I'd look at precalculating say 20 frames of animation, and playing them directly stop frame style rather than doing any skinning / tweening on the fly, again using LODs. Or you could look at imposters (maybe for the grass too?). For the hexagons maybe you can combine the geometry and render in one go if you aren't already. It is not going to be super easy given the view distance, unless you add in some limitations like only allowing the viewer to look down at a certain range of angles, or have aggressive fog in 1st person type view.

Mar 30 2017 09:52 AM

The important lesson here imo is in future to be thinking about performance from the start, and as you go, and constantly monitoring as you add new features. The best way to work imo is to design according to your target platform, not design and then 'hope for the best' (many products have sunk this way). Consider not only average frame rate, but also frame spikes which could cause dropped frames.
That said :) , what is your target platform and graphics API? I'm guessing PC, which may mean you have more tricks available than if you were say, targeting OpenGL ES 2.
If you have access, try out a graphics debugger program to gain more info on what is bottlenecking and causing frame spikes. If you don't have this, try running the game with a very low resolution to see whether you are fill rate limited. If you are fill rate limited do what you can to reduce this .. e.g. optional simpler fragment shaders etc. If it runs slow even at low resolutions, look at how many draw calls you are making, how you are batching things, how you are optimizing static scenery, how complex are your vertex shaders / models, what method are you using for animation etc.
And it almost goes without saying of course profile profile profile for all the CPU stuff.


I already know the main source of the performance hit. It's the quad-planar hex tile shader. Substituting for the simpler one that just uses a texture-mapped model, I get plenty of framerate back (a solid 60 on my machine, which, really, no game I play gets any better than that.) It's just that damned shader is so heavy.

The shader uses a texture array of 8 different textures: 4 variants for the top of the tile (for grass, dirt, sand, etc...) and 4 variants for the sides (to mimic cliffs and whatnot). It uses a second array for normal maps. It projects textures along 4 axes: from the top, and 3 axes that are perpendicular to the 6 sides of the hex, in order to minimize the blending artifacts that traditional tri-planar projection causes on a hex.

That means that for each fragment I perform a total of 33 texture samples. I sample once on the blend map that determines terrain placement, then I sample 16 times (4 projection planes times 4 terrain types) for the diffuse component and 16 times for the normal maps. Then I blend all those samples together using blend factors calculated from the normals. It's a pretty complex shader, as far as fill-rate is concerned.
Mar 30 2017 10:20 AM

Ahh I get you, yeah then I would be looking into caching the results of the blending if you can. Don't give up though, you've obviously put in a lot of work, and it looks nice, so enjoy optimizing it! :D

Mar 30 2017 01:52 PM
Discovered a funny thing while trying to fix an issue with running the game on eppo's computer. If I set compatibility mode to Windows 7 instead of 8, I get back in the neighborhood of 15 to 20 fps. Takeaway: Windows 10 suxors.
Mar 30 2017 08:09 PM
Alright! I got the high score !!
Mar 31 2017 02:52 AM
I've gotten some more information from eppo. He's getting around 40-ish fps on what he describes as a 'crappy' old CPU and a GTX 1050 Ti.

I'm feeling slightly better about things. The thing is, we all know most integrated Intel is crap for gaming. That's not a huge secret. I'm feeling better about putting less weight on my own performance specs now.

However, this has indicated to me that I need to get a build of this game into more peoples' hands, sooner rather than later. The build I had fastcall22 and eppo try is nowhere near where current development on GC is, though, since I needed to get something functional and fairly non-weird (current dev branch is... funky) together.

Note: GameDev.net moderates comments.