Fog Creek Software
g
Discussion Board




C# Games

Back when I used to lurk in borland.public.delphi.non-technical, the topic of "What games are written in Delphi" came up.  I was looking at my VC++ and C# books this weekend, and wondered if anyone knew of any games (or any non-business or non-web) written in C# on the market or in production.

I'm a C# n00b as it were, but given that I keep hearing both "C# is out there to replace Java" and "don't write BIG, graphics heavy games in Java(1)," I was curious if C# had been used.  Thanks!

--

1. I am not condemning Java or passing judgement, just repeating what I have heard during conversations about 3D games, virtual machines, and the XBox.

Andrew Burton
Sunday, December 7, 2003

The quick answer is that there are no professional C# authored games out there. You can find a mod of Quake 2 that is "managed code", though in reality the managed code is an extremely small subset of the code for Quake2, and is really acting as a dispatcher to the actual native cod.

Having said that, with a proper stub to the "native" gaming APIs (OpenGL, DirectX), which themselves are stubs to the video driver, which itself is often just a stub to on-GPU implementation, it is entirely possible to write a cutting edge game in many of the less efficient languages -- the point is that with a full hardware abstraction layer, it's the graphics card that is doing all of the heavy lifting, so if the stub-interoperations consumes a tiny iota more of the main CPU's time, it is hardly relevant. Of course this presumes that the game is primarily graphics bound, as most currently games are unfortunately, and that you're not trying to eak out every bit of performance for advanced AI or to model an entire war (ex. Falcon 4, which was a game _way_ before its time. I'm tempted to install it again to see if today's PCs are up to the challenge...) -- in that case less efficient languages become less realistic.

Having said that, this presumes that graphics are the majority of the

Dennis Forbes
Sunday, December 7, 2003

Recent job offers from EA (in Montreal) expect experience with .NET.

But maybe they are just looking for Intranet developers with those ads...

Kentasy
Monday, December 8, 2003

I have seen some DirectX tutorials written in C#.

For Delphi, there are entire books about DirectX and OpenGL programming.

MX
Monday, December 8, 2003

The Europa Universalis engine is made in VB.
I think strategy, puzzles,card games, etc or anything that doesn't require the latest fastest video card on the market. They should be possible in C#.

Milton
Monday, December 8, 2003

Dennis, Kentasy, and MX, thank you for the replies.  I appreciate the information.

Andrew Burton
Monday, December 8, 2003

Milton as well, thank you.

I think I asked in ignorance, looking back at the posts.  I was thinking about cutting-edge graphics.  I'd forgotten the better games are often the ones without high-end, 3D stuff.  Thanks.

Andrew Burton
Monday, December 8, 2003

Even with DirectX 9.0 being available as managed code, I don't see too many high-end graphics game being written in C#. Stuff like Half Life, Quake, or any other game where absolute graphics performance is key to the game.

The other limiting factor is the fact that the .NET Framework still doesn't ship with Windows so many people have never had it installed. However, this will change eventually.

Overall, I feel that for the shrink-wrapped games you buy at Gamestop, CompUSA, etc are going to continue to be developed with C++. That doesn't mean we won't see a nice cottage industry of good C# games eventually, but for now, C++ is still King.

Mark Hoffman
Monday, December 8, 2003

Read nothing into the ad from EA. They're into netwroked servers, and networked games, and the likes of Java and C# are the prime candidates for that problem space.

Arron Bates
Monday, December 8, 2003

You can write yesterdays games in C#, but if you want to actually make money selling a blockbuster game, it needs to have cutting edge performance and C# does not allow for that.

Tony Chang
Monday, December 8, 2003

It is certainly possible to have significant portions of the game code written in C# or some other high level language.  Unreal for example had most of the game code written in UnrealScript.  The engine code was C or C++ but the UnrealScript part was a pretty significant portion of the code base.

Mike McNertney
Monday, December 8, 2003

Mark,

Some time ago, 97(?), no one had DirectX installed. Every game at that period had a directx setup on CD. So, the .NET runtime isn't an obstruction for a game today.

Optimization with native code can help the performance issue. And, even a C game needs optimization (and generally in the same places as the C# game).

So I think a .NET game is possible.

C# fan
Monday, December 8, 2003

I thought that in MOST games these days, just the graphics engine and low level stuff is C++, and the rest of it is some home brew scripting language?

_
Monday, December 8, 2003

Check out "Introduction to 3D Game Engine Design Using DirectX 9 and C#" by Lynn T. Harrison, published by Apress.

Kevin
Tuesday, December 9, 2003

That's correct that 'just ' the graphics engine and 'low level stuff' is C or C++ AND assembly.

The rest is in a domain-specific scripting language, coupled with binary files that are made with game development systems designed in C and C++ by the engine designers.

Realize that the people doing the level design are not programmers and what is done in the development system is more interactive graphical design than anything else. They certainly don't hire programmers to do the level design. The programmers make it possible for game designers and artists to do their work without having to know anything about programming.

Tony Chang
Tuesday, December 9, 2003

Of course you can write a game in C#. It just depends on how clever you are.

I played a chess game written in C# on the Compact Framework the other day. It was pretty good.

Jorel on Software
Tuesday, December 9, 2003

C# fan,

Even removing the issue of the Framework not being installed, there is still the issue of raw performance that you don't get with C#.

FWIW, I make my living as a C# developer. I love C#. I'm not bashing it, but rather just being realistic about what it can do well.

I'm also a game nut and love to play around with DirectX. I've taken C++ code that used DirectX and compiled it under C# and I've seen the performance hit that you take under C# when doing lots of 3D graphics. (And this is using an ATI Radeon 9800 Pro which does a lot of the work for you.)

All that I'm saying is that don't expect C# to shine when writing twitchy first person shooters or any other 3D graphics game that requires blazing speed.

I think simulations is an area where C# has a lot more potential. Stuff like Sim City (the older stuff, not the new crap), Civ 3, etc don't tax the graphics pipeline like 3D games do.

Mark Hoffman
Tuesday, December 9, 2003


Also...I haven't had time to look, but is the new DirectX managed code really managed, or is it just an Interop wrapper around the DX COM libraries?

If it's just a wrapper, then one would certainly expect a performance hit due to the marshaling.

Mark Hoffman
Tuesday, December 9, 2003

They are wrappers, and the performance penalty is on the order of about 10%, I believe.

Brad Wilson (dotnetguy.techieswithcats.com)
Tuesday, December 9, 2003


The jobs advertised will most likely be for tools.  Engine is one side of the coin, getting the assets into the game is another.

A Tool
Wednesday, January 28, 2004

There are already some c# game engines under construction like Purple# ( www.bunnz.com )

Ken Houston
Wednesday, April 14, 2004

*  Recent Topics

*  Fog Creek Home