Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming IT Technology Entertainment Games

Is .NET Relevant to Game Developers? 563

andrew stuart asks: "We've heard an awful lot about how .NET is the future and how .NET signals the end for COM based Windows development, but how far does this go? Is it really the end of COM? Will ALL Windows programming be done with .NET? What about games development? Will games be developed with .NET? If games aren't developed with .NET and Microsoft is killing COM, then what future for games development on Windows? Will there be DirectX for .NET?"
This discussion has been archived. No new comments can be posted.

Is .NET Relevant to Game Developers?

Comments Filter:
  • by Anonymous Coward on Wednesday April 30, 2003 @10:34AM (#5842802)
    Will there be DirectX for .NET? Yes, there already is. Google for "Managed DirectX".
  • .net DirectX (Score:5, Informative)

    by KliX ( 164895 ) on Wednesday April 30, 2003 @10:35AM (#5842809)
    There is DirectX for .net already.. it's called managed DirectX and has been around for a fair while through beta cycles et al.

    Another round of bug fixing and it'll be rather good.
  • by dtolton ( 162216 ) * on Wednesday April 30, 2003 @10:35AM (#5842816) Homepage
    At work I've used dotnet for the past year and half full time.
    I've built websites with it, I've build desktop apps with it,
    I've even built auto-updating distributed apps with it.

    Dotnet has some good things to it and some bad things just like
    any other technology. Before dotnet, most of my work solutions
    were written in VB *shudder*, but when dotnet was released I
    switched immediately to C#. C# does some things right that Java
    didn't do too well on, but those are honestly pretty rare. IMO,
    C# is very much like an immature version of Java. That being
    said, Microsoft is pushing dotnet pretty hard.

    When it comes to dotnet for game development, it is a
    possibility. Mainly because Microsoft is putting so much
    emphasis on it. With good native integration into DirectX, they
    could push a lot of DirectX developers into using C# or Managed
    C++, maybe. It will only happnen if MS can make the integration
    fast and tight, and even then I don't think everyone doing
    DirectX will use dotnet, it imposes too many rules on you as the
    developer and really hides the low level details that are so
    critical to many high performance games (yes even using unsafe code). On the other hand it
    could be a good language for someone to learn to write games in,
    for just that reason.

    Of course, that really only applies to people who want to use a
    Microsoft product for building games. The ubiquity of dotnet
    within the MS world will have little to no effect on the OpenGL
    programmers, except that they may need to find a different
    editor *if* they have been using Visual Studio.

    In reality I think dotnet is what everyone thinks, a competitor
    to Java. How many highgrade professional games are written in
    Java currently?
  • by tsinbad ( 132577 ) on Wednesday April 30, 2003 @10:36AM (#5842826)
    DirectX 9.0 for Managed Code
    (its out already)

    With DirectX 9.0, developers can take advantage of DirectX multimedia functionality and hardware acceleration while using managed code. Managed DirectX enables access to most of the original unmanaged DirectX functionality. The following are the managed code languages supported by DirectX 9.0 and documented in the software development kit (SDK).

    Microsoft Visual C#(TM)
    Microsoft Visual Basic® .NET
    Microsoft Visual C++®
    Microsoft JScript® .NET

    http://msdn.microsoft.com/library/default.asp?url= /library/en-us/directx9_m/directx/directx9m.asp?fr ame=true [microsoft.com]
  • by will_die ( 586523 ) on Wednesday April 30, 2003 @10:37AM (#5842840) Homepage
    The developers of AC2, developed by another company for microsoft, where given authencation code and chat server code developed by microsoft. The addition of this code has made the game unplayable. Here is a quote about the problem from the microsoft head of the game: " Right now the Chat and Authentication System (the Microsoft technology that handles this entire sort of chat) relies on system calls to another system--one that is not related to the Chat and Authentication System or to AC2--to send out the packets that contain your chat. What is happening is that under high CPU usage (that is, when the game starts reaching its peak), this third system starts to throttle the packets and queue up the game server messages (not to be confused with messages/chat to players)." From what is know about the authentication server and chat they are based on .net technologies. So since microsoft cannot produce its own reliable stuff using .net what is the chance of someone else?
  • by disc-chord ( 232893 ) on Wednesday April 30, 2003 @10:42AM (#5842886)
    The bigger issue for game development is that memory management is turned over to the system, which takes a lot of control away from game developers... these are people that put inline assembly code to speed up certain sections...

    Oh how I fear for anyone whose source of .NET information is /.

    The memory managment is not "turned over" to the system. There is an automagic Garbage Collector like Java, but you still have control if you don't want to wait for the automagic processes.

  • by Anonymous Coward on Wednesday April 30, 2003 @10:44AM (#5842906)
    Wow have you even tried .NET? This entire slashdot article could have been eliminated with a quick google search.

    CLR doesn't produce slow code. It's NOTHING like when people complained how slow java was. That's because .NET isn't interpreted, but designed to be JITted. Heavy math is fast in C#, and made even faster since you have the option of STRUCTs! (we do plenty in our research work that involves computer vision.)

    It won't do MMX optimizations so far, at least not that I know, so that stuff is still done by hand. But DirectX 9 is basically 'DirectX.NET', and the .NET DX9 libraries give you 98% of the C++ performance. That isn't too bad now is it?
    Most of the stuff we've used in DX9.NET has been very fast, and using the simple interop with native code we've written plenty of MMX/SSE/SSEII optimized methods where we needed them.

    In addition to your game needing the .NET framework - that's only 20 megs. When most games nowadays are coming out on several CDs, installing the .NET framework isn't a big deal.

    What does this give a game developer? Plenty! Faster development of games with fewer crashes possibly, easier patching of games and auto-updating. Games are a different beast than commercial apps - you don't need versioning so much, you don't need XML, or rapid GUI development. But there's nothing wrong with writing a game in C#, it's just another language, and its plenty fast.
  • by Anonymous Coward on Wednesday April 30, 2003 @10:48AM (#5842942)
    People keep asking the (dumb) question "but if you build it with .NET then I'll have to have Passport/reveal my shoe size to Microsoft/bring about the downfall of Western Civilization in order to use it, right? WRONG... RTFM. .NET is just an application development framework (a very comprehensive one at that). You may be thinking instead of the erstwhile "Hailstorm," which is not the same thing as the .NET application development framework, and to my knowledge is basically a failed initiative at this point. People who have never developed any .NET code should probably refrain from pontificating about its shortcomings.

    There is already Managed DirectX for .NET, as others have pointed out, and this makes good sense considering how easy it is to call COM code from .NET. To those whining about how slow CLR code is, I suggest you actually try it and benchmark it before opening your mouth... Java it is *not* (hallelujah)...
  • The parent article seems to have a vague concept of what .NET is. (Perhaps this is more MS propaganda's fault.) MS released C#, and that's what they're toting when they talk about ending COM-based windows development, I think. If you knew what COM was, you might have a better understanding of what Microsoft is phasing out. COM is the Component Object Model. It allows programs to invoke special versions of other software (which has a COM written for it) and call routines out of that software. For example, I could call the spellchecker for MS Word from my email-writing program, assuming the user had Word installed, of course. I used COM in writing an application meant to automate customer response letters (the user wanted to have Word-compatible documents when the program was finished - a perfect example of COM) and let me tell you: COM is hairy. You have to pass pointers to functions, call functions with nasty parameters... it's a good idea, it just doesn't work inside the C/C++ syntax very well. Unless you're looking for your game to be able to read and write MS Word files, or print through Excel, games probably wouldn't have used the Component Object Model. C# apparently has the same functionality that COM did, but probably does it a little more elegantly. In any case, game developers didn't use COM, and they're probably not using C#. They WILL, however, be using .NET. Because Visual Studio .NET is Microsoft's latest incarnation of their programming IDE and compiler package. And the later versions (hopefully) contain more and more code optimization. And Microsoft HAS good code optimization: they bought all of Watcom's optimizing people a few generations back (when game programming was done almost exclusively in Watcom). In short: Visual Studio .NET is probably phasing out COM. This has absolutely no bearing on game programming.
  • Re:Doubtful. (Score:5, Informative)

    by salimma ( 115327 ) on Wednesday April 30, 2003 @10:50AM (#5842966) Homepage Journal
    Aren't people aware that the things were invented in America in the 1800s by Chinese immigrants seeking to differentiate their restaurants in the mining communities?


    I think you were thinking of fortune cookies, not chopsticks. I can assure you, coming from South-East Asia, that the Chinese, Japanese and Koreans all have been using chopsticks for millenias.


    Which is why there was much backslapping when a Chinese archaeologist claimed to have found a fork in a cave in China dated to about 3000 BC - it's not that they have not discovered forks, it's that they have "moved on".

    And no, my chopstick handling is still rather poor. I can use it to eat rice though :p

  • by ackthpt ( 218170 ) * on Wednesday April 30, 2003 @10:53AM (#5842992) Homepage Journal
    At work I've used dotnet for the past year and half full time. I've built websites with it, I've build desktop apps with it, I've even built auto-updating distributed apps with it.

    Your post is excellent with much more thought than I could cram into mine (office moving day, sigh.) Effectively .Net is intended for business application development, whether on server or client, or client-server. It has the typical rapid (well, unless you get stuck, it being so new yet, help can be hard to find) development ability of most tools which aren't geared to engineering or game work. Though, as processor speeds increase, hardware architecture improves and people get faster connections (which has been a reversed trend for a while with DSL ISP's going kapoot) the burden becomes less visible.

    As an afterthought. I've still got some old games which were probably coded largely in assembler and c and are unplayable because hardware is so damn fast now. MoSlo hasn't been much of a help, either, since it provides uneven compensation for increased horsepower. I think anyone who thinks .NET isn't really too slow needs to see what these old games look like GHz processors and think about where all that increased power has gone.

  • Re:Strange... (Score:5, Informative)

    by Lord Dimwit Flathead ( 668521 ) on Wednesday April 30, 2003 @10:53AM (#5842995)
    That part has nothing to do with the .Net Framework. The Framework is a virtual machine and class library, while the ".Net Services" was going to be a collection of subscription web-based services (not necessarily XML/SOAP webservices though).

    Microsoft's marketing droids decided that if they called everything .Net, it would somehow generate excitement in the market, or some such. They did the same thing with their server products, calling them collectively ".Net Servers" regardless of whether they had any connection to the .Net Framework. It was only a couple of months ago that they decided to rebrand W2K3 from ".Net Server" to "Windows Server 2003".
  • Excuse me (Score:5, Informative)

    by Guilly ( 136908 ) <theonlyguillsNO@SPAMgmail.com> on Wednesday April 30, 2003 @11:03AM (#5843088)
    While you might not be aware of this, cross-platform solutions have been used, are used and will continue to be used to develop games.

    Will ALL Windows programming be done with .NET?
    no. A whole bunch of DirectX developers that use it because they don't know any better will probably move on to .NET gaming. Those who use DirectX because there is specific things in DirectX that they can't find elsewhere will move on to .NET. Others will realize that OpenGL is better than DirectX as an API for mostly anything (Don't flame me for the exceptions).

    If games aren't developed with .NET and Microsoft is killing COM, then what future for games development on Windows?

    For christ's sake... is developing games and DirectX now linked by some kind of godly power? Most of the good games out there (quake anyone?) have been built on multiple platforms and released on multiple platforms because their developers had a clue, which most developers don't. Having used Microsoft stuff for the past years is not a good point while trying to choose which library to base a project on. Finding the most portable and easy to use one is.

    There was a discussion earlier this week about writing portable games here on slashdot. I believe you haven't read it so here it the main idea:
    * If you decide to write a game from scratch, pick portable libraries right at the beginning of the project
    * test that the project compiles and works on both platforms as it grows.
    * keep bad code and unportable code out of the source.

    That way you can probably get rid of DirectX, .NET and COM programming in one step.
  • The future (Score:5, Informative)

    by MagPulse ( 316 ) on Wednesday April 30, 2003 @11:07AM (#5843131)
    .NET is the future, but it's not here yet. It's great for writing small applications quickly, like those corporations use internally. The earliest Microsoft would switch over large applications like Office to fully managed code will be around 2007, because only then will most PCs be able to handle it. 3D games will wait at least a few more years. Right now 95%+ of professional game development is done in C++. COM interfaces aren't going anywhere.

    In 2010 when we might see a serious move to managed code even in games, then COM might start to quietly go away. But thanks to COM interop via COM-callable wrappers, there will continue to be options for C++ developers for the forseeable future.

    And if you utter the words "COM is dead" to any Microsoft-employed programmer, they'll tell you to stop being spoon fed by their awesome marketing division. Even Don Box, father of COM and star .NET evangelist, would answer with "a resounding no [microsoft.com]".
  • by B.Smitty ( 604089 ) on Wednesday April 30, 2003 @11:11AM (#5843161)
    Many games are built with a combination of native code and an interpreted or compiled extension language (QuakeC, UnrealScript, etc.).

    IMHO, the value of .NET will be in replacing these extension languages runtimes with a common infrastructure. Performance critical sections can still use C/C++/Assembly.

    Also, .NET languages aren't interpreted, they're Just-In-Time compiled. So the first usage of a module is slow, but subsequent calls are at native speeds. Also, there are options to ahead-of-time compile modules as well, IIRC.
  • by Caoch93 ( 611965 ) on Wednesday April 30, 2003 @11:13AM (#5843175)
    ...and just like in Java, that control is less than perfect.

    On the contrary, you have zero memory control in Java unless you use Java objects as JNI wrappers and then do all your memory managment in C. Alternately, you can use JVMPI to trap memory allocs and deallocs and try to control things that way. Or you find a VM that lets you tune and reprogram GC behavior. All objects in Java are subject to the GC. In .NET, there is some support for hand-managed memory, though attempts to limit it exist.

    If I remember correctly there is, for example, no way to guarantee a destructor will run for a particular instance before it is recycled. Is this still true?

    It was never true. You're guaranteed that finalize() will run on an object before it is removed from memory. What you're not guaranteed is that the object will ever be the target of a collection, meaning finalize() might never run. Additionally, it's impossible to know at what point in time after the running of finalize() (if ever) the object will actually be taken out of memory.

  • by CrazyLegs ( 257161 ) <crazylegstoo@gmail.com> on Wednesday April 30, 2003 @11:14AM (#5843196) Homepage
    Whenever you see the word "managed" in a reference to .NET, what you are really seeing is "native code support". .NET includes this feature to let you bail out of the CLR and into native code. This is how some of the .NET support for C++ is implemented (I think...). For you Java developers out there, JNI is a good metaphor.
  • by johnnliu ( 454880 ) on Wednesday April 30, 2003 @11:15AM (#5843205) Homepage
    I'm curious how ask slashdot has become a free goole answers [google.com] service... The person asking the question should really do some research first.

    Some comments here:

    1. Is it really the end of COM?

    We (any .NET developer) hope so! But alas, I don't think the time has come yet.

    2. Will ALL Windows programming be done with .NET?

    Sure, you can do the hard core stuff in [Unsafe] C#/C++, leave the rest in .NET. What's wrong with that? Honestly you don't need to optimize some part of the application, like the start-up screens or the options dialogue.

    3. DirectX is already available for .NET. Check DirectX 9 SDK [microsoft.com], you can use it with C#, VB.NET, etc. There are sample projects everywhere.

    4. .NET Framework allows compiling down to native code, there is a .NET framework tool "ngen.exe" which generates a native image of your CLR assembly down to native code for YOUR machine - it will optimize for the particular processor. This is kept in the cache on the particular machine.

    5. I personally think it's down to what game you are planning to write. If you want to do Doom III in .NET, you'll probably have to wait till computers with 5GHz processors and 2GB memory are common. Then again, everybody will agree with me that certain games just have to be written the hardcore C/C++ way. So what's the point of the question?

    6. Summary:

    If you are referring to using DirectX 9 with .NET like you do with Direct8 with C++ via COM interfaces, I think they are equally good, may be a bit slower due to the overheads.

    If you want to do stuff like Diablo/Starcraft in .NET - as long as the user has sufficient memory I don't see why you can't.

    Don't do Doom III in .NET please.


    jliu
  • Yes! (Score:2, Informative)

    by GeckoUK ( 58633 ) on Wednesday April 30, 2003 @11:15AM (#5843206)
    Writing lightening fast engines optimised to a specific console is only one small part of writing a game.

    Writing tools that an artist or designer can use to create content for said engine is a big part (and set to get much, much bigger).

    Anything that speeds up the process of getting tools into the hands of the creative people is a Good Thing(tm)
  • by Hellraisr ( 305322 ) on Wednesday April 30, 2003 @11:16AM (#5843209)
    You can still make regular C++ programs with Visual Studio .NET and not have to use the .NET framework.

    Otherwise, .NET framework is useless to a game programmer. It adds a lot of bulk and crap that you don't even need in the first place. The first thing you do to make a game is to #DEFINE WIN32_LEAN_AND_MEAN which takes out all the crap. Then you create a window and use DirectX through it.

    Looking at the way the CLR works.. you could I guess make a cross-platform game that way. But who cares? All the hard-core gamers have windows boxes and are interested in getting the most FPS out of their games.

    As far as I'm concerned, if you really had to break down and use some windows stuff, you could put the MFC crap in too, but it's going to slow down your game. .NET Framework is basically dumping a bunch of more libraries and components on top of what you already have, increasing the overhead and forcing you to compile into a not-quite .exe

    It's decent for apps but games are high-performance.
  • by arkanes ( 521690 ) <<arkanes> <at> <gmail.com>> on Wednesday April 30, 2003 @11:21AM (#5843273) Homepage
    .NET does NOT allow compiling to native code. What you can do is compile your assembly to a Win32 executable ( a clever little hack that stores the bytecode and a stubloader for the framework). This confuses some people (since you get app.exe, they think it's native code - it's not).

    As for memory management - as one of the other posters said, you can take control of the GC, but you really mess with it when you do this. - "fixed" blocks prevent the GC from moving chuncks, which really messes with it's performance.

    If you use managed C++ rather than a pure .NET solution, you can get some of the benefits of the (very nifty) standard library, but still have your important code running unmanaged. However, I don't really see any gain to this. .NET is a good framework (and I hate MS...), it's like Java but with 10 years of watching all the things Java did wrong, but the areas where it really helps aren't worth the tradeoff for game developers.

    It's good for server programs (like J2EE) because of the managed code - less chance for security flaws and harder to take advantage of them if they do exist. It's even okay for plain old application development (the GUI is noticably worse than compiled code, but it's better than Java [under Windows]). But a 3d engine needs the low level control that native code allows.

  • by grolim13 ( 110441 ) on Wednesday April 30, 2003 @11:23AM (#5843294) Homepage
    Not quite... DotNET is platform-independent. The Mono [go-mono.org] project is developing an independent implementation of .NET for Linux - with Microsoft's help, as I understand it.

    Java is slow for desktop applications because its graphics library is rubbish, not because the VM is inherently slow.

  • by Tattva ( 53901 ) on Wednesday April 30, 2003 @11:25AM (#5843304) Homepage Journal
    The Finalize method, or destructor, will execute in most situations. MS in the .NET beta said finalizer methods of remaining objects would not necessarily execute upon process shutdown. They have ammended this in the release to say that if the finalize process (of every leftover object) upon process shutdown takes longer than 40 seconds, finalization will be terminated and any remaining objects will not be finalized.

    That said, "Finalize" in Java and destructors in C# aren't particularly useful. You can't be sure that any managed objects you reference are available during this period, and if you have any unmanaged resources left over, the destructor is a suboptimal place to clean them up, for the 40 second rule and due to the unpredictable time the garbage collector will call these methods. Better to implement IDisposable interface with its "Dispose" method, and provide a "Close" method that calls "Dispose". This give the user more control of cleanup of system resources, but still provides a minimum level of protection for users who fail to protect themselves, since you can fall back on the finalizer if "Dispose" is never called.

  • by ZigMonty ( 524212 ) <slashdot.zigmonty@postinbox@com> on Wednesday April 30, 2003 @11:26AM (#5843329)
    What were the examples? If they're mostly doing graphics stuff (rotating cubes, etc) then why would there be any difference? That's either native code or hardware accelerated.

    How good is .NET at heavy calculation? Games are more than just graphics.

    If they *were* realistic examples of all the stuff a modern games does, then disregard this post.

  • by ben h ( 148883 ) on Wednesday April 30, 2003 @11:28AM (#5843349)
    I have been using .NET since September 2001. I wrote an open source 3D engine using C#. It makes use of BSP tree visibility culling, it uses WorldCraft as a level editor, it supports OpenGL and it did support NVIDIA's Cg until they changed their interface. When I released this engine open source back in February 2002 I stated clearly that I thought that .NET would be useful for game development.

    ExoEngine - A C#, OpenGL .NET 3D Engine [exocortex.org]

    PS. Some people notice that in the screen shots the engine is only getting about 10fps or less. This is because it was running without 3D hardware accelleration.
  • by anonymous loser ( 58627 ) on Wednesday April 30, 2003 @11:30AM (#5843365)
    Actually what you are describing is referred to as "unmanaged" code in .NET nomenclature.
  • by Anonymous Coward on Wednesday April 30, 2003 @11:48AM (#5843563)
    Clearly you don't. The grandparent of this post clearly mentions windows.forms which is a KNOWN windows-only mess that MS have not submitted for standardisation, and depends on lots of "unmanaged" ms code.
  • by jhamm_ccs ( 557052 ) on Wednesday April 30, 2003 @11:53AM (#5843617) Homepage
    You actually _CAN_ compile C# to native code at deployment time. C# has a nice utility named ngen which will essentially run the JIT and store the compiled code as a native image. While you still have the performance overhead of running in a managed environment, this does reduce the loading time significantly.
  • by kewlniss ( 669828 ) on Wednesday April 30, 2003 @12:17PM (#5843868)
    Most definitely, in fact there already is DirectX for .NET -- it is called Managed DirectX. Microsoft developed version 9 to have an entire set of "Managed" components. These are used by the .NET Framework. I have been using the .NET Framework, C# and ASP.NET since October of 2000 (ASP+ at the time and Beta1). I have been using DirectX since version 5 and was involved with the beta testing of the Managed DirectX since June of last year. It was released in December. I am currently writing a 3D level editor and game using C# and Managed DirectX. The code is much more cleaner than typical C++ code. Since memory is managed there aren't any memory leaks and I have found that most things are just fine with that. However, if there is a part of the program that needs to be sped up (which isn't as much as you might think) then it can be done with "unsafe" code within C#, or even talk directly to unmanaged C++ code. Either way, the point is COM programming will be going away -- BUT -- it isn't going to immediate, nor does it need to be. The interops in place allow any COM object to be easily used as a .NET assembly. Don't worry, game development on the Windows OS will not be going anywhere any time soon. .NET will help make more robust games, not hinder.
  • It looks as though you were using the unmanaged (a.k.a. native) version of DirectX when doing the C++ port. You could use managed C++ and use the managed DX bindings. If you had done that, the DX interfaces would be EXACTLY the same between (managed) C++ and C#. This is because you would be using the exact same interfaces. The managed interfaces to DX are greatly simplified and a little less flexible than the native C/C++ interfaces.

    FYI, the DirectDraw interface in managed DX is just a wrapper around making D3D calls. There is no DirectDraw layer ANYWHERE in DX9. The managed interface just makes it easier to do 2D operations, everything ends up going through the 3D driver eventually.

    Finally, I agree, the managed DX documentation is no where near as complete as the native DX docs.

  • by Jan ( 7105 ) on Wednesday April 30, 2003 @12:31PM (#5844042)
    The .NET CLR (Common Language Runtime) does not interpret IL (intermediate language). Rather it compiles the IL to native code, either at run time (JIT, just in time compilation) or at installation (NGEN, ahead of time compilation).

    The JIT compiler performs classic optimizations such as constant folding, constant and copy propagation, common subexpression elimination, code motion of loop invariants, dead store and dead code elimination, register allocation, inlining, and limited loop unrolling (small loops with small bodies).

    The resulting code quality is suprisingly good but typically not quite as fast as optimized C++.

    What about OOP constructs?

    Method calls use essentially the same native instruction sequences as in C++.

    Object allocation is typically faster than C++, because the compacting garbage collector doesn't have to search a free list, and because it is adaptive and tuned -- for example, GC policy is sensitive to data cache size. The amortized cost of newing and GCing a small object is down around 20 ns on a 1 GHz P-III -- a fraction of the cost of a single L3 data cache miss.

    Of course, you can also have value types (structs) on the stack and in other objects, for which allocation and reclamation is "free".

    A few operations are moderately slower than in native C++, since GC and security may incur array bounds checks, checked casts, and write barriers on object field and array stores. But you trade off these costs against functionality and productivity benefits (no heap corruption debugging sessions).

    So you can write fast managed code.

    It does require learning anew what things cost. Most of us are old hands at C and C++ and know the approximate cost (in machine instructions) of code, and also know what our library calls cost.

    In contrast, we're all newbies, babes in managed code land. We don't really know what our code costs, don't know what our library calls cost.

    So the secret to writing fast managed code is to measure it and be vigilant. Measure the time and space costs of your code, using your favorite code profiler, using the CLR (Allocation) Profiler, using vadump (if working set is an issue), using timers, and using the debugger to take a look at the generated native code.

    Please visit this MSDN site in about two weeks for my forthcoming article, "Writing Faster Managed Code: Know What Things Cost":
    [http://msdn.microsoft.com/netframework/]

    Jan Gray
    Architect, Microsoft CLR Perf Team
  • by egomaniac ( 105476 ) on Wednesday April 30, 2003 @12:34PM (#5844075) Homepage
    That's a very misleading statement. Yes, you use Visual Studio .NET, but the XBox does not run CLR code, it runs ordinary native binaries.

    That's like saying "I'm running Java!" because you used a Java-to-native compiler and produced an ordinary native EXE, and then ran it without any trace of Java on the system.
  • by nightcrawler77 ( 644839 ) on Wednesday April 30, 2003 @01:02PM (#5844414)

    The JIT compiler in the CLR generates native code as its needed. It's true, there is a delay once a new code path is executed, but following JIT compilation, the native code version is executed thereafter.

    For web pages, there is a signifcant delay when a page is hit for the first time. ASP.NET needs to cache the .ASPX file in a temp folder, generate the code and then JIT it. After that, you're back to running directly from native code.

  • by smallpaul ( 65919 ) <paul @ p r e s c o d . net> on Wednesday April 30, 2003 @01:03PM (#5844422)

    Remember that C# and .NET are robust enough for these - the .NET IDE proves that.

    Visual Studio .NET is for the most part not written using the .NET framework. It was developed concurrently with the .NET framework.

  • by Glock27 ( 446276 ) on Wednesday April 30, 2003 @01:05PM (#5844438)
    Unless you're looking for your game to be able to read and write MS Word files, or print through Excel, games probably wouldn't have used the Component Object Model. C# apparently has the same functionality that COM did, but probably does it a little more elegantly. In any case, game developers didn't use COM, and they're probably not using C#.

    Uh, unless you use DirectX. Which is all COM based.

    I prefer cross platform technologies, regardless.

  • by mrlpz ( 605212 ) on Wednesday April 30, 2003 @01:10PM (#5844488)
    Are you like, high on cattle fodder or something ? Windows Forms is SPECIFICALLY platform DEPENDENT, it sits atop Win32 ( albeit quite poorly...every try to easily change font attributes without having to destroy and re-create objects galore ? ). It's a part of .NET that will NEVER get sent to a standards organization. Probably because the clamoring of OPENING UP the API would be more than they would care to deal with.
  • by Tattva ( 53901 ) on Wednesday April 30, 2003 @01:26PM (#5844658) Homepage Journal
    .NET should be excellent at heavy calculation. Things like math compile down to native code and don't really incur any overhead. The overhead of managed languages like .NET are in method invocation, accessing advanced features like runtime types that aren't available in other languages anyway, exception handling, and a larger memory footprint. Arguably, the last two are the only "real" significant disadvantages.

    Some argue garbage collection is expensive, but try calling C++'s "new()" a few million times and see how much you like it then. Memory ALLOCATION in .NET is almost a no-op relatively, and deallocation's only real downside other than non-determinism is that a poor GC (garbage collector) can cause "burps" in performance if it falls behind due to too many objects being created and unreferenced too quickly. Generational GC's like .NET's tend to mitigate this to a large degree.

    I suppose if you consistently use 100% of the processor and are allocating objects, eventually the processing overhead of the GC will become apparent, but most programs use the procecessor unevenly, leaving spare cycles for the GC to consume.

  • by jadams2484 ( 638167 ) on Wednesday April 30, 2003 @04:28PM (#5847031)
    DirectX is more than a graphics library... it has a great input section with DirectInput. You don't have to give up on DirectX to use OpenGL (even the big guys at id software use DirectInput alongside the OpenGL graphics.)

    Your problem is thinking of DirectX as a "language" when its not.
  • by Baki ( 72515 ) on Wednesday April 30, 2003 @04:51PM (#5847285)
    .NET is NOT faster than Java. Those who claim it is have only been listening to MSFT marketing and/or not tried for themselves. Have YOU even tried a Java version from the past 2 years?

    I have (benchmarking is one of my hobbies :) ) and in average Java was 30% faster than C#. Both are pretty decent however, compared to native code (which is about twice as fast). Note I have been measuring pure language + JIT + VM speed, not the libraries. Java's standard libraries are better than .NET, which is only logical given .NET is still quite new.

    Java once was quite slow but since Java2 and also the last JRE 1.4 there have been huge improvements in the JIT. However many browsers still contain ancient JRE versions, and also the "native" Java GUI (AWT) is not very good/fast. Using another GUI toolkit removes this problem.

    Garbage collection can cause some slowness in both C# and Java, but if one takes care and does not use unnecessarily big amounts of instance (i.e. use object recycling) one can avoid this.
  • DirectX for .Net? (Score:2, Informative)

    by panic911 ( 224370 ) on Wednesday April 30, 2003 @07:51PM (#5849035) Homepage
    Guess you havent seen DirectX 9's changelog. DirectX 9 has native .net support and they produced some pretty good MSDN documentation on implementing DirectX apps with C# and VB.net.

What is research but a blind date with knowledge? -- Will Harvey

Working...