Skip to main content
GameDev.net gamedev.net
🔒 Locked

Visual Basic or C++?

Started by X Jado X May 20, 2008 at 1:38 AM 27 replies 4.3k views
Original Post
X Jado X
X Jado X
I know VB6 (learned it in school, yes I know its old as heck). So I know how code works etc. From what I've read though, I want to start to learn C++ to program games.. Should I do this or stick with VB?
ELFanatic
ELFanatic
I definitely suggest you code in C/C++ for a period of time, it'll help you become a better programmer.
Krohm
Krohm
Maybe you could consider C# - it's a bit nicer than C++ and people is doing wonderful stuff with it.
I am pretty sure going from VB to C++ would scare you a bit.
Previously "Krohm"
steveworks
steveworks
From here you could do C# which I hear is easier to use than c, you could do C or you could use that previous experiance and try to learn C++ well its up to you really. It is all about preference and the amount of time you want to put in.

good luck with whatever you choose.
---------------------------------------------------------------------------------------Exercise, eat right and be the best you can be!Translation: Play video games for finger streangth and eat lots of hot pockets to be at top programming efficiency.
ItsDan
ItsDan
You could also consider learning VB.NET which has most or all of the same advantages as C#. You can then transition to C# very easily in the future if you wanted. VB.NET and C# can be translated line for line in almost every case.
-----------------------------------------------“The best, most affordable way to save the most lives and improve overall health is to increase the number of trained local, primary healthcare workers.”Learn how you can help at www.ghets.org
Marmin
Marmin
What strikes me about the former comments is that no one really gives an actual funded reason for using their recommended language.

Also see this recent thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=493961
zacs7
zacs7
> Maybe you could consider C# - it's a bit nicer than C++ and people is doing wonderful stuff with it.
Matter of opinion :) -- certainly not mine!

Anyway, ditch VB6 at least. And the VS6 if you have it -- kind of a fossil now days. You'd probably find anything like Java, C#, etc easy to pick up. Perhaps it is wise to have a stab at C# and then move to C++ if you feel like it.
Cygon
Cygon
I also think C# is a good idea. It doesn't have nearly as many traps as C++ and is a good learning environment.

Its popularity will probably only grow more in the future and with libraries like SDL.NET, Allgro.NET, SlimDX, XNA and Tao.OpenGL (plus all the other Tao libraries) you already have a good choice of well-designed game programming environments.


I do think, however, that maturing one's programming style in C++ makes him a better programmer. C# with its built-in garbage collection and especially reflection often promotes using lazy shortcuts where C++ would force the programmer to create a proper design first. I've seen a lot of people just throw away type safety, use downcasts, invoke methods via reflection and leave open files for the garbage collector to clean up instead of disposing them.

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Wan
Wan
Quote:
Original post by X Jado X
From what I've read though, I want to start to learn C++ to program games.. Should I do this or stick with VB?

What have you read? Or in other words, what is your reason to switch languages? In order to give any sort advice, it helps to know what your intentions are.
mikeman
mikeman
Quote:

I do think, however, that maturing one's programming style in C++ makes him a better programmer. C# with its built-in garbage collection and especially reflection often promotes using lazy shortcuts where C++ would force the programmer to create a proper design first.


I can't understand why so many people equate 'proper design' with 'proper C++ design'. Just because some things don't translate well(or at all) to C++ doesn't mean they signify an 'improper' design. 'Lazy shortcuts'? Sounds good to me. Lazy is good. Who wants to implement a 10,000 LOC monstrocity in C++ when we can achieve the same thing with 5 lines on a reflection-enabled language? I think C++ has made programmers believe that, if a solution to a complex problem is easy, then it must be somehow wrong. Metaprogramming? Surely that is only for gurus. Well, no. It's pretty simple actually. The problem is that C++ has a very miniscule toolset to begin with. That's all.
UltimaX
UltimaX
Quote:
Original post by X Jado X
I know VB6 (learned it in school, yes I know its old as heck).


C/C++ is old too, but that doesn't mean they are no good! Visual Basic puts a roof over my wifes and daughters head so I have no problems with it! I would say it's up to you. However, I would recommend C#. It will be easier to learn, there are a lot of jobs for C#, etc. Either way, best of luck in your adventure.

Quote:
Original post by mikeman
Quote:

I do think, however, that maturing one's programming style in C++ makes him a better programmer. C# with its built-in garbage collection and especially reflection often promotes using lazy shortcuts where C++ would force the programmer to create a proper design first.


I can't understand why so many people equate 'proper design' with 'proper C++ design'. Just because some things don't translate well(or at all) to C++ doesn't mean they signify an 'improper' design. 'Lazy shortcuts'? Sounds good to me. Lazy is good. Who wants to implement a 10,000 LOC monstrocity in C++ when we can achieve the same thing with 5 lines on a reflection-enabled language? I think C++ has made programmers believe that, if a solution to a complex problem is easy, then it must be somehow wrong. Well, no, the problem is that C++ has a very miniscule toolset to begin with. That's all.


It's too hard to compare a low level language with a RAD language too. If you know how to optimize and code properly then there is no reason for 10,000 LOC. I understand what you are saying though. For example, lets look at Visual Basic since it is a RAD environment. Start a project and throw a button on Form1 and you have yourself a window with a button. Doing the same thing in C++ would take thousands LOC by the time you get done dealing with the window procedure and what not. However, they both are great languages and they both can serve very useful purposes. For instance, when I am designing a Visual Basic program for a customer I like to speed parts of it up. I do this by creating a C++ DLL that I can call from Visual Basic. A good example would be doing a CRC32 on a file. I created a DLL in C++ that can do a 2.5 GB file in about 55 seconds. Visual Basic can only handle 2.0 GB files (without using API calls) and there is no way you could compute a 2.5 GB file in Visual Basic that fast. The only way would be to write ASM code and call it from Visual Basic, but who wants to write that when you can do it easily in C++? Anyway, it does have a minuscule toolset, but then again it wasn't meant for beginners either (nothing wrong with the STL though :-)).

(For those that are calling BS on the ASM+VB take a look at this; it's pretty impressive: ASM+VB)

Have a good one.
mikeman
mikeman
Quote:

If you know how to optimize and code properly then there is no reason for 10,000 LOC.


Have you took a look at the source of some Boost libraries like,say, boost::lambda or boost::function or boost::bind or boost::serialize? What they do, through thousands lines of ugly boilerplate code, is a no-brainer in a language with lexical closures and reflection/introspection. Just an example. It's a fact that many things in C++ require jumping through countless hoops; even when you code the best way you can.

And, of course, I'm not comparing C++ with VB6, I'm comparing C++ with a language that features reflection and garbage collection, like C# or VB.NET or Python.
daviangel
daviangel
Quote:
Original post by WanMaster
Quote:
Original post by X Jado X
From what I've read though, I want to start to learn C++ to program games.. Should I do this or stick with VB?

What have you read? Or in other words, what is your reason to switch languages? In order to give any sort advice, it helps to know what your intentions are.

I agree. I don't think anyone here could give you a satisfactory answer without more info.
I mean what made you want to choose between VB and C++ in the first place?
Anyways if you plan on programming games professionally learn C++ since that's the primary language used. In that case you better hurry and get started since learning C++ can take years! If you just want to make games as a hobby you can stick with VB although you'll probably run into some stumbling blocks. Being a former VB programmer myself I mean you will need to make changes in your old code to use VB.NET since it's not 100% backwards compatible and some people would argue it's so different that it's really a new language and I'm one of those. In this case you might as well just go straight to C# since XNA only supports that language officially and the onlything left for VB programers is MDX which isn't even gonna be supported anymore.
p.s. Personally after spending a year now taking classes in C++ I feel like I barely scratched the surface of the language but at least now I can read most of my game programming books which use C/C++ and make sense of them;)
So that's the main reason I decided to learn C++ in my case. A buttload of books that use C++ as the primary language. Now that I know it I still hate using it everyday I have to because I know how much easier and less typing! other languages like C#,Python are in comparison since I learned/used those before C++. I just saw a video on the future of C++ by it's creator and he even mentions C# and how nice it is to use, etc but goes on to say that C++ will never be that easy because C++ is all about performance was his bottom line. If you want to use the least amount of memory and want the fastest speed you need to use C++ was his argument although I'm sure he left out the bit about how Java can actually be faster than C++ now with all the multicore cpu's that are coming out!

[Edited by - daviangel on May 20, 2008 5:40:16 PM]
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
X Jado X
X Jado X
Ok I'm going to try learning C#. Where can I get a good compilier/GUI?
Ezbez
Ezbez
Microsoft gives out Visual Studios 2005 and 2008 Express Editions for free online. Google for them.

Though I do want to say that if your only goal is to make a game, and that's it, then just stick with VB6. You already know it, and it can certainly make games, so if learning C# or becoming a better programmer aren't also goals, then there's no real reason to switch, IMO. You'll save time sticking to something you already know.
TheGilb
TheGilb
This question comes up so frequently, and every time the discussion ends up the same way "use this language, it's the best" or "don't use that language, it's rubbish" but what you have to ask yourself is, what is that language the best at? Or why is that language the worst at something? At the end of the day a programming language is only a tool, you're still just doing the same thing, but that is not to say that all languages are made equal.

Is C# the best at cross platform development? Speaking from experience I can tell you that C# is not supported on Playstation 3, or the Wii. So if you've got to write a game for all 3 platforms, which language is your choice? (Hint: C++ is supported on every platform).

C# has an amazingly powerful visual interface designer, and the semantics of the language including reflection, garbage collection and other modern language features can put C++ to shame in terms of application development.

Truth be known the professional programmer has to be versed in more than one language to get by, after you've learned a dozen or so they all start to look the same anyway. I would consider at least a managed .NET language, a scripting language and a system level language to be the absolute minimum prerequisite knowledge.

If you want to learn how to make games just take your pick. I'd recommend C/C++ because if you want a career in it then at the moment that's what you'll be using, and it doesn't look like that's going to change any time soon. Any programming language knowledge / experience can be helpful, but C/C++ is still leading the way forward in cutting edge (read: next-gen / current-gen) game development.
Ezbez
Ezbez
Quote:
Original post by TheGilb
Speaking from experience I can tell you that C# is not supported on Playstation 3, or the Wii. So if you've got to write a game for all 3 platforms, which language is your choice? (Hint: C++ is supported on every platform).


I really don't think that's a fair comparison. Yes, C++ is "supported" on those platforms, but it requires using either proprietary and EXPENSIVE dev kits or doing homebrew stuff that will only reach a very minimal audience (those that have installed Linux on their PS3s). Further, developing on the xbox 360 is vastly easier in C# than in C++, so C# wins in portability there.

Also, C# doesn't have a "visual interface designer", Visual Studios does, though. And what makes you think that someone making their first game needs C++ because it's "leading the way forward in cutting edge (read: next-gen / current-gen) game development"? No ones first game is cutting edge, nor should it be. The whole career argument is rather thrown out the window by your previous paragraph saying that programmers need to learn multiple languages. Learning C++ is a good thing, at some point, but you agree that all programmers need to know multiple languages, so learning it first or second isn't necessary.
_goat
_goat
Quote:
Original post by Ezbez
Quote:
Original post by TheGilb
Speaking from experience I can tell you that C# is not supported on Playstation 3, or the Wii. So if you've got to write a game for all 3 platforms, which language is your choice? (Hint: C++ is supported on every platform).


I really don't think that's a fair comparison. Yes, C++ is "supported" on those platforms, but it requires using either proprietary and EXPENSIVE dev kits or doing homebrew stuff that will only reach a very minimal audience (those that have installed Linux on their PS3s). Further, developing on the xbox 360 is vastly easier in C# than in C++, so C# wins in portability there.


I think it's a fine comparison:

1) Developing on those consoles requires expensive dev kits. This is true.

2) Those dev kits only support C/C++. You didn't argue this, because it's also true. If you want full cross-platform compatibility (and just imagine trying to fit the C# on the DS! impossible), you'll have to write in C/C++. We're having enough problems getting Lua to use less memory so that it runs on the DS as it is.

3) Developing on the XBox is easier in C#. True if you're only doing Windows/XBox. Not true if you want to do any other platform, because that'll require C/C++, which means you'd have to have two codebases (to support C# on XBox/Windows, and C++ on, say PS3 or Wii), which is of course harder.


Edit: But seriously, X Jado X, use C#.
jpetrie
jpetrie
Quote:

From what I've read though, I want to start to learn C++ to program games.. Should I do this or stick with VB?

C++ is not required to make games. Just about any language will do. So it becomes -- as others have noted -- an issue of what you really want to do: you want to learn C++, or do you want to make games?

If the former, you should fire up Google and search for the free online texts "Thinking in C++" and/or "C++: A Dialog." You should also head over to Microsoft's site and grab yourself a copy of VC++ 2008 Express.

If the latter, then do as Ezbez suggests: stick with what you know. If your goal is to make games, it's more important you learn to make them then diddle around trying to pick a language. All languages have pros and cons, including C++ and VB6. If you a serious about programming you will learn and use many languages in your lifetime; in the long run it will matter less what language you got started with and more that you just got started.

Also:
Quote:

I think it's a fine comparison:

1) Developing on those consoles requires expensive dev kits. This is true.

2) Those dev kits only support C/C++. You didn't argue this, because it's also true. If you want full cross-platform compatibility (and just imagine trying to fit the C# on the DS! impossible), you'll have to write in C/C++. We're having enough problems getting Lua to use less memory so that it runs on the DS as it is.

3) Developing on the XBox is easier in C#. True if you're only doing Windows/XBox. Not true if you want to do any other platform, because that'll require C/C++, which means you'd have to have two codebases (to support C# on XBox/Windows, and C++ on, say PS3 or Wii), which is of course harder.

All of this is certainly valid, as were TheGilb's initial points. Unfortunately, neither this nor TheGilb's initial points have any real place here. This is For Beginners. The support for a language on consoles that the intended audience has no business concerning themselves with is irrelevant to the matter at hand.

Let's not turn this into a thread about the merits of languages in vacuum.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.