Ask Slashdot: Best Way to Learn C# For Game Programming? 254
An anonymous reader writes So I, like many people, want to make my own game. Outside of MATLAB, Visual Basic, and LabVIEW I have no real programming experience. I initially started with Ruby, but after doing my homework decided that if I ever wanted to progress to a game that required some power, I would basically need to learn some form of C anyway. Further digging has led me to C#. The other parts of game design and theory I have covered: I have ~8 years of CAD modeling experience including Maya and Blender; I have a semiprofessional sound studio, an idie album on iTunes, and am adept at creating sound effects/music in a wide variety of programs; I'm familiar with the setbacks and frustration involved with game development — I beta tested DotA for 9ish years; I already have my game idea down on paper (RTS), including growth tables, unit types, unit states, story-lines, etc. I've been planning this out for a year or two; I will be doing this on my own time, by myself, and am prepared for it to take a couple years to finish. The reason for listing that stuff out, is that I want people to understand that I know what I'm getting myself in to, and I'm not trying to put out a not-so-subtle "help me make a game for free lol" type of post. With all of that said, where is a good place to start (i.e., recommended books) for learning C# for game programming? I am familiar with object oriented programming, so that's a little bit of help. I'm not necessarily looking for the syntax (that part is just memorization), but more for the methodology involved. If anyone also has any suggestions for other books or information that deal with game development, I would love to hear that too. I know enough to understand that I really don't know anything, but have a good foundation to build on.
just try it, it's fun (Score:2, Insightful)
You should just start. I'm an "expert" on game programming in C#, and the hardest thing about it is not reading slashdot.
Re: (Score:3)
retrospect, I wish I had invested in python instead. Now that I can use PHP I'll just make scripts there, but python could have been so much more potential for other work.
that being said, I recommend swift, apple's new language for iOS apps. It's go
Re: (Score:2)
Re: (Score:3)
Start simple - very simple. Try breakout, tetris, a board game, etc, then start adding features to learn about those features. Then make the game you really want to do in the same approach - minimum viable product, then flesh it out like stone soup. When the soup's done, ship it!
This.
Except, start with what you know. If you're good at audio, start by writing a program that can receive and handle requests to play sounds. Now, in a complex game like an RTS the sound effects will need to overlap. So for instance in a space-based RTS the roar of a rocket launch may need to overlap with multiple bangs och zaps of plasma rifles and lasers. Once you have a sound program that works well enough you can call that your sound engine.
The best way to learn $foo is to practice $foo. (Score:3, Insightful)
So just do it. Use free tools so you don't spend coin on something until you are sure it's something you'll stick with.
Udemy (Score:4, Informative)
Coursera (Score:4, Informative)
mess around in unity3d (Score:3, Informative)
do the unity3d tutorials and mess around with C# in there. you get to use your 3d skills and actually make something whilst you learn
Re:mess around in unity3d (Score:5, Informative)
True - if you're going to write games in C#, you need Unity. Unfortunately Unity is really Mono so you will have some issues with the toolchain - ie its not as nice as native Visual Studio coding.
But even then, all the games I've seen written in Unity work, but they suck up your CPU like nothing else. If you really want to code games, stick to what most people in the industry use - C++.
There are plenty of engines that help you, like Irrlicht, or Ogre3d. Or go with a commercial engine like Unreal.
Take a look at the list, count the number targeting the different languages.
http://en.wikipedia.org/wiki/L... [wikipedia.org]
Re: (Score:2)
If you really want to code games, stick to what most people in the industry use - C++.
While I agree with you, because C# is too high-level for game programming, Microsoft just released a native C# compiler:
http://msdn.microsoft.com/en-U... [microsoft.com]
This should provide performance almost equivalent to C++.
Re: (Score:2)
you miss the point - its not about performance (though I think the native C++ compiler for C# code shows that Microsoft has stopped willy waving between their divisions and are actually going for stuff that works - performance will still be worse, all that GC going on means C# code tends to be less performant due to the way the language works. A C+ program that allocates and copies memory all the time would be slow too)
Anyway, its the fact that everyone else does it in C++ that matters. A bit like writing
Re: (Score:2)
There are a number of commercial indie games on platforms ranging from Android, iOS, Windows, Mac, the PS3, the PS4, the XBox 360, the Wii, the Wii U and the XBox One written using C# executing via Unity or Mono using something like MonoGame.
C# is not too high level for game programming, it's perfectly adequate. You may start running into issues with it if you're trying to produce photorealistic next gen console graphics with it, but I assure you, if you're an indie developer, you are not doing this, becaus
Re:mess around in unity3d (Score:4, Insightful)
Re: (Score:2)
Unity is mono, not .NET. It uses Eclipse as its IDE.
So if you want to code games in C#, you can't use VS.
Re: (Score:2)
MonoGame is a drop in replacement for XNA and it's actively developed by people who are themselves game developers. It even has some commercial PS4 releases to it's name.
I was skeptical at first, but I've started playing with it and it's absolutely excellent. Most definitely fit for rapid high quality indie game development.
Head First C# (Score:5, Interesting)
Warning: this is blatantly self-promotional. It's also a pretty good answer to the question, I think, so hopefully I won't get violently modded down.
It sounds like you're exactly who Jenny Greene and I wrote Head First C# [oreilly.com] for. I played around with a lot of different ways to teach both C# language and core object oriented programming and computer science concepts, and I found that building games was easily the most satisfying way to do it.
The only way to really learn a language is writing a lot of code, and one of the biggest challenges I had putting the book together was coming up with many different projects. The answer was games: a card games, a turn-based game, arcade games -- it turns out that building a game is a great way to keep readers motivated, especially when they're learning new concepts. I've had a lot of really positive feedback from first-time programmers who found it really satisfying to get through the book, and especially building the final project (a retro Space Invaders game).
You can download a free PDF of the first three chapters of Head First C# from the O'Reilly page [oreilly.com] and see if you like it.
Re: (Score:2)
Re: (Score:2)
Thanks!! It's super gratifying to hear that! :)
C#? (Score:5, Interesting)
Why C#? Develop your game in C++ using OpenGL ES for rendering. Your code will compile as-is for iOS, Android, Windows, OSX, and others. You will only need a couple hundred lines of native code (java for Android, Objective C for iOS, etc) to handle events and pass execution into your C++ code. My game engine runs on all the above platforms and 99.9% of my code is shared across all of them.
Also, these days many, many developers simply use an existing game engine and only bother with the high level code specific to their game. Mundane stuff like the low level rendering, Audio APIs (which unlike OpenGL ES, differ quite a bit from one platform to another), physics, etc, is ground that's been treaded several thousand times nowadays, and most game developers leave that stuff to the experts in the various fields to handle the nitty gritty. Optimization of those routines is usually where the "expert" part comes into play.
I work with a game designer / artist who implements all the high level game stuff in Lua, and my engine takes care of all the aforementioned "boring" stuff, freeing him up to actually develop games, and not worry about crap like polygon tessellation algorithms and tons of other very boring stuff that would just be a waste of his time.
Play with Unity3D (Score:2)
With that said, I suggest you download Unity3D and play around with it. You can do a lot purely visually, and knock yourself out with as much C# scr
Re: (Score:3, Informative)
Yep,
Unity - you would be surprised how many commercial games are using it. Several new independent titles like Wasteland 2, Torment: Tides of Numenera, Castle Story, Kerbal Space Program. Runs on Windows, Mac, Linux, iOS, Android. I also heard that over 50% of the mobile games are using unity (check out "The Room" and "Temple Run" for examples). The scripting language is C#. The workflow is tailored to the visual assets, so it is perfect for someone with your background. The unity engine does a lot of
Re:Play with Unity3D (Score:4, Insightful)
To reinforce this: Building your own engine is a great way to fall into a trap that you won't escape for years if not decades. If you're interested in building a game, then you should build a game, and use the toolchain that lets you get to your game as quickly as possible. Right now that's a race between Unity and Unreal Engine 4, and while neither one has perfect support, I'd say the userbase for Unity is sufficiently deep that it's a better starting point. Don't worry, you'll still get plenty of opportunity to code (and to learn C# - another reason to go with Unity over UE4, if that's the language you really want), but there'll be enough that you don't have to code that you can focus on the fundamentals of building your game.
Re: (Score:2)
To reinforce this: Building your own engine is a great way to fall into a trap that you won't escape for years if not decades.
Hahahaha - I resemble that remark!
Do you even endofunctor bro? (Score:5, Funny)
Forget C#. Start with Haskell and get a PHD in category theory and applied mathematics. Then study GHC internals for several years in order to figure out how to make Haskell fast enough for anything non trivial. Only approach game development once you have a solid understanding of GHC internals, endofunctors, lenses, monoids, monads, comonads, cofree, cofree comands, synergistic cold fusion, rankntypes, multi parameter typeclasses, string theory, functional dependencies, synthesized kinetic energy, generalized new type deriving, existential quantification, existential crisis, scoped type variables, GADTs, the space time continuum and have solved the halting problem. Also reimplement the entire standard library because the current one is terrible and horribly inefficient.
Either that or pick up any of the few dozen C++, C# or Python game development books and start reading.
Re: (Score:2)
I wondered a bit recently about "game programming" and what that really means. This morning on a radio show about maker fairs, one person said her young daughter was on a one or two week game programming camp. It really dawned on me that game programming just does not mean what I think it means. But guess is that the kids must be using pre-build gaming platforms and then scripting on top of it. Similar for the weekend hackathons, they can not possibly be writing a game from scratch, they don't have time
Re: (Score:3)
Do you think it means AAA FPGs and RPSes? The vast majority of games are much smaller scale than that.
It's possible that the game programming camp is setting the children up with a point-and-click game dev engine (although I hope not); but it might well be giving them a framework like PyGame and a lot of help to get a couple of simple 2D games running. If it fosters the kind of experiences that my generation had growing up
Re: (Score:2)
There's no better point-and-click game dev engine for learning than Scratch; if that's what they used, expect the kids coming out to have learned some of the logical skills involved in computer science. Syntax is easy if you've already got a good grasp on splitting up complicated problems into smaller ones, breaking smaller problems down to math and logic structures, and integrating many smaller com
Re: (Score:2)
When I wrote that line, what I really had in mind was a specific platformer-creation tool which was responsible for a rash of crappy games on Kongregate a few years ago, but I couldn't (and still can't) remember the name.
Re: (Score:2)
Free-as-in-FREE-beer! It doesn't make sense the way you say it! Beer is not automatically free!
Choose another language (Score:5, Interesting)
I love C#. I program in it every day. It's plenty fast, and it's a great language.
However, there are two reasons I would suggest looking to another language.
First, the hottest market for gaming right now is mobile. While it's possible to compile C# for iPhone or Android using Xamarin (along with Windows and OS X), it's not exactly a native experience.
Second, C# (like O-C, C++, etc.) is a general programming language -- it's not in any way specific to the domain of game programming. So, while it's *possible* to design complex games in any modern language, you're probably going to spend *way* too much time dealing with silly stuff like tracking graphics resources and animation loops and simulated physics. You'll have a higher chance of success if you use a language and platform that is more game-specific out of the box.
I would suggest looking into Swift -- it'll give you access to the lucrative iOS market, it's C-like, and it has features that are game-specific. Sure, it's a new language it doesn't compile to Android, but by all accounts it looks like a great language with first-class support for gaming, so you can focus less on infrastructure code and more on the game.
Another option would be HTML5. Depending what sort of game you're looking to build, Javascript and HTML5 may be just the ticket, and there are a number of libraries that can abstract away browser differences and assist with the plumbing needed to make a game run.
Re: (Score:2)
What's non-native about Xamarin? It gives you a higher level language, but it still exposes the native platform API directly. To the user, a Xamarin app is native.
Re: (Score:2)
So far as I know, it only (pre)compiles into native code on iOS - on Android, it's a full-fledged VM with a JIT.
But then so is Dalvik, so one could argue that it is at least as "native" as Java Android apps.
Re: (Score:2)
A lot of the mobile games are written using Unity which allows C# to be used on all platforms, from mobile, through PC, and even consoles if you have the dev license for them.
The only issue with Unity is if you need the Pro version be ready to pay some serious money, but for a lot of mobile games the Indie/Free version is fine.
Start with the engine (Score:2, Interesting)
Pick an engine you want to use first, then pick a language to learn that is used by that engine. Very few games now are written purely in a native language with no supporting engine, so pick a modern game engine that will do a lot of the hard, low level work for you. Then, learn the language that is used for interacting with the desired engine. For example, if you wanted to use the Unity engine, then you would basic learn C#. If you wanted to use CryENGINE, then you would learn C++ and Lua scripting. If you
Patterns (Score:5, Informative)
http://gameprogrammingpatterns... [gameprogra...tterns.com]
This site takes a subset of the "Gang of Four" patterns and explains how and why to use them in your games.
You'll especially enjoy the command pattern which will be heavily used in an RPGSgame.
Re: (Score:2)
I would also recommend this; well-written introduction, and talks a lot about the systems-issues that come up in games programming as well.
There is no such thing as "Learn Game Programming" (Score:2)
Re: (Score:2)
Then what are they built in? I've been wondering this because of a lot of stories and anecdotes about quickly built games, hackathons, etc. Is there some sort of "game builder" software that everyone uses, an update of RPGmaker that's actually useful, or...? Having been programming for 30+ years, I haven't seen any programming that is as easy as these hackathons or makerfaires seem to imply it is.
Re:There is no such thing as "Learn Game Programmi (Score:4, Informative)
Surprisingly enough, there is. A lot of game developers use GameMaker to prototype games. But some of them are good enough to be published on Steam straight out of Gamemaker. And it's simple enough that my 11-yr old has been using it for his own game.
Disclaimer: my former prof built it.
There's also Unity3D.
These tools take away a lot of details that used to be 80% of the work, and leave you to work on the *game*, as opposed to rendering the screen without tearing or trying to get the audiobuffer to play without clipping, or... etc.
Unreal 4 (Score:5, Insightful)
If you must write C# you should take a look at Unity, but honestly you would be remiss if you overlooked Unreal 4. It is the newest version of the Unreal Engine, and it includes most of the most important features of a game; behavior trees, navigation, user interface, physically-based rendering, animation state machines, multiplayer replication, etc. You can do most of what you want to in Blueprint (a visual scripting language), and if you really need to, you can edit the source code (the license is a full-source license) and make what enhancements you need in C++.
Writing most of this shit from scratch will take you years, just get down to the actual MAKING of the game, and use someone else's engine. The terms are fair ($20/mo, 5% gross revenue for PC platforms and mobile), and the engine is extremely well curated.
Re: (Score:2)
You Already Know It (Score:2)
Re: (Score:3)
Re: (Score:2)
My Visual Studio 6 runs just fine on Win 7+8, thank you very much ...
Learn something else (Score:3, Insightful)
Unless you want to be locked in to MS? Learn, any of the things that also work on iOS and Android and you may actually end up with an useful skill.
Motivation? (Score:2)
The fact that you're not already coding and Ruby couldn't hold your interest makes me wonder exactly what you want to do and why.
If you plan to learn to code mainly as a necessary step towards creating your dream RTS then I hate to piss on your fireworks, but you're wasting your time. It's just way too much dang work and frustration for something you don't find interesting and exciting in and of itself.
If I got the wrong idea and you do find coding interesting, forget about the RTS for a while and just worr
Build a simple first game ! (Score:5, Interesting)
The reason for listing that stuff out, is that I want people to understand that I know what I'm getting myself in to, and I'm not trying to put out a not-so-subtle "help me make a game for free lol" type of post
I'm sorry, but your long list of "I did this and that" means only that you are a gamer with a few artistic skills, it has absolutely no value for game programming !
During my 18 years of game programming, I met a lot of people that had "wonderful" ideas (it's funny how everybody has a dream game), but no skill to realize them.
They always boasted about the fact that their idea was great, but their project never got released.
Writing a game requires the following skills:
1) technical skill: coding
2) art skill: graphics/animation and sound/music
3) gameplay skill: making the game enjoyable
4) story telling: making a coherent game's universe
In my life, I never met a single person with all of these skills, at a decent level.
The most talented ones had only 2 skills.
Firstly, before coding your dream game, try to write a very simple game. It will show you where you'll need help.
If you are a beginner, you won't be able to code Starcraft.
Try something related to your project, so you can increase your knowledge.
Secondly, since most of the CPU power is spent on display and AI, you'll need to learn:
1) how to optimize the display.
Since the whole screen needs to be redrawn very frequently, you have to learn techniques to render fast.
There are tons of techniques in 2D and 3D.
2) AI algorithms, most notably path-finding algorithms if you want to program a RTS.
Thirdly, try to build a prototype in one month.
If you are able to build it in one month, you'll probably be able to work on your project during several months.
It will also show that you don't lose yourself on details (non-professionals tend to waste their time on small details, thus the final goal disappears).
If you are unable to build it in one month, it means that your project is not well defined, probably too ambitious or completely unrealizable.
Fourthly, I would recommend to build a motivated team around your game.
This is a virtuous circle: when your motivation will decrease, they'll encourage you and when they'll get demotivated, you'll encourage them.
Nowadays, I believe that it's impossible to write a game alone, unless your game is very simple.
Find people who believe in your project and who may help you.
Re: (Score:2)
I first want to say that I agree with much of what you've said, especially about starting small.
But...
Notch has shown us (yet again) that #3 is really the only one that matters.
Early Minecraft was not well coded. It still doesn't have great graphics or sound (though I do like the music) and there really isn't much of a story.
You don't even have to play the story part of the game to have hours and hours of fun and Mojang is doing quite well for themselves.
Re: (Score:2)
You are building a rule from a single example.
Notch is an exception, and I have a famous counterexample: Carmack/Romero.
Romero focused on gameplay while Carmack focused on technics.
When they split, Carmack continued to produce hits, while Romero had a lot less success.
What I wanted to say is that you'd better be excellent in a domain, but you cannot expect to succeed if you can't find people to address your weaknesses.
About Notch, he focused on a concept, like some rare authors. I met 2 of them in my life,
Re: (Score:2)
Want to learn how to make a game? Just do it. (Score:2)
Then I messed around with the trigger editor in Starcraft.
Then I messed around with the trigger editor in Warcraft 3 and made a lot more complex things, including implementing the character progression system from a single game from a popular Japanese RPG series -- which shall remain nameless
Find a mentor, and write automated tests (Score:2)
Other people have suggested how to learn the basics of a language, so I'll ignore that problem.
Designing and writing good code is an art form. There are many anti-patterns you may fall into that could doom your project that a more experienced developer can help you avoid.
A couple hours a week spent explaining your design before you start writing code, or helping to track down why your code doesn't work as expected, or reviewing the code you believe is finished, will save you days of wasted effort.
Structu
Re: (Score:2)
Oh, and point 1.5 should have been; Source control!.
When you get something working, commit it. It's like the scientific method, if you can't reproduce something it doesn't exist. Source control gives you confidence to experiment, knowing that you can easily undo everything without losing something that you know works.
H1B and the will to work 60-80 hours a week no OT (Score:2)
H1B and the will to work 60-80 hours a week with no OT pay.
And you just need to be a sub par coder as well.
The very best book for C#? (Score:3)
Google.
I'm 100% serious. I learned C# that way and wound up writing the application code for a product that sells for about 5 million a year.
Here is your task, since you're interested in making games. Make a game of pong in C#. Use Google to look up how to do it. Start with a hello world program. Then make a program with a form. Then figure out how to paint to it. Keep going.
At the end of the pong game you'll know enough to be dangerous. Good luck!
Re: (Score:2)
Re: (Score:2)
I've been thinking about this, as my daughter has asked me to teach her some programming, and quite honestly, the progression of games in real life is perfect.
Make pong. Make death race 2000. Make Asteroids. Make Space Invaders. Make Tetris. Make a platform jumper with static screens with transitions at the edges. Make a side-scrolling jumper. Keep working your way up.
Coding for kids (Score:2)
My six year old son spends a lot of time on this learning-to-code site. I think his kindergarten teacher introduced him to it. It's probably the best thing I've ever seen for teaching kids coding.
Click on a starter project. Click the green flag to run the program. Click "See Inside" to look at the code in their editor. It's visual, easy to read, and quite elegant.
It really is a completely fantastic site. Brilliantly done.
scratch.mit.edu [mit.edu]
There is Coursera training for (Score:2)
About the Course
The Beginning Game Programming with C# course is all about learning how to develop video games using the C# programming language. Why use C# instead of C++, Java, ActionScript, or some other programming language you may have heard of? First, using C# lets us use the Microsoft XNA and open-source MonoGame frameworks, which help us quickly develop games for Windows, Android, iOS, Mac OS, and others. Second, the Unity game engine is very popular with in
Unity3d (Score:2)
It's free. It's fun and there is a large community of people doing tutorials and videos and answering questions.
Just dive in.
programming a game is the same in any language (Score:2)
I was thrown into the deep end with C# best way to learn it is to do it, that should be a no shit for anyone who has written in any language ever
programming a game however requires a totally different way of thinking about the problem at hand, and it doesnt matter the language, its the methodology of writing a game, just like writing a db app is different from writing a website
quit asking dumb questions, its a new to you language, do what you can and figure it out, god knows there's enough resources out the
Your Scope is Too Fucking Big (Score:2)
Lua (Score:3)
If you really want to learn to program games, start with Lua instead of C# or C++. It's a tiny little scripting language that can be learnt in a few hours and is used by an enormous number of game development companies. Lua is often tasked with providing a UI for the game, logic flow, rapid prototyping of features, anything really except for the critical loops - which are all handled in C++.
Once you have Lua under your belt you should learn C++, because at the heart this is what all performance sensitive games are written in. The game engine will be a mess of tight, sometimes obscure C++. If you want to make changes that are at that level then you absolutely need to be able to write C++.
Finally, think about learning C# if it's supported by the game engine you have chosen to use for your game. It should perform about the same speed as the Lua code and it's used for the same tasks - game logic, etc.
Since you're a beginner, I'd recommend you go with either Unity or Unreal Engine as these are both easier to learn and have a lot more community support. Unreal Engine now comes with the complete source code in C++, so you can take a solid look under the hood and see what's happening in there. CryEngine is moving towards releasing more of their source code, but are not there yet.
Really your first question should be which language to learn, but which engine to learn. The engine will dictate which languages you need to learn from there.
Learn Game Programming - Not C*!# (Score:2)
You have a more important problem than which language to chose. The most striking thing about your post is it sounds like you have grand designs for a game (your first game) and that's a bad thing. What you are doing is what almost every new game developer attempts to do... or at least thinks about: going in too big, running before you can walk, building a supersonic jet before you've built your first paper plane etc etc...
Sure you have programming experience and sound design and 3D modeling experience. But
C# != C (Score:2)
Hasn't anyone noticed that? Rithet there in the right up? C# is more like Java. Either that is a typo or the poster is clueless. So what what does the poster really want, a C# like language or a C/C++/Objective C type language?
Existing map editors (Score:2)
So I, like many people, want to make my own game. Outside of MATLAB, Visual Basic, and LabVIEW I have no real programming experience. I initially started with Ruby, but after doing my homework decided that if I ever wanted to progress to a game that required some power, I would basically need to learn some form of C anyway. Further digging has led me to C#. The other parts of game design and theory I have covered: I have ~8 years of CAD modeling experience including Maya and Blender; I have a semiprofessional sound studio, an idie album on iTunes, and am adept at creating sound effects/music in a wide variety of programs; I'm familiar with the setbacks and frustration involved with game development — I beta tested DotA for 9ish years; I already have my game idea down on paper (RTS), including growth tables, unit types, unit states, story-lines, etc. I've been planning this out for a year or two; I will be doing this on my own time, by myself, and am prepared for it to take a couple years to finish
I don't have any gaming programming experience and a lot less programming experience than you do already.
You mentioned a lot of details but failed to mention if you'll be targeting a particular platform. For instance: will you release you game for sale/free? Is a mobile version ever a possibility? Will you release it for the "Windows Store"? Steam? Both? Neither? Is this just a hobbie no one else will ever see? A resume bullet point?
Anyway, speaking not as somebody who has done what your describing but
Re: (Score:2)
I'm not going to argue that C# is faster than C++, but 1000x seems a bit surprising. I'm also not sure why you say that C# requires a desktop OS?
Re: (Score:2)
Re: (Score:2)
Re: (Score:3, Informative)
C# is typically slightly slower than Java so....
Citation please? In my experience C# is somewhat slower than native code but much faster than Java.
Re: (Score:3)
It would be hard to make a programming language slower than Java, even if you tried.
1996 called and wants its Java insult book back.
Re: (Score:2)
sorry, that 1996 insult book is still largely up to date. java is slow and resource hungry compared to well written equivalent native C/C++.
Re: (Score:2)
Java is still slow. But unless you're using it for heavy number crunching, you won't notice it on a 2014 computer like you did on a 1998 computer.
Re: (Score:2)
It would be hard to make a programming language slower than Java, even if you tried.
Actually, the problem with Java isn't as much that the language itself is slow but that most of the GUI frameworks (particularly older ones) are slow.
Re: (Score:2)
[Citation needed]
If anything, they should be comparable.
Re: (Score:3)
C# is typically slightly slower than Java so....
Which means, just as GP AC said, it's completely unsuitable for a "serious" game.
What OP needs to learn is C, or at a minimum C++. Nothing else will fly for this application. Rudimentary games can be done in other languages, but anything that really needs fancy graphics or fast processing will need C++ or C.
Re: (Score:2)
but anything that really needs fancy graphics or fast processing will need C++ or C.
Totally incorrect. Anything that needs fancy graphics just require an SDK with access to a fancy graphics processing engine. I've written games in Java that use OpenGL on the backend. You don't need the language to be C or C++ to access OpenGL. As far as fast processing requirements, I guarantee you most games don't actually need processing that would not be fast enough in bytecode but would be fast enough in native code.
Re: (Score:2)
There are a load of very detailed (fancy) 3D games using WebGL, not rudimentary at all.
Yes, and they are SLOW.
Crank them up to anything like a "decent, modern" FPS gaming (or even RPG gaming) resolution, and watch the framerate hit the floor.
Sure, it's getting faster. But you're missing the point. While WebGL and the like are getting ever faster, due almost entirely to better hardware, guess what? C++ or C are also getting faster at the same rate. Allowing better, faster, better resolution and more realistic games.
So he STILL needs to learn C or C++ if he's serious about writing game
Re: (Score:2)
Yeah and that code is calling what amounts to libraries all written in C or C++.
Re: (Score:2, Troll)
everything is faster than java
Re: (Score:2)
everything is faster than java
Especially your mom.
Naturally, she won't do garbage collection.
Unless your platform requires C# (Score:5, Informative)
Everyone I know that tried it, gave-up on it.
Except for those people who had to target a platform that requires verifiably type-safe CIL that targets the .NET Compact Framework. Xbox Live Indie Games was this way, as was Windows Phone 7. Practically the only language that produces such bytecode is C#, as standard C++ as compiled by C++/CLI is not verifiably type-safe and IronPython requires Emit which isn't part of the Compact Framework.
the C++ code ran on a server instead of a desktop OS like C# requires.
Windows Server is a server operating system whose NT kernel is inspired by the architecture of Digital's VMS. It runs C# in the .NET Framework. FreeBSD is a server operating system. It has a port of Mono, a .NET Framework workalike, called BSD#.
Re:It's too slow. (Score:5, Insightful)
I'm pretty sure the reason your payroll calculator written in C# was that slow had nothing to do with the .net framework and everything to do with something you failed to optimize in that version, but did optimize in the original Cobol version. Either that or you were running it on a way slower computer - a "desktop OS" rather than a "server", even though those terms are pretty meaningless and there should not be any reason you would have to run it on a desktop machine? Unless, of course, you're defining "server" as "machine that doesn't run Windows", in which case, that's pretty no-true-scotsman-like. You can make a plenty fast Windows server machine, then run headless, server-like C# programs on it.
Yes, obviously C# programs aren't going to be quite as fast as equivalent c++ programs - you *are* compiling C# code to bytecode and then running it through a virtual machine, so of course it'll be a little slower. But only a little. I doubt you could write a balls-to-the-wall Crysis-like shooter in C#, but I don't imagine there'd be any performance-related reason you couldn't write an RTS in C# and have it run just fine on any machine not so old that its OS wouldn't support the .net framework anyway.
Re:It's too slow. (Score:4, Informative)
C# doesn't 'run through a virtual machine' - CIL bytecode is 'always' JIT compiled to native machine code in both Microsoft's .net platform and in Mono.
The only overhead/problem here is quality of the JIT (you need only look as far as ECMA 262 to see how much difference that can make, eg: JaegerMonkey vs. V8), CIL JIT has type checking requirements - so there's once-off validation overhead for each JIT, and lastly unlike C/C++ your JIT compiler rarely has (or wants to have, due to memory and performance considerations) a complete view of the entire program - so you don't get anything remotely similar to link-time optimisations.
That said - for relatively flat code structures - well written C# will JIT into, in many cases, identical instructions to what GCC/Clang/MSVC will do for equivalent C/C++ code.
The primary differences are around exception handling and boxed types. Neither of which you're going to be using heavily in performance critical code segments in C# anyway - because all of them can be avoided with well written C# or some unsafe magic.
Re: (Score:3)
Re: (Score:2)
" I doubt you could write a balls-to-the-wall Crysis-like shooter in C#, but I don't imagine there'd be any performance-related reason you couldn't write an RTS in C# and have it run just fine on any machine not so old that its OS wouldn't support the .net framework anyway."
You might be surprised to discover you are completely wrong on this account. I'm currently write a game using the CryEngine 3. The code comes as a mix of C++, Lua and Flowgraph (a graphing system that allows rapid prototyping). There's a
Re: (Score:2)
Considering that he's a beginner: Badly optimized C++ code is slower than well optimized C# code. Or, in another way, if you're new to programming and optimization is the least of your problem (because getting that damn thing to compile and do what it is supposed to do is a much bigger one), it doesn't really matter that much...
One thing has to be said for C#, as much as I am a subscriber to the "If C is Play-Doh, and C++ is Lego - C# is Duplo" philosophy, it does allow to get results fast without having to
Re: (Score:2)
One thing has to be said for C#, as much as I am a subscriber to the "If C is Play-Doh, and C++ is Lego - C# is Duplo" philosophy, it does allow to get results fast without having to use a ton of libraries that in the end weigh you down more than C# would.
So in other words, C# gets results fast without having to weigh you down more than itself would?
Re:It's too slow. (Score:4, Interesting)
Re: (Score:2)
Aren't they in the process of deprecating C# use in the Unity engine?
Re: (Score:2)
Re: (Score:2)
The maker of Flappy Bird would like to disagree. So would Vlambeer Studio. And a whole host of small indy gamestudios.
Re:You have to pay $$ to use C# in a game. (Score:5, Informative)
I use unity. Like you say, if you make more than $100K per year, then you need to buy pro.
But really, who cares? $1500 - $4500 (depending on what you need) is a very reasonable price for the tool, and an insignificant cost at that point. The cost of writing games is orders of magnitude higher than that, and Unity will end up saving you more in time than $4500 worth of programmer's time. They don't even charge royalty.
Also, why a trap? The terms are clear and you know them up front. Nobody is deceiving you into paying for something you did not want. From my point of view, the terms are quite generous and reasonable, and if you don't think so, then you simply use other tool and this does not affect you
If you have to pay $4500 because you are making $100K/year , it is a very nice problem to have :).
Re:Take a free class (Score:5, Informative)
Three of us took that "Beginning Game Programming with C#" Coursera course. Two of us were professional programmers (myself a professional game developer) so we blew through the course; our third was a gaming buddy who wanted to try out programming -- he was an excellent gamer but had never done any programming. (Back in the day he had done a little shell scripting on Windows.)
The coursera is NOT a beginner friendly course -- it had two major problems:
* it teaches concepts in the wrong order, and
* doesn't explain key critical concepts at all, or extremely poorly.
My buddy dropped out after a few weeks because he just felt completely lost. We would spend hours going over concepts with him and he would get most of it. But when it came to the assignments he didn't have enough of the big picture and low level details to reason things out. IMHO there are better lessons out there, such as:
* http://www.codecademy.com/ [codecademy.com]
* http://learn.code.org/hoc/1 [code.org]
Which is a shame too, because the professor is actually friendly, and has good intentions.
MOOCs are "famous" for having a 98% drop-rate. Seriously, like 20,000 students signed up. Very few made it to week 5.
Re: (Score:2)
Re: (Score:2)
At least his sentence compiled, but a little more debugging may be required.
Re: (Score:2)
I already know C++ and like it quite a bit but if you want to use C# for games you might as well give Unity a try. I've only worked on small projects (and as a one man team that's all I really can do) but it's fun and powerful enough for everything I want it to do.
Re: wrong (Score:2)
"None of the major engines use it."
Unity uses C#.
Re: (Score:2)
Re: (Score:2)
Maybe they are just trolling?
Any question about programming on /. is bound to start several arguments about which languages do what and blah blah blah.
To the OP, if not trolling, Pick a language, any language and just try making simple 2d games for awhile. Try recreating classic games like pong (very simple) to space invaders and tetris. You don't need to worry about engines or anything so much as the graphics are simple and the games themselves are easy to tweak and experiment with. Then once you have a