|
Glaiel-Gamer
|
 |
« Reply #1440 on: January 17, 2011, 01:12:58 PM » |
|
Tore out all opengl matrix functions on the pc build. It's now 100% shader based using custom uniforms. +100 FPS (1250fps on a "heavier" level on my pc now). Its SO FAST that profile guided optimization makes it SLOWER.
And yet its not fast enough for the console and lower end PCs. MUST... OPTIMIZE... MORE...
|
|
|
|
|
Logged
|
|
|
|
|
Glaiel-Gamer
|
 |
« Reply #1441 on: January 17, 2011, 07:41:50 PM » |
|
realized most of the choppiness seen when the game runs at a lower framerate was the result of my frame rate controller and not any graphical code.
Changed it from "While game isn't caught up, update" to "how many frames do I need to calculate to catch up? update that many times"
Much more consistent framerate now looks so much better.
Really tough to test when my beastly computer has no trouble updating and rendering the game in under a millisecond.
|
|
|
|
« Last Edit: January 17, 2011, 07:47:27 PM by Glaiel-Gamer »
|
Logged
|
|
|
|
|
mcc
|
 |
« Reply #1442 on: January 17, 2011, 08:47:12 PM » |
|
I've had excellent luck just transforming all the geometry I test against so I can look for zero crossings right of the origin. (Storing angles as sine/cosine pairs optimizes this a lot)
Congratulations, you've discovered vectors. Good news is, they are even more powerful than you thought, you very rarely need to use angles as angles any more. Also, you will never ever again find it difficult to average angles
|
|
|
|
|
Logged
|
|
|
|
|
Glaiel-Gamer
|
 |
« Reply #1443 on: January 18, 2011, 02:58:16 PM » |
|
To make testing this FPS stuff easier I added to my normal fps counter: a FPS average / FPS current frame counter (last 1024 frames) a standard deviation counter on collected statistics (in both frames and %) a FPS graph (normalized around the average) super simple to add, gives so much more info about game performance/stability and I recommend everyone do it.  fps dips occur because at this high framerate it doesn't update the game every render (updates at 120hz, renders as fast as possible). Below 120 FPS the framerate stabilizes more.)
|
|
|
|
« Last Edit: January 18, 2011, 03:54:51 PM by Glaiel-Gamer »
|
Logged
|
|
|
|
|
LemonScented
|
 |
« Reply #1444 on: January 18, 2011, 04:48:42 PM » |
|
What profiling tools are you using, Glaiel? And on which platforms?
(EDIT: That reads as me digging to find out what console you're working on, which I'm not. I'm just digging to find out whether or not you are actually doing the profiling on said console, rather than just on your PC)
At the risk of stating the obvious, profiling it and optimizing it on your super-fast PC isn't going to help much. You need to profile a build actually running on the console. And once you've optimized the bottlenecks there, you need to profile it on the low-end PCs that are giving you grief as well.
|
|
|
|
|
Logged
|
|
|
|
|
Glaiel-Gamer
|
 |
« Reply #1445 on: January 18, 2011, 04:53:13 PM » |
|
What profiling tools are you using, Glaiel? And on which platforms?
At the risk of stating the obvious, profiling it and optimizing it on your super-fast PC isn't going to help much. You need to profile a build actually running on the console. And once you've optimized the bottlenecks there, you need to profile it on the low-end PCs that are giving you grief as well.
those graphs and such are my own code (just timing the difference between frames). I have a "test" level on PC which has so many objects in it it drops the fps down to 30 or less. I've been testing it on the console too and the graphs are meaningful enough there too. Everything's normalized around the average fps so it remains meaningful at all levels. fps = 1000.0/(SysTimer()-d_ptime); //d_ptime = double previous time (cause ptime was an int in my earlier version of this code) d_ptime = SysTimer(); fps_history.push_back(fps); //fps_history is a deque<double> if(fps_history.size() > 256){ fps_history.pop_front(); } if(showStats){ double avg = 0; for(int i = 0; i<fps_history.size(); i++){ avg += fps_history[i]; } avg /= fps_history.size();
double deviation = 0; for(int i = 0; i<fps_history.size(); i++){ deviation += (fps_history[i]-avg)*(fps_history[i]-avg); } deviation = std::sqrt(deviation/fps_history.size()); //draw code reduced for this post
ColorStack.setColor(1, 1, 1, 1);
fps_graph.clear(); for(int i = 0; i<fps_history.size(); i++){ fps_graph.pushVertex(i*2+50, 200-(fps_history[i]/avg*100.0-100)); } fps_graph.render(RenderType::LineStrip); }
avg fps on console: 35 deviation: 4.2 (12%)
|
|
|
|
« Last Edit: January 19, 2011, 01:17:50 PM by Glaiel-Gamer »
|
Logged
|
|
|
|
|
st33d
Guest
|
 |
« Reply #1446 on: January 19, 2011, 05:57:31 AM » |
|
Just blended a cannon noise with a certain sample for the boss's slow firing cannon that fires explosive grenades within explosive grenades within explosive grenades. 
|
|
|
|
|
Logged
|
|
|
|
|
Evan Balster
|
 |
« Reply #1447 on: January 19, 2011, 02:08:40 PM » |
|
I've had excellent luck just transforming all the geometry I test against so I can look for zero crossings right of the origin. (Storing angles as sine/cosine pairs optimizes this a lot)
Congratulations, you've discovered vectors. Good news is, they are even more powerful than you thought, you very rarely need to use angles as angles any more. I've actually stored all the rotations in my engine as sine/cosine pairs for at least a year. Realized it after learning a little matrix math. My transform objects presently consist of a vector translation, an angle rotation, and a scalar scale. Non-uniform scaling can go BLOW ITSELF until it becomes too inconvenient not to have and I implement a system that stores irregular scales such that the transforms can still be cumulated into other transforms. (I'm thinking the same scalar value plus a vector whose direction and magnitude define the additional 'longer'-direction irregular scaling) Before you ask why I'm not using matrices and performing complicated refactoring operations every time I want to check or alter an object's orientation independently, kindly consider how BASS-ACKWARDS that is from an API programmer's standpoint.
|
|
|
|
|
Logged
|
|
|
|
|
BorisTheBrave
|
 |
« Reply #1448 on: January 19, 2011, 02:35:50 PM » |
|
I fail to see your complaint. But Ima more about evangelizing dot/cross product rather than angle chasing, I'll work on advocating matrices the next lifetime.
|
|
|
|
|
Logged
|
|
|
|
|
st33d
Guest
|
 |
« Reply #1449 on: January 19, 2011, 02:38:19 PM » |
|
The amount of uses I've found for dot-prod over the years is amazing.
Mostly just from wanting to know if two lines are pointing the same direction.
|
|
|
|
|
Logged
|
|
|
|
|
Glaiel-Gamer
|
 |
« Reply #1450 on: January 19, 2011, 02:39:56 PM » |
|
I fail to see your complaint. But Ima more about evangelizing dot/cross product rather than angle chasing, I'll work on advocating matrices the next lifetime.
easy way to evangelize matrices: matrix stacks and yes dot product is magical too.
|
|
|
|
|
Logged
|
|
|
|
|
Skomakar'n
|
 |
« Reply #1451 on: January 20, 2011, 12:38:16 AM » |
|
The amount of uses I've found for dot-prod over the years is amazing.
Mostly just from wanting to know if two lines are pointing the same direction.
What's wrong with atan2(x1 - x2,y1 - y2)?
|
|
|
|
|
Logged
|
|
|
|
|
st33d
Guest
|
 |
« Reply #1452 on: January 20, 2011, 12:59:42 AM » |
|
That's a method call, which is slow in ECMAScript languages.
|
|
|
|
|
Logged
|
|
|
|
|
bateleur
|
 |
« Reply #1453 on: January 20, 2011, 03:53:33 AM » |
|
Also dot product uses operations which are way cheaper than trigonometry on most platforms even if no function call is involved. The scary thing about 3D geometry is how much scope there is for doing it well or badly. One day I look at some function I've been working with for weeks and notice I can collapse it down from 40 lines to 4 lines. I briefly feel clever, until it occurs to me that what this really shows is that I've spent several weeks being dim! 
|
|
|
|
|
Logged
|
|
|
|
|
Skomakar'n
|
 |
« Reply #1454 on: January 20, 2011, 10:12:46 AM » |
|
Also dot product uses operations which are way cheaper than trigonometry on most platforms even if no function call is involved. The scary thing about 3D geometry is how much scope there is for doing it well or badly. One day I look at some function I've been working with for weeks and notice I can collapse it down from 40 lines to 4 lines. I briefly feel clever, until it occurs to me that what this really shows is that I've spent several weeks being dim!  I'd love for you to share any effective and useful algorithms, if you're up to it.
|
|
|
|
|
Logged
|
|
|
|
|