Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Games in C# is it even Possible

Games in C# is it even Possible

Scheduled Pinned Locked Moved The Lounge
csharpjavagame-devquestion
73 Posts 32 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jorgen Sigvardsson

    Does it run well on a $1000 machine? Is it entirely written in .NET? It's hard to verify how much C++/CLI there is in there to speed it up. :)

    S Offline
    S Offline
    Super Lloyd
    wrote on last edited by
    #50

    Jörgen Sigvardsson wrote:

    much C++/CLI there is in there to speed it up

    Obviously not! Are you of these fool who would think .NET a failure until Windows and Office would be entirely managed? When you've got some running C code, keep it! We are not in the Java crowd here...

    Jörgen Sigvardsson wrote:

    Is it entirely written in .NET?

    err.. mistake here. C++/CLI is just the same as C#. only pure C++ could have some sort of advantage. Now I'm not convinced at all by the so-called "overpowering advantage of C++". All tests I have done or seen failed to convince me. But hey, if the competition stick to C++, all the better for me! ;P

    J 1 Reply Last reply
    0
    • S Super Lloyd

      Jörgen Sigvardsson wrote:

      much C++/CLI there is in there to speed it up

      Obviously not! Are you of these fool who would think .NET a failure until Windows and Office would be entirely managed? When you've got some running C code, keep it! We are not in the Java crowd here...

      Jörgen Sigvardsson wrote:

      Is it entirely written in .NET?

      err.. mistake here. C++/CLI is just the same as C#. only pure C++ could have some sort of advantage. Now I'm not convinced at all by the so-called "overpowering advantage of C++". All tests I have done or seen failed to convince me. But hey, if the competition stick to C++, all the better for me! ;P

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #51

      Super Lloyd wrote:

      Obviously not! Are you of these fool who would think .NET a failure until Windows and Office would be entirely managed?

      Look who's calling names. Last time I checked, Office is not a game. :) And where did I say .NET is a failure? Stop putting words in my mouth...

      Super Lloyd wrote:

      err.. mistake here. C++/CLI is just the same as C#. only pure C++ could have some sort of advantage.

      If I'm not mistaken, you can mix native and CLI as you go in C++/CLI. There's a reason why they didn't ditch C++ alltogether. My theory is that "it's the perfect legacy glue" is partly a "marketing" reason. Real time apps (meaning apps which cannot afford which require minimal response time) are still in need of native code, and Microsoft knows this.

      S 1 Reply Last reply
      0
      • Q QuiJohn

        Christian Graus wrote:

        Shown by who ? C++ programmers who don't know how to use C# ?

        I think I was basing my "twice as slow" comment on this link that I found a while ago. Judging from the site name I doubt they're biased against C#. In particular the Sieve of Eratosthenes results were interesting (scroll down, the Hello World results are useless and not at all unexpected). BTW, I program in C# and believe that in the vast majority of applications, being twice as slow doesn't matter at all (most programs spend most of their time waiting for the much slower human component). I like C# as a language. But it's not as efficient as C or C++, and by design it can't be. So for something like a modern 3D game, which needs all the performance it can get, C++ is going to be the better choice. As for DirectX only being 4-5% slower when using C#, that's all well and good but considering DirectX spends most of its time in libraries that aren't written in C#, it's not surprising and nor is it very useful. The rest of the app (physics, AI, what have you) will be much slower and significantly so.

        S Offline
        S Offline
        Super Lloyd
        wrote on last edited by
        #52

        mmhh??? where does those results comes from? I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say?

        A 1 Reply Last reply
        0
        • S Super Lloyd

          mmhh??? where does those results comes from? I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say?

          A Offline
          A Offline
          Anna Jayne Metcalfe
          wrote on last edited by
          #53

          GCC isn't the most optimised compiler out there. If you get comparable results with the Intel or Microsoft compilers I'd be very surprised!

          Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

          S 2 Replies Last reply
          0
          • J Jorgen Sigvardsson

            Super Lloyd wrote:

            Obviously not! Are you of these fool who would think .NET a failure until Windows and Office would be entirely managed?

            Look who's calling names. Last time I checked, Office is not a game. :) And where did I say .NET is a failure? Stop putting words in my mouth...

            Super Lloyd wrote:

            err.. mistake here. C++/CLI is just the same as C#. only pure C++ could have some sort of advantage.

            If I'm not mistaken, you can mix native and CLI as you go in C++/CLI. There's a reason why they didn't ditch C++ alltogether. My theory is that "it's the perfect legacy glue" is partly a "marketing" reason. Real time apps (meaning apps which cannot afford which require minimal response time) are still in need of native code, and Microsoft knows this.

            S Offline
            S Offline
            Super Lloyd
            wrote on last edited by
            #54

            Jörgen Sigvardsson wrote:

            Look who's calling names. Last time I checked, Office is not a game. And where did I say .NET is a failure? Stop putting words in my mouth...

            Well, maybe not your words, allright...

            Jörgen Sigvardsson wrote:

            If I'm not mistaken, you can mix native and CLI as you go in C++/CLI. There's a reason why they didn't ditch C++ alltogether. My theory is that "it's the perfect legacy glue" is partly a "marketing" reason. Real time apps (meaning apps which cannot afford which require minimal response time) are still in need of native code, and Microsoft knows this.

            Well I'm using .NET2 and last time I tried (5 minute) a #pragma unmanaged I had some kind of error message and though, ho well! And ManagedC++ is much more fussy..... Anyway there is an unavoidable cost everytime you cross the managed world (yeah, yeah, even with SuppressManagedSecurityAttribute, which don't apply in managed C++ anyway) so it's better do it all managed, I reckon...

            1 Reply Last reply
            0
            • A Anna Jayne Metcalfe

              GCC isn't the most optimised compiler out there. If you get comparable results with the Intel or Microsoft compilers I'd be very surprised!

              Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #55

              Well, err... How do I compile?!? I tried cl /O2 sieve.cpp but that produce an unworking executable....

              E 1 Reply Last reply
              0
              • S Super Lloyd

                Well, err... How do I compile?!? I tried cl /O2 sieve.cpp but that produce an unworking executable....

                E Offline
                E Offline
                El Corazon
                wrote on last edited by
                #56

                Super Lloyd wrote:

                Well, err... How do I compile?!?

                With Intel, you download, pay money for license, install, and compile as usual. :)

                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                1 Reply Last reply
                0
                • A Anna Jayne Metcalfe

                  GCC isn't the most optimised compiler out there. If you get comparable results with the Intel or Microsoft compilers I'd be very surprised!

                  Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                  S Offline
                  S Offline
                  Super Lloyd
                  wrote on last edited by
                  #57

                  cl /O2 /EHsc sieve.cpp compiles cleanly but crash right away....

                  1 Reply Last reply
                  0
                  • L L Viljoen

                    I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                    Oliekrokenosterpikkelikkeastrysvoel

                    C Offline
                    C Offline
                    Chris S Kaiser
                    wrote on last edited by
                    #58

                    I think for now its the best environment for tools development and prototyping, but depending on your target specs at least the core graphics engine and potentially the AI will still need to be C++. But in time this may change. Just my point of view.

                    This statement is false.

                    1 Reply Last reply
                    0
                    • L L Viljoen

                      I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                      Oliekrokenosterpikkelikkeastrysvoel

                      T Offline
                      T Offline
                      Thomas Freudenberg
                      wrote on last edited by
                      #59

                      Arena Wars[^] is a great game.

                      Regards Thomas


                      Disclaimer:
                      Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.

                      1 Reply Last reply
                      0
                      • Q QuiJohn

                        Christian Graus wrote:

                        Shown by who ? C++ programmers who don't know how to use C# ?

                        I think I was basing my "twice as slow" comment on this link that I found a while ago. Judging from the site name I doubt they're biased against C#. In particular the Sieve of Eratosthenes results were interesting (scroll down, the Hello World results are useless and not at all unexpected). BTW, I program in C# and believe that in the vast majority of applications, being twice as slow doesn't matter at all (most programs spend most of their time waiting for the much slower human component). I like C# as a language. But it's not as efficient as C or C++, and by design it can't be. So for something like a modern 3D game, which needs all the performance it can get, C++ is going to be the better choice. As for DirectX only being 4-5% slower when using C#, that's all well and good but considering DirectX spends most of its time in libraries that aren't written in C#, it's not surprising and nor is it very useful. The rest of the app (physics, AI, what have you) will be much slower and significantly so.

                        D Offline
                        D Offline
                        Daniel Grunwald
                        wrote on last edited by
                        #60

                        You should replace for (int i = begin; i < end; ++i) with for (int i = begin; i < primes.Length; ++i) And do the same with the inner loop. This is a special construct recognized by the JIT that eliminates array bounds checking. I haven't tested this on .NET 2.0 yet, maybe .NET 2.0 eliminates array bound checking even when not using that fix.

                        1 Reply Last reply
                        0
                        • C Christian Graus

                          Chona1171 wrote:

                          Mabe I should just stick to Information Systems its what I am good at.

                          Nah, stretch yourself, become good at other things. Resources such as bitmap handles and database connections can be cleaned up by the IDisposable interface, which just means if an object has a Dispose method, you should call it when you don't want an object anymore. It's a poor mans substitute for deterministic destruction.

                          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                          C Offline
                          C Offline
                          Chris Charabaruk
                          wrote on last edited by
                          #61

                          Actually, with a game, you shouldn't dispose resources as soon as you're finished with it. If possible, you should make sure the GC doesn't, either. The idea is to dispose unused resources during a transition (those times when the loading screen pops up) so as to avoid hiccups in the frame rate. It's not all that important when it's just one or two little resources but if you're clearing out game resources in bulk players will notice. Same goes for loading them.

                          Christopher S. 'coldacid' Charabaruk

                          1 Reply Last reply
                          0
                          • Q QuiJohn

                            Christian Graus wrote:

                            Why ?

                            Possibly because C# has been shown to be about twice as slow as C++? For a time critical app like a 3D game, that might be important.

                            C Offline
                            C Offline
                            Chris Charabaruk
                            wrote on last edited by
                            #62

                            Puh-leeze. C# isn't faster or slower than any other language, it's all in how it's used. I developed a little game in 3 days that used only 2D graphics with the help of SDL.NET, and it struggles at 30 FPS. I've seen MDX and Tao.OpenGL that just fly. C# is a perfectly good language for game development, concerns about resource & memory management or no.

                            Christopher S. 'coldacid' Charabaruk

                            1 Reply Last reply
                            0
                            • L L Viljoen

                              I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                              Oliekrokenosterpikkelikkeastrysvoel

                              P Offline
                              P Offline
                              pkoselski
                              wrote on last edited by
                              #63

                              Try to implement perpixel alpha blending in C# and you'll see why there are no many games written in .net. The answer is - because there are many winapi functions which doesn't have corresponding .net methods. These functions are in most cases so-called low level, such as WINAPI UpdateLayeredWindow function. So, the only way to implement pp alpha blending is to call WINAPI function from C# but does it make any sense? Isn't it better to write the game in C++ and use WINAPI functions directly?

                              1 Reply Last reply
                              0
                              • L L Viljoen

                                I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                                Oliekrokenosterpikkelikkeastrysvoel

                                X Offline
                                X Offline
                                X Cyclop
                                wrote on last edited by
                                #64

                                Sure, you can. But, C# has a disadvantage: .Net Framework/MONO. For this reason i'd use C++.;)

                                1 Reply Last reply
                                0
                                • L L Viljoen

                                  I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                                  Oliekrokenosterpikkelikkeastrysvoel

                                  A Offline
                                  A Offline
                                  AntiSilence
                                  wrote on last edited by
                                  #65

                                  Very possible. Check out this article at Coding4Fun... Rocket Commander

                                  1 Reply Last reply
                                  0
                                  • E El Corazon

                                    Christian Graus wrote:

                                    but most of my processing is a lot less intense than that lot was ( HDR image merging ), and it works just fine in C#.

                                    have you tried the C# Microsoft Research Accelerator? I would expect for HDR image manipulation it would work great. It moves C# to utilizing both CPU and GPU for parallel processing. http://channel9.msdn.com/wiki/default.aspx/Accelerator.HomePage[^] I haven't used it yet, but it is the first item of C# that made me do a double take. That is worth learning a new language (not that I have had any time to).

                                    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                    S Offline
                                    S Offline
                                    si618
                                    wrote on last edited by
                                    #66

                                    Interesting, cheers for the link! There is also NGen for improving managed assemblies performance: http://msdn2.microsoft.com/en-us/library/6t9t5wcf.aspx

                                    1 Reply Last reply
                                    0
                                    • L L Viljoen

                                      I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                                      Oliekrokenosterpikkelikkeastrysvoel

                                      S Offline
                                      S Offline
                                      samir ray
                                      wrote on last edited by
                                      #67

                                      Not only is it possible, Koios Works has released multiple games all developed in C#. Their latest game, Panzer Command: Operation Winter Storm just came out in June.

                                      1 Reply Last reply
                                      0
                                      • Q QuiJohn

                                        Christian Graus wrote:

                                        Why ?

                                        Possibly because C# has been shown to be about twice as slow as C++? For a time critical app like a 3D game, that might be important.

                                        B Offline
                                        B Offline
                                        baldricman
                                        wrote on last edited by
                                        #68

                                        bwahahahaha!!!! and 72% of all statistics are made up on the spot.

                                        1 Reply Last reply
                                        0
                                        • L L Viljoen

                                          I have been studying Information Systems programming for two years now, but have always been intrigued by games programming, now there is a campus opening in SA that offers C# 3D Games Programming using Direct X. Now this all sounds very cool since I am a great fan of Java and C# but does anyone know is it possible to create a good game in C# that can compete in the market?

                                          Oliekrokenosterpikkelikkeastrysvoel

                                          A Offline
                                          A Offline
                                          Abrian P Stemmet
                                          wrote on last edited by
                                          #69

                                          Check out this game written in C#: http://www.rocketcommander.com[^] Rocket Commander Tutorials: http://msdn.microsoft.com/coding4fun/gamedevelopment/rocketcmd/default.aspx[^]

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups