Game Development Community

dev|Pro Game Development Curriculum

Amazing Frame Rate and MSPF w/ Next version of DNT

by Vince Gee · 07/18/2013 (6:55 pm) · 11 comments

So here I am working on the next release of DNT, minding my own business when I fire up a release build to see how it is performing and WOW.


This build isn't released yet and it still has a way to go before it will be ready, hoping for sometime around January 2014 but damn.

And I'm not done converting all the script or optimizing yet. Wonder if I can hit max rate by the time I finish...

This is stock T3D
https://www.winterleafentertainment.com/Portals/0/oneworldbeta/stock.jpg
This is DNT in development
https://www.winterleafentertainment.com/Portals/0/oneworldbeta/dnt.jpg
Ok, this is neat, so I turned on all the shaders..

This is Stock T3D

https://www.winterleafentertainment.com/Portals/0/oneworldbeta/AllPostEffectStock.jpg
This is DNT


https://www.winterleafentertainment.com/Portals/0/oneworldbeta/AllPostEffectDNT.jpg


Vince

Winterleaf Entertainment L.L.C.

#1
07/18/2013 (7:26 pm)
Hey Vince, could you compare it to the current non-dnt?

And system specs?

Also I remember something about DNT not going to be upgraded past the current MIT release?
#2
07/18/2013 (7:37 pm)
There ya go, showed the same scene between the two version w/ trees.
#3
07/18/2013 (7:44 pm)
Added in all the shaders to see what effect turning them all on would have.
#4
07/18/2013 (8:15 pm)
Excellent work Vince!
#5
07/18/2013 (8:57 pm)
Ah now I AM impressed! That's damn good.
#6
07/19/2013 (4:20 am)
Is the processing of scripts and things that heavy one FPS?
#7
07/19/2013 (5:16 am)
The reason the framerate difference is so much when all shaders are enabled is because the engine calls setShaderConst every frame tick (if I remember right)

In stock t3D it is doing a namespace/object lookup, finds the entry point to the function, then goes into the script engine and runs it.

So, even if the code is minimal, you still have lookups to the stringtable, if it calls another function it needs to do more lookups, etc.

In DNT, it's a bit different.

First, I hijack the function call before it hits the console right off. If DNT can't find a function to meet the requirements of the requested object and function, it then and only then passes it to the console.

Second,

The local variables inside the function live only in C#, so that is less entries in the stringtable and variable tables. Also, when the c# function needs to get a torque variable or call a console command, it's not using the console, it's using a direct casted pinvoke, thus reducing overhead of casting objects between strings and int's, etc.

Third,
Since as I convert the script I am removing the TorqueScript from the code files, that means there is less entries in the function lookup tables etc, so the remaining ones are found faster.

So in general, the engine actually starts to go faster and faster the farther I get into converting all the torquescript to csharp simply because I am reducing lookups in T3D memory lists. Compound that with the fact the C# is compiled into IL (which is dot.net assembly language basically). This means that it is not compiling on the fly, it is just running down an instruction set.

I'm sure there are other things going on here, but there the ones that my analytics report as the biggest gainers.

Vince

#8
07/19/2013 (3:37 pm)
The object lookup in TorqueScript really is terribly unoptimized - for instance when calling all those setShaderConst functions it will typically lookup the object in the local variable table then lookup the id in the global id table then lookup the function in the namespace, etc... its no wonder you are seeing such improvements with per-frame calls ;)
#9
08/02/2013 (4:59 am)
Is that FPS counter in the templates somewhere, or did you make it yourself?
#10
08/02/2013 (6:14 am)
console: metrics(fps)
metrics(gfx) is also nice, it gives you polycount and drawcalls
#11
08/02/2013 (4:31 pm)
Thanks. Found it in core/scripts/client/metrics.cs and core/art/gui/FrameOverlayGui.gui.