DirectX has been providing game developers with a great platform for rich and fast-paced games on Windows for many years. As these platform technologies advance to embrace the concepts of “Managed” programming, DirectX rises to meet the challenge head on.With DirectX 9, we see the first release of the Managed API for developing DirectX-based programs and games. In this episode the .NET Show talks with Tom Miller and Brian Benincasa about what Managed DirectX brings to the graphics programming arena. The video requires an .asf player.
They are very upfront about the performance issues with managed directx.
Good information and a great look into the minds behind managed directx.
I work as game programmer, and I can easily say that despite the code you can upload to the video card, 3D engines still need enormous amounts of very optimized software code for render pipes, frustum/occlussion culling, soft skinning, batch ordering, LOD (pmesh/roam/geomimpmaps/etc), optimum light computing, dynamic lightmaps, collision detection, and lots of lots of things.
And for the highest level sections of the game (gameplay usually) it doesnt make sense to NOT use a good scripting language, which still provides excellent speed and bindings( like lisp or lua) and is still way more flexible than .net. Dont be mistaken, the fact that microsoft doesnt offer powerful scripting technologies like these doesnt mean that they dont exist. (and i guess thats why they promote .net).
And yes, I’ve seen the quake 2 port to managed C++, and i know how slow it runs.
> And yes, I’ve seen the quake 2 port to
> managed C++, and i know how slow it runs.
Huh? Slow? What CPU are you using? My Duron is quite old and Q2.net runs smooth.
http://msdn.microsoft.com/theshow/Episode035/default.asp
You should take a look at this, they ported Quake II to Managed Code and were able to get 50+ FPS. It is another dotnet show.
So are we going to get Managed OpenGL.net from the Mono crew? Perhaps it could tie in with OpenML?
I do some coding in DirectX and it’s obvious that managed dx is quite a lot faster to write. It looks quite impressive to me
So are we going to get Managed OpenGL.net from the Mono crew?
Why not implement managed DirectX using OpenGL? People continually complain about the lack of games in Linux or having to run the Windows version in Wine. We see this everyday in the osnews commentaries. Won’t this solve the gaming problem for Linux? Write manged DirectX games and run them seamlessly in Windows or Linux.
I work as a game developer too and I have to say that your list of buzzwords is impressive—although not applicable to all types of games.
Yes, for the full on, bleeding edge, FPS then managed DX probably isn’t the way to go. But, for tycoon style games, RTSs, games,or most of the small indie stuff (Pontifex, Small Rockets entire lineup, etc…) managed DirectX could certainly help in the development process.
I really have to wonder about people that have a strict black-and-white view on things. “It’s unsuitable for this specific instance, therefore it is useless” is just such a myopic way of looking at things…
I think missed his point entirely. When it comes to programming C# and Java are basically low level languages, I’d even say that they are lower level than C++. The advantage they have over C++ is that they are simpler, but they are also slower.
That’s why they won’t replace when speed is critical, but even when speed is not critical they aren’t very useful. The reason is that you could use high level languages like Lisp, which is a much better language and also faster than Java in many ways, or Lua/Python if you can’t stand Lisp syntax.
Java/C# would only be useful if they had some kind of critical library that you couldn’t access via some ffi-mechanism and also wouldn’t want to rewrite.
I think missed his point entirely. When it comes to programming C# and Java are basically low level languages, I’d even say that they are lower level than C++.
Unfortunately, you’re wrong. Java and C# compile to bytecode, not machine language. They are very high level. In fact, only just below the interpreted languages.
The advantage they have over C++ is that they are simpler, but they are also slower.
Agreed, mostly. And the reason they are slower is… they are higher level languages!
And it’s VERY playable, but on any modern machine, Quake2 averages about 2 gillion frames per second.
On the other hand, I agree with the poster who mentioned that for less taxing games (RPG’s, hex-based military strategy, puzzle), this could work quite well, leaving the developers to spend more time on the complex AI systems while not having to worry (as much) about good graphics and sound.
Online RPGs could also benefit from this.
But I doubt you’ll see many shooters, space combat, racing, etc. games with much managed DirectX in them.
–JM
“Unfortunately, you’re wrong. Java and C# compile to bytecode, not machine language. They are very high level. In fact, only just below the interpreted languages.”
True. But C++ also compiles to bytecode in a .NET environment. So does it lose any speed advantage it has over Java and C# when run in .NET? What about Visual Basic, which also goes to bytecode in .NET? Will it be as fast as C++ in .NET?
Yes, C++ can be made to compile to bytecode, but then you are talking about Managed C++, not C++ the standard ANSI language. As for Managed C++ versus Visual Basic.NET, I’m not an oracle, test it yourself.
i think .net is .net and bytecode is bytecode. it’s equal if it _was_ vb, c# or anything other, it is bytecode when it is compiled.
so it should run at the same speed.
but on the other hand, gcj compiles java source to native code (well, not the whole java api is supportet yet, but enough).
i think this is cool: power of java, speed of a compiled language.
“Unfortunately, you’re wrong. Java and C# compile to bytecode, not machine language. They are very high level. In fact, only just below the interpreted languages.”
I know that you can compile Java and C# to bytecode, but as has been pointed out you can compile C++ and just about any language to bytecode as well. Bytecode itself could be seen as just another form of machine code and has nothing at all with the language itself to do. (In the case of Java it’s not entirely true but I’m talking about the programming language called Java and not the platform etc) You can compile Java to machine code as well (gcj) in case you didn’t know.
When I’m talking about high level programming I’m referring to the capabilities of the language itself. Using C++ templates and other features you have access to higher level programming constructs than you have with Java or C#.
“i think this is cool: power of java, speed of a compiled language.”
Excactly what power are you talking about?
Would you please put quotation marks around the quotes.. Are you espousing the wonders of Direct X or are you just quoting an article?
i think this is cool: power of java, speed of a compiled language.
I thought the power of Java was cross platform compatibility for source and binaries? It isn’t raw speed, it isn’t the most expressive language – see several missing features for a curly braces language- pass by reference, templates, etc.
I agree about the power of the Java platform. Having a multi platform GUI library is nice and a reason I’ve used Java myself. It’s just that I don’t like the Java language. C++ code could be just as cross platform as Java code, it’s the libraries that are the problem and they aren’t really a part of the language itself.
“I know that you can compile Java and C# to bytecode, but as has been pointed out you can compile C++ and just about any language to bytecode as well.”
True. Which is one of the major advantages that .NET has over Java. I personally like Java better. But .NET has an advantage in that is has a much larger supported language base than the JVM does. ASFAIK, the only language other than Java that has been ported to run on the JVM is Python.
That’s my only gripe about Java really. The Java virtual machine doesn’t have nearly the language support that Microsoft’s .NET virtual machine does.
“It isn’t raw speed, it isn’t the most expressive language -see several missing features for a curly braces language- pass by reference, templates, etc.”
What do you mean by that? In Java, everything is passed by reference except for primatives. It’s just hidden from the programmer so that the programmer can’t do bad things with pointer arithmetic and such.
As far as templates, the fact that every class is a subclass of Object often eliminates the need for templates. But also, templates are something is strongly being considered for adding to Java.
I think (you) missed his point entirely….
That’s why they won’t replace when speed is critical, but even when speed is not critical they aren’t very useful. The reason is that you could use high level languages like Lisp, which is a much better language and also faster than Java in many ways, or Lua/Python if you can’t stand Lisp syntax.
No, I didn’t miss his point. I’m curious as to your point, though. Please explain to me how you would go about accessing DirectX via Lisp, Java, Lua, or Python. Your statements are ridiculous in such a context.
What do you mean by that? In Java, everything is passed by reference except for primatives. It’s just hidden from the programmer so that the programmer can’t do bad things with pointer arithmetic and such.
I do mean exactly passing primitives. Standard conveniences like a swap function for primitives cannot be written elegantly in Java. Parameters passed by value, which I think is an important feature. As far as not allowing pointer arithmetic, that is a simple language feature that can be disabled if the Java developers did not want it to exist. There are still other missing things, like multiple inheritance and operator overloading. Perhaps you will argue that they are not needed, and perhaps they aren’t for you – but they are desired by many people and seen as shortcomings. And as you state, yes it is possible that Java may have some of these features in the future, but I am referring to how it is today.
Understanding that parameters are passed by value and not by reference
http://www-106.ibm.com/developerworks/library/j-praxis/pr1.html
“No, I didn’t miss his point. I’m curious as to your point, though. Please explain to me how you would go about accessing DirectX via Lisp, Java, Lua, or Python. Your statements are ridiculous in such a context.”
You mean it would be impossible to use other languages than C++ or C# to access DirectX? I don’t know what kind of problems that are caused by COM by I doubt it even though I haven’t tried. I know that you can use SDL and OpenGL with these languages and if it would somehow be impossible to link directly to DX via a library you could at least use some kind of IPC mechanism to communicate with an optimized core written in C++.
“There are still other missing things, like multiple inheritance and operator overloading.”
Multiple inheritance is dangerous. And the need for it is eliminated by Java’s interfaces.
And yes, I would argue that operator overloading is never needed by anyone. It is simply bad programming practice. There always better ways to do it that result in programs that are easier to read, and easier for the next guy who looks at your source code to figure out.
“Multiple inheritance is dangerous. And the need for it is eliminated by Java’s interfaces.
And yes, I would argue that operator overloading is never needed by anyone. It is simply bad programming practice. There always better ways to do it that result in programs that are easier to read, and easier for the next guy who looks at your source code to figure out.”
I disagree about everything you just wrote. Is multiple inheritance in itself “dangerous”? I don’t think so, even though the C++ implementation isn’t very good. The need for it is not eliminated by interfaces either, interfaces can’t do everything you can do with MI even if you don’t dare to challenge the “diamond of death”.
I agree that operator overloading is not “needed” by anyone in the same way that classes are not needed by anyone because you can do anything you want in assembler. Is it really easier to read and understand v1.add(v2) than v1 + v2 when doing vector arithmetic? I don’t think so, which is enough to prove you wrong. I agree that allowing overloading of “=” in C++ was a bad idea and that people misuse the feature, but I would definately not use the word “always”.
“I disagree about everything you just wrote. Is multiple inheritance in itself “dangerous”? I don’t think so, even though the C++ implementation isn’t very good.”
I think that it is dangerous, mostly because programmers are human and make mistakes. And C++ has absolutely no security model whatsoever.
“I agree that operator overloading is not “needed” by anyone in the same way that classes are not needed by anyone because you can do anything you want in assembler.”
That’s not a very good analogy though because you are talking about a difference in degree of workload that is several orders of magnitude.
If you read what I said, I clearly indicated that I feel many people miss these features. These features are an example of powers provided by other languages and not by Java.
Java developers obviously saw that there is a need for some operator overloading, which is why the included it built in the lanaguage for string concatenation. And just as Java lets you write stupid programs, so does C++.
I’m currently researching sort alogorithms. Java does not provide any sort of templating functionality, so I have maintain a method for each and every primitive type, for each algorithm. As well as coding each swap function inline for each method of each type, instead of a simple generic method for EVERY algorithm. So, that, I think is quite stupid. The language is not “helping” me in anyway from making stupid design decisions, it is tying my hands behind my back.
I still wonder if you think there is something in the concept of multiple inheritance that is so dangerous that it shouldn’t be allowed at all. There are more programming languages than C++ that support it (like Lisp and Eiffel), and it’s hardly reasonable to dismiss it because of a particular implementation.
I know that my analogy wasn’t good but the point is just that language features usually aren’t necessary, the question is if they’re good or not. Something like the C# implementation seems reasonable even though I haven’t studied C# enough to tell for certain. Operator overloading can be abused but the solution is to fire the incompetent programmers rather than changing the language (for that reason). Incompetent programmers will always find a way to screw up no matter what you do. I can after all call my adding function for “fprst” or even “subtract” if I want to.
yeah!
quite funny and easy
—
“There are more programming languages than C++ that support it (like Lisp and Eiffel), and it’s hardly reasonable to dismiss it because of a particular implementation.”
Sure. But neither Lisp or Eiffel are commonly used to write network enabled applications. Most security problems only become an issue when it becomes possible for people with malicious intent to access your programs and your data. That is where the problem is. Things that are not a problem in a stand-alone environment become major problems when the application is publically accessable over a network.
Java solved it reasonably well I think, with interfaces.
I don’t know Lisp or Eiffel, so I can’t say for sure how I would feel about multiple inheritance in those languages.
“so I have maintain a method for each and every primitive type, for each algorithm. As well as coding each swap function inline for each method of each type, instead of a simple generic method for EVERY algorithm.”
Ok. But because every class is a subclass of Object in Java, you can often get around problems like this by casting. Maybe that wouldn’t work in your case. I don’t know.
But for the most part, I think the benefits of Java outweigh issues such as this. It may hinder you somewhat because of this. But I would be willing to bet that the time you save by not having to worry about memory management or garbage collection probably more then makes up for it.
Ok.. what part of 50 FPS, on a high end machine running Quake2, dont you get?
Thats SLOW, woefully slow, unless we want to take a leap back in time for 3D real time rendering.
Considering you can get Quake3 which has many more effects and polygonal complexity running natively at more than 120 FPS, thats slow.
Maybe those features would be helpful in another project, but not this one. The only thing I’m doing is using generic implementations of algorithms, and timing the results. No memory management needed.
Me:
Yes, the world is out to get you. I’m the leader of the conspiracy.
Erik Andersson (IP: —.telia.com) – Posted on 2003-10-25 17:06:15
[/i]When I’m talking about high level programming I’m referring to the capabilities of the language itself. Using C++ templates and other features you have access to higher level programming constructs than you have with Java or C#.[/i]
Comeone, anyone who has taken an IT courses know:
First Generation: Machine Code
Second Generation: Assembly
Third Generation: Proceedural/General purpose: COBOl, C
Fourth Generation: Object Orientated; C++, Java,
Fifth Generation: Artificial Intelligence
Java is so abstracted from the machine you can equate it to attacking a country from 9million miles away vs. a ground attack with is what one could 2GL and 3GL.
As you get higher up the language ladder there is less and less manual work. Do you manage resources in Java? nope. That is one example of a feature in a higher level where more of the work is off loaded to somethihng else, that something else is the JVM.