Game Programming [modified]
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
These games are built up in levels like all complex applications. I've programmed two of these levels myself, but each thing is very difficult and time-consuming, and in most cases, way too much work for one programmer. So, smaller teams take engines from other places and use them in their games. There are many games for example, based on the Unreal engine, which includes several parts needed to make a 3d first-person shooter type game. You still have to come up with the creative aspects yourself - story, artwork, interactions, NPC AI, etc... There are: Graphics engines - many of these are provided by the vendors of the platform you are operating on. For example, Windows provides Direct3D. XBox provides XNA (which has graphics and other features), and PS3 has it's own thing (Glide maybe... I forget?) Sound engines - these provide music, ambient sounds, and incidental sounds for the game. Physics engines - these typically provide the bulk of the game's processing. Physics controls everything from the movement of characters to the flight of projectiles. Collision detecting can be considered part of this too. A good physics engine can make or break a game, and there are many types, specialized for different types of games such as physically complicated 3d shooters like Half-Life, flight sims, driving games, or arcade style shooters which have almost no physics other than collisions. Scripting engines - these provide story-lines and AI for non-player characters. Scripting engines are also used to make sequential puzzles work, handle complex interactions like unlocking doors, and determining when players have completed objectives, and what happens next. Scripting engines use high-level programming techniques, and special languages which apply to the type of game. A level-based game like Doom will have a very different scripting engine than something like an RPG, which is more continuous. These are very specialized but very powerful. Interface engines - these allow applications to accept input from users, and perhaps provide feedback through controllers (force feedback or vibrations). In many cases these will be designed specifically for each game. Most of the above will use C++, with the exception of scripting engines, which have their own languages. In addition, a big-budget game spends a lot of money on artwork, music rights or custom music, actors, and promotional expenses. I have made a 3D graphics engine, and I'm currently working on a scripting engine for RPGs. It's all very time-consuming work,
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
If you have an access to a Mac, you should try out Unity, which is a easy to use game development platform that uses C#, JavaScript or Boo for the scripting. It is available from http://unity3d.com
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
I did this exact search a few weeks ago as i have exactly your experience and want to start some game programming a good starting point is [^] at the end my choice was for XNA www.xna.com Performance is actually quite good and will improve as Microsoft is investing on it (try the examples, i.e. the car racing demo) and the learning curve very easy for C# .NET programmers especially with the hands-on tutorials.
Fred64
-
The game engine is programmed in C++, all the .net languages are way to slow. Here you can download the sourcode of quake: http://www.idsoftware.com/business/techdownloads/[^]
bb |~ bb
I know that in Ubisoft they use c# for the interfaces and perl below for scripting. Nowadays you often end up with something like: 1) High interface (character generation, initial login screen in WoW/DDO etc) in some managed .NET language - it's a secure entry point and is not intensive in resources. 2) Game engine in C++ usually (after all a lot of game engines are based on previous ones, so they just copy/paste/modify I suppose) 3) Often some scripting in another language. But it also depends on the type of game and the platform. For XBOX360+Windows dual platform games XNA seems the easy way to do it.
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
There's an open source 3d engine called OGRE you may want to check this http://www.ogre3d.org/ And some .Net wrappers http://www.ogre3d.org/wiki/index.php/OgreDotNet http://www.ogre3d.org/wiki/index.php/MOGRE
-
Yes this is exactly why they are slow. All the .net languages are basically interpreted languages (yes I know about the just in time compiler). C, and C++ are not interpreted languages, they compile into native machine code, therefore they are faster by default.
bb |~ bb
"faster" and "slow" are relative. One or two frames per second is an acceptable loss when development and maintenance are so much faster and easier. Sure, if you're doing cutting edge graphics engine development you're going to want to get all the performance you can out of your engine, but how many people are doing that? If you haven't done both C++ and .NET game development (I have) you might try it before posting any more.
-
The game engine is programmed in C++, all the .net languages are way to slow. Here you can download the sourcode of quake: http://www.idsoftware.com/business/techdownloads/[^]
bb |~ bb
The game engine is programmed in C++, all the .net languages are way to slow. Here you can download the sourcode of quake: Here is the deal. No one is going to write an entire game of any sophistication in Java or .Net. As mentioned, there are much faster solutions. But the good news is that it doesn't matter - in most cases the really speed critical stuff (ie; handling graphics, audio, etc) is already done for you and available in a number of libraries, whether ultimately coded in C++, C, Assembler, or a combination thereof. Writing Java/.Net games that utilize these is therefore a perfectly reasonable proposition, and unless you're doing some heavy AI work, you're going to be plenty fast enough. Sit down with something like the SDL and/or OpenGL libraries and you'll find that you can create some very fast and beautiful games indeed. And to completely befuddle many of the '.Net aint fast enough' experts here, write it in VB.Net or IronPython or somesuch. I guarantee that for any games a single developer/small shop can come up with, if you are able to exploit common libraries to do all of your heavy lifting, you are going to be: 1) Plenty performant enough (machine cycles). 2) Be able to outpace your counterparts who've been brainwashed into thinking they have to create games completely in C/C++ (developer cycles). Best regards as always, Steve
-
Perhaps the best on-line resource is gGamedev.net[^] (you could try the Game Programming Wiki[^] as well). The Game Programming Gems[^] series of books are some of the best books on the subject, although something like Tricks of the Windows Game Programming Gurus [^] is probably a better introductory book
Graham The fact that we live at the bottom of a deep gravity well, on the surface of a gas covered planet going around a nuclear fireball 90 million miles away and think this to be normal is obviously some indication of how skewed our perspective tends to be. Douglas Adams
I agree, Tricks of the Windows Game Programming Gurus is an excellent intro book. Thats where I started.
-Luke vdH
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
www.visual3d.net => Visual3D.NET is a 3D game engine in its early beta stages that will soon support every .NET programming language.
-
uhhhhh.... saying they are basically interpreted languages and then saying you know about the JIT means you are mistaken in your understanding. they are two completely different things. an interpreted language is just that, interpreted. Each line is translated to machine code each time it runs. With a JIT, each function is compiled to optimised machine code the first time that function is run. The level of optimisation that the JIT can manage within the time constraints is quite impressive, and not that far off what an "old school" offline c++ compiler can manage. Quite a while back Rico Mariani and Raymond Chen wrote a fairly simple benchmark in c++ and c#, then they each optimised their versions http://blogs.msdn.com/ricom/archive/2005/05/10/performance-quiz-6-chinese-english-dictionary-reader.aspx Yes, at the end of the day the unmanaged code WAS faster, but only after a LOT of hand-tuning. Raymond had to do a LOT of profiling and tuning before he was faster than Rico's managed code. managed code isn't slow, but does use more memory. The frameworks are generally much more heavyweight, which I guess comes from how easy it is to develop for them.
There seems to be a myth floating around that .NET code can be as fast as unmanaged C++. The myth is persistent, despite contradicting objective reality. I've been working with both Visual Studio 6 in C++ and Visual Studio 2005 in C# .NET, and there's no comparison. When you start Visual Studio 6, it comes up almost instantly. 2005, like .NET applications in general, is sluggish. .NET applications must do automatic garbage collection, array bounds checking, boxing/unboxing, and JIT compilation. Unmanaged applications don't do any of this. There are other slow-downs too, such as GDI+'s GetPixel and SetPixel. At this point in time, .NET is only appropriate for simple games that don't require speed.
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
Try visiting http://www.truevision3d.com It's a DirectX wrapper (not Open source) that exposes an impressive number of classes which you can easilly use to create an FPS (as well as a number of other games & 3D apps) in a matter of days. I know it sounds crazy but it's actually real ... One thing to warn you though, Game programming requires a lot of technical skills on a variety of fields (maths is one of them) so not many hardcore app programmers know about.
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
Lots of answers over at http://www.gamedev.net/ . Probably too many. Lilith
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
""" The Next Mainstream Programming Languages I didn't see anyone post them yet, so here are the slides from Tim Sweeney's POPL talk entitled "The Next Mainstream Programming Languages: A Game Developer's Perspective". I know Tim and I aren't the only game developers who follow LtU, and I figure even non-game developers might find them quite interesting! http://www.cs.princeton.edu/~dpw/popl/06/Tim-POPL.ppt """ - http://lambda-the-ultimate.org/node/1277 (You can find PDFs of that by searching for the title of his talk.) Tim Sweeney is an interesting guy to read up on; he's gotten into the Haskell language quite a long time ago, and has created and participated in some interesting discussions about programming. He explicitly states in that particular talk that "...[would give up 10% performance for 10% more productivity]...", and that concurrency is a major issue.
-
Yes this is exactly why they are slow. All the .net languages are basically interpreted languages (yes I know about the just in time compiler). C, and C++ are not interpreted languages, they compile into native machine code, therefore they are faster by default.
bb |~ bb
You may want to check out Quake II .NET[^]. The people at Vertigo converted the entire Quake II source from C to managed C++. The entire project runs smoothly with little performance loss over the original C source code. Source code and binaries are available from the Vertigo site (it's in .NET 1.1). Flynn
-
uhhhhh.... saying they are basically interpreted languages and then saying you know about the JIT means you are mistaken in your understanding. they are two completely different things. an interpreted language is just that, interpreted. Each line is translated to machine code each time it runs. With a JIT, each function is compiled to optimised machine code the first time that function is run. The level of optimisation that the JIT can manage within the time constraints is quite impressive, and not that far off what an "old school" offline c++ compiler can manage. Quite a while back Rico Mariani and Raymond Chen wrote a fairly simple benchmark in c++ and c#, then they each optimised their versions http://blogs.msdn.com/ricom/archive/2005/05/10/performance-quiz-6-chinese-english-dictionary-reader.aspx Yes, at the end of the day the unmanaged code WAS faster, but only after a LOT of hand-tuning. Raymond had to do a LOT of profiling and tuning before he was faster than Rico's managed code. managed code isn't slow, but does use more memory. The frameworks are generally much more heavyweight, which I guess comes from how easy it is to develop for them.
You can also specify that you want to compile your code into native code. You lose some of the benefits of the .Net Framework, but can pretty much role back to plan old C++ or VB 6++ code. The biggest benefit of .Net in my opinion is that since everything is sent to a intermediate language, the performance of all the .Net languages is identical. Now you can pick the tool based on syntax/other preference without performance penalty. I think similar to what GNU does with there compilers, you parse and tokenize your high level language and optimize at the intermediate language layer. The end result, all of MS optimization effort on their compiler benefits all the languages not just the current one they are working on. GNU compilers do get beat by Intel compilers but I think that is more of an internal knowledge benefit not better coding. What I want to see is more transparency in the architecture of the processor. I do high end scientific simulation codes mostly, and I have to hope that my compiler writer had a buddy at Intel that told him exactly how things are laid out, not just the high level virtual design that they release to the public.
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
The task of turing out a state-of-the-art game is very big. You need: 1) The grahpics engine which will render everthing that gets displayed. 2) A "phisyics" engine to make your game world relisitic ( i.e - you can't walk though walls; walking, shade, reflections....) 3) A game manager to co-ordicnate graphic calls, AI calls and poll user inputs. 4) A great deal of art files 5) A great deal of sound files. To get a simple taste of it there are several books easily obtained in any book store which walks you thorugh the creation of a simple (i.e. unimpressive, no one would want to play them) games.
-
There seems to be a myth floating around that .NET code can be as fast as unmanaged C++. The myth is persistent, despite contradicting objective reality. I've been working with both Visual Studio 6 in C++ and Visual Studio 2005 in C# .NET, and there's no comparison. When you start Visual Studio 6, it comes up almost instantly. 2005, like .NET applications in general, is sluggish. .NET applications must do automatic garbage collection, array bounds checking, boxing/unboxing, and JIT compilation. Unmanaged applications don't do any of this. There are other slow-downs too, such as GDI+'s GetPixel and SetPixel. At this point in time, .NET is only appropriate for simple games that don't require speed.
I didn't say .Net code was as fast as unmanaged c++. I said it CAN be nearly as fast. When you start Visual Studio 6, it comes up almost instantly. 2005, like .NET applications in general, is sluggish. vs2005 is mainly written in unmanaged code. Also it has a heck of a lot more features than VS6, its like comparing wordpad to MS word. .NET applications must do automatic garbage collection, Yes, true. However its .net is a LOT faster than c++ at allocating memory for new objects. array bounds checking, In most cases array bounds checks can be optimised out by the JIT (http://codebetter.com/blogs/gregyoung/archive/2006/06/11/146343.aspx) boxing/unboxing, Only happens if you are using an object to do the job of a value type. If you don't like the perf hit, don't to it. Find or write a library that uses a value type, or even better, a generic. and JIT compilation. You got me with that one :) But to be fair thats a price you only pay once, and its a small price to pay to get code that is optimised for your specific CPU (AMD64, Pentium 4, xenon etc etc) unmanaged applications don't do any of this. As I've said above, managed applications need not do most of this either. There are other slow-downs too, such as GDI+'s GetPixel and SetPixel. Yep, GDI+ is no speed freak. Its a heavyweight library. People have benchmarked managed directX, and found its speed VERY close to C++ tho. Once again, I'm NOT saying .net is faster or as fast as c++. I'm just saying if you code well, its not that bad. In most cases, its plenty fast enough, and its a LOT easier than writing C++ code. Yep, commercial games will probably be written in unmanaged code for the foreseable future. they have to be on the bleeding edge.
-
I didn't say .Net code was as fast as unmanaged c++. I said it CAN be nearly as fast. When you start Visual Studio 6, it comes up almost instantly. 2005, like .NET applications in general, is sluggish. vs2005 is mainly written in unmanaged code. Also it has a heck of a lot more features than VS6, its like comparing wordpad to MS word. .NET applications must do automatic garbage collection, Yes, true. However its .net is a LOT faster than c++ at allocating memory for new objects. array bounds checking, In most cases array bounds checks can be optimised out by the JIT (http://codebetter.com/blogs/gregyoung/archive/2006/06/11/146343.aspx) boxing/unboxing, Only happens if you are using an object to do the job of a value type. If you don't like the perf hit, don't to it. Find or write a library that uses a value type, or even better, a generic. and JIT compilation. You got me with that one :) But to be fair thats a price you only pay once, and its a small price to pay to get code that is optimised for your specific CPU (AMD64, Pentium 4, xenon etc etc) unmanaged applications don't do any of this. As I've said above, managed applications need not do most of this either. There are other slow-downs too, such as GDI+'s GetPixel and SetPixel. Yep, GDI+ is no speed freak. Its a heavyweight library. People have benchmarked managed directX, and found its speed VERY close to C++ tho. Once again, I'm NOT saying .net is faster or as fast as c++. I'm just saying if you code well, its not that bad. In most cases, its plenty fast enough, and its a LOT easier than writing C++ code. Yep, commercial games will probably be written in unmanaged code for the foreseable future. they have to be on the bleeding edge.
-
I visit CP often as I am generally interested in .NET/C#, but am not a professional programmer. I friend recently asked a question that I could not clearly answer, so I thought I would post it here: How are games, such as first-person shooters like Doom, programmed? I assume there is an engine of sorts, but is there than a languange the engine uses? I am sure it is a fairly complex answer, but does anyone have any resources (CP or other) about the process? Just need to feed my curiousity a bit. Thanks! -- modified at 11:31 Sunday 17th June, 2007
Here is a site of a game programming engine www.garagegames.com
Alberto Bar-Noy VP R&D http://www.newreign.com