18. $ csharp
Mono C# Shell, type “help;” for help
Enter statements below.
csharp> using System.IO;
csharp> var last_week = DateTime.Now – TimeSpan.FromDays (7);
csharp> from f in Directory.GetFiles (“/etc”)
> let fi = new FileInfo (f)
> where fi.LastWriteTime < last_week
> select f;
{ “/etc/adjtime”, “/etc/asound.state”,
“/etc/ld.so.cache”, “/etc/mtab”,
“/etc/printcap”, “/etc/resolv.conf” }
csharp>
19. csharp> LoadLibrary (“System.Xml.Linq”);
csharp> using System.Xml.Linq;
csharp> var xml = new XElement(quot;CompilerSourcesquot;,
> from f in Directory.GetFiles (quot;/cvs/mcs/mcsquot;)
> let fi = new FileInfo (f)
> orderby fi.Length
> select new XElement (quot;filequot;,
> new XAttribute (quot;namequot;, f),
> new XAttribute (quot;sizequot;, fi.Length)));
csharp> xml;
<CompilerSources>
<file name=quot;/cvs/mcs/mcs/mcs.exe.configquot; size=quot;395quot; />
<file name=quot;/cvs/mcs/mcs/gmcs.exe.configquot; size=quot;464quot; />
<file name=quot;/cvs/mcs/mcs/OPTIMIZEquot; size=quot;498quot; />
<file name=quot;/cvs/mcs/mcs/lambda.todoquot; size=quot;658quot; />
[...]
</CompilerSources>
32. .
Display Simulation Game Logic Support
• • • World rules • Audio
Rendering Physics
• • • Enemy AI • Input
Shading Collision
• • • User • Networking
Scene Particles
• •
Animation Terrain control
• • Camera
Geometry
• • Behavior
GUI
33. Games are real-time programs
Input AI Updates
• User control • Scripted, slow • Render Graphics
• Network • React to • Play audio
events change
• Update scene
34. Gaming's Achilles' Heel
Display Simulation Game Logic Support
• • • World rules • Audio
Rendering Physics
• • • Enemy AI • Input
Shading Collision
• • • User • Networking
Scene Particles
• •
Animation Terrain control
• • Camera
Geometry
• • Behavior
GUI
C/C++ C/C++ Script C/C++
35. Fully Dynamic
Easy
C#/Java
Productivity
C/C++
Assembly Language
Difficult
Slow Fast
Performance
40. Improving developer productivity while maintaining program speed
Traditional
Scripted
Game AI Slow/easy
Compiled
Game Engines
Fast/Hard
Compiled
Graphics Engine
Fast/Hard
41. Improving developer productivity while maintaining program speed
Traditional Improved
Scripted Managed
Game AI Slow/easy Fast/Easy
Compiled Compiled
Game Engines
Fast/Hard Fast/Hard
Compiled Compiled
Graphics Engine
Fast/Hard Fast/Hard
42. Improving developer productivity while maintaining program speed
Traditional Improved Future
Scripted Managed Managed
Game AI Slow/easy Fast/Easy Fast/Easy
Compiled Compiled Managed
Game Engines
Fast/Hard Fast/Hard Fast/Easy
Compiled Compiled Compiled
Graphics Engine
Fast/Hard Fast/Hard Fast/Hard
43. At the core of gaming engines
UpdatePos (Vector3f [] points, ref Vector3f delta)
{
for (int i = 0; i < points.Length; i++)
points [i] += delta;
}
xi δx xi+δx
yi δy yi+δy
+ =
zi δz zi+δz
Vector3f static operator + (Vector3f a, Vector3f b)
{
return new Vector3f (a.x+b.x, a.y+b.y, a.z+b.z);
}