Quake 2 on .NET

117 views
Skip to first unread message

David Notario [MSFT]

unread,
Jul 12, 2003, 3:33:18 PM7/12/03
to
Hi there, I thought I would send you guys a link to a .NET version of Q2,
which is based on the original Q2 source

http://www.vertigosoftware.com/Quake2.htm

Some comments on it:

- This version doesnt use any 3d hardware acceleration at all, which is
good, because it's interesting to see the performance of the .net platform
and not the performace of the graphics card. In graphic apps/demos/games
that use 3d acceleration, expect the difference between managed and
unmanaged code to be smaller (as the bottleneck of rendering is the 3D card,
not the CPU).

- With this benchmark, you are measuring the quality of the codegen, as the
managed version is just a recompile of the unmanaged version with the /clr
option (which targets IL instead of x86). It's not taking in account GCs
that happen in an app that does managed allocations, it's a pure JIT
benchmark (ie, this also means that it doesn't show some problems you may
have doing realtime graphics with managed code if you're not careful, such
as dropping frames due to GCs)

- In my P4, managed q2 timedemo runs at 63.2 fps, native q2 timedemo runs at
72.8 fps, which means the managed code is performing at 85.6% the speed of
native C++ code with VS.2003.

- The original Q2 has optimized x86 assembly rasterizers, these were one of
the fastest of their time, and they played with cunning tricks such as
explicitely paralellizing x86 and x87 instructions to achieve maximum speed
(for example, the division for perspective correction for the next 8 pixel
span was performed in parallel with the actual rendering of the current 8
pixel span, ie, the perspective correction was almost 'free'). The C
rasterizers that this version uses don't have this property (and today's
compilers still don't figure it out). To compare apples to apples vertigo
software compiled their native version with the C rasterizers (ie, both
versions are slower than the original q2 demo shipped by id). Just for
kicks, I compared the managed version with the original assembly optimized
version, the original one gave me 92.5 fps, which means our codegen is
generating code that is about 70% of the performance of the hand optimized
assembly original q2. I personally think this is great (specially
considering that our codegen has quite a bit of room to improve).

--
David Notario
Software Design Engineer, CLR JIT Compiler


Jeremy Cowles

unread,
Jul 14, 2003, 12:26:13 PM7/14/03
to
"David Notario [MSFT]" <dnot...@online.microsoft.com> wrote in message
news:O1eXvxKS...@tk2msftngp13.phx.gbl...


Thanks for the post!


Niall

unread,
Jul 14, 2003, 9:38:08 PM7/14/03
to
That's pretty cool... I had an idea for a new managed feature for the game,
a new weapon - the GC9000. When you get hit by it, all references in the
code to your player object become weak references. You have to run to find a
particular Resurrector powerup before the garbage collector kicks in :P

"David Notario [MSFT]" <dnot...@online.microsoft.com> wrote in message
news:O1eXvxKS...@tk2msftngp13.phx.gbl...

Reply all
Reply to author
Forward
0 new messages