Jump to content
  • Advertisement
Sign in to follow this  
jwbowyer

Programming knowledge in general - beginner in C

This topic is 3701 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A year or so ago I decided to grab a book on C++ programming. I had previous programming knowledge, creating a few 2D sidescroller games that resembled Galaxian or Raiden type games, but I knew C++ was a very complex language, so I decided to get the For Dummmies version; hoping to start myself out on something simple before moving on to heavier books. But after buying the book I never really touched it, losing interest in it. But recently I've gained interest in programming, and have cracked open the book and started running through the lessons. I came to the forums and started browsing through them, I really don't understand what most people are talking about in relation to C, but I glean a few bits of knowledge from it. In a few topics of starting programmers who want to learn C++, users are recommending C# as a much better alternative. I know that C++ has no graphical capabilites, and is outdated in some aspects with alot of older aspects still engrained into the language. So I have a few questions. 1. What are the advantages to C#? 2. Is the language of C# similar to C++? And if it is, can I keep teaching myself out of this C++ book or would it be better to discontinue it? 3. And does C# have graphical capabilities built into it where I could start doing some simple 2D games, or would I need to figure out how to use libraries to start on that?

Share this post


Link to post
Share on other sites
Advertisement
some quick responses:

1) C# has garbage collection, so unlike c++ you don't have to really clean up after yourself. It also has the .NET framework, so you have quite an extended library of ready available objects, containers and helpers for all sorts. Everything from window creation, to networking and DirectX.

2) It's 'similar', kind of. I've always thought of it as some kind of hybrid of Java and C++

3) C# is pretty much inseparable from the .NET framework, so you have all that cmes with it. This includes the console and window.form naespaces, along with some GDI and DirectX stuff.

If you intended to go the C# route, take a good look at the .Net docs.

Share this post


Link to post
Share on other sites
Quote:
Original post by jwbowyer

1. What are the advantages to C#?


It allows you to get more done with less work.

Quote:
2. Is the language of C# similar to C++? And if it is, can I keep teaching myself out of this C++ book or would it be better to discontinue it?


If you're trying to learn Spanish, using German dictionary will not help much.

If you intend to study languages and literature, using multiple dictionaries may be helpful or even required.

Short answer: You cannot use book for C++ to learn C#.

Quote:
3. And does C# have graphical capabilities built into it where I could start doing some simple 2D games, or would I need to figure out how to use libraries to start on that?


Yes, it has capabilities. Doesn't mean they're trivial.

Your best bet to start would be one of those game maker type of applications. Hopefully someone will provide some links.

When learning a generic language with no previous experience and being self-taught, it'll likely take a year before you can start considering making first graphical application.

Share this post


Link to post
Share on other sites
Thanks for the replies. Not exactly sure how to use the .net framework, hopefully a starter book on C# will help me with that.

Quote:
Short answer: You cannot use book for C++ to learn C#.


I did not mean to teach myself C# using the C++ book, but until I get a book on C# is it worthwhile to continue teaching myself C++ so as to gain a greater understanding of the complexities of the C languages in general, or would it only serve to confuse me?

Quote:
When learning a generic language with no previous experience and being self-taught, it'll likely take a year before you can start considering making first graphical application.


I do have a good amount of previous programming experience, and I have coded games before, albeit in Blitz Basic. So I don't think I need to use the game maker application, as I believe that only serves as a drag and drop game creator with some optional scripting stuff.

Or are you referring to no previous experience in C that would require a year of self taught reading to make my first graphical application?

Share this post


Link to post
Share on other sites
Quote:
Original post by jwbowyer
2. Is the language of C# similar to C++?

Besides the basic, superficial syntactic similarities: no, not at all. C++ and C# are two different languages with different philosophies, capabilities and goals.

Share this post


Link to post
Share on other sites
Quote:

Not exactly sure how to use the .net framework, hopefully a starter book on C# will help me with that.

Don't worry about it too much. You use the .NET Framework when using C# on a Windows machine pretty much automatically -- part of the framework is the CLR implementation that actually executes the compiled C# code, et cetera.

Quote:

I did not mean to teach myself C# using the C++ book, but until I get a book on C# is it worthwhile to continue teaching myself C++ so as to gain a greater understanding of the complexities of the C languages in general, or would it only serve to confuse me?

You're already confused. The "C languages" are related largely in superficiality. That is, they all include 'C' in their name and they all have a syntax that looks more or less the same. However, actually using the languages in their most-modern incarnations is really a completely different experience for each. In that sense -- actual usage, which is what you seem to be concerned with -- it's not a great idea to consider them that tightly related.

This is less true of older C and C++ standardizations (or pre-standardizations) but that's mostly beside the point.

Quote:

Or are you referring to no previous experience in C that would require a year of self taught reading to make my first graphical application?

I can't speak for Antheus, but this is generally an accurate statement, depending. With previous programming experience, and depending on how efficiently you learn, you may be able to move on to graphics in C sooner. But some people take longer. It will, in general, take less time overall in a higher level language like C# than it would in C or C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by jwbowyer
Not exactly sure how to use the .net framework, hopefully a starter book on C# will help me with that.


It becomes evident after spending a couple of hours with C#.

Quote:
Original post by jwbowyer
I did not mean to teach myself C# using the C++ book, but until I get a book on C# is it worthwhile to continue teaching myself C++ so as to gain a greater understanding of the complexities of the C languages in general, or would it only serve to confuse me?


C# is fairly similar to C++, so learning C++ will not be a great hinderance in the future (C# is entirely class based). C# disallows somethings (such as const, templates), and includes a number of other useful features (generics, properties...). But they are all languages in their own right...

Quote:
Original post by jwbowyer
Or are you referring to no previous experience in C that would require a year of self taught reading to make my first graphical application?


Not sure i agree with Antheus here. I will say that coding up a full game is likely to be a big achievement in a year (i.e. probably un-realistic beyond pong and basic 2D games), but making code with a graphical output is not going to be beyond the realm of possibilities.

With C# you'd probably want to look towards the Tao openGL wrapper, SlimDX wrapper around DX, or the XNA framework. I'd probably say that OpenGL would be easier initially, but get harder as you progress. XNA and SlimDX are probably more difficult to grasp initially, but once you do may prove to be easier to use (i.e. only one way to draw geometry instead of the 10 or so in openGL). With C/C++ you are basically looking towards a choice of directX or OpenGL. I'd probably agree with most people's opinions here though, and say that generally C# is easier to use and learn (a more productive language).

Share this post


Link to post
Share on other sites
Quote:
1. What are the advantages to C#?
2. Is the language of C# similar to C++? And if it is, can I keep teaching myself out of this C++ book or would it be better to discontinue it?
3. And does C# have graphical capabilities built into it where I could start doing some simple 2D games, or would I need to figure out how to use libraries to start on that?


Okay to answer these questions, (I'm a beginner that have tried little C++ and C#):

1. What are the advantages to C#?
Productivity. Rapid application development. C# is about developing applications fast. It's also surprisingly readable. I've read somewhere that C++ application that took 1 year to program, could have possibly been created in C# with only 3 months of development time.

If you hate things like pointers in C++, well, you won't have to use them in C#. I am a novice, but I've never seen any reason to have pointers yet in C#.

2. Is the language of C# similar to C++? And if it is, can I keep teaching myself out of this C++ book or would it be better to discontinue it?
Yes C++ and C# have great similarity, if the book seems to be helpful and productive to you, keep reading it. But it's not necessary read to understand C#.

3. And does C# have graphical capabilities built into it where I could start doing some simple 2D games, or would I need to figure out how to use libraries to start on that?

C# has graphical capabilities built into it. I think it's called GDI+? Although technically that might be a part of .NET and not C#, not sure. But as other people have told me.. check out XNA. Search for beginner XNA tutorials. I've found webcasts and videos all over the place, and "starter kits", that have pre-generated code using the XNA engine. YOu can also port your games to Xbox360 or keep it on PC.

Share this post


Link to post
Share on other sites
Some awesome posts here that I'm reading. Thanks for all that posts.

From what I'm reading learning C# seems to be a very good idea. So if anyone has any good book recommendations I'd appreciate it. And if I understand it .NET and C# look to be almost inseparable, so I guess I'll figure it out.

These mentions of the XNA, OpenGL and Direct X wrappers. What are they? I'm guessing that they're somehow initialized in the game code and add extra commands dedicated to making game and graphics programming easier? Or am I wrong and is it something else?

Share this post


Link to post
Share on other sites
Quote:
These mentions of the XNA, OpenGL and Direct X wrappers. What are they?
The ability of a language to show something on the screen, or handle keyboard input, or play a sound, is not built into the language itself. Instead, you rely on libraries (prewritten code) that expose that functionality to you in a certain language. For C#, the biggest library would be that from the .NET BCL (which is what essentially people are referring to when they say .NET).

DirectX and OpenGL are two standards that allow you to work with graphic cards. You can read up on them, but part of what they give you is a library of code. For OpenGL, this library is in C, and in DirectX in C++. So you can’t use them directly in C#. Projects like Tao.OpenGL and SlimDX give you C# APIs in place of the C and C++ APIs.

XNA (by Microsoft) is a giant brand really, but usually people refer to the XNA Framework or Game Studio. XNA is a giant library that helps in making games, and the graphics portion of it is handled by DirectX.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!