Page 1 of 2 12 LastLast
Results 1 to 40 of 55

Thread: vb and c++ differences

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    Moving to Connecticut
    Posts
    26

    vb and c++ differences

    I know this is probably a dumb question but, what is the difference between VB and C++? Or..What are the pros and cons of the languages? I've never tried programming a game before, but I'd love to try it.

  2. #2
    New Member
    Join Date
    Jun 2001
    Location
    Ontario Canada
    Posts
    4
    Well, for one thing, Visual Basics was programmed in C++
    And C++ is closer to machine code then VB, making it that much better.
    Lt Commander Vince

    http://www.geocities.com/shorty718 - Just Drums
    http://www.canadaclassicrock.com

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    VB isn't fully a OOP language, ie. you can't really use class inheritation.

    Also VB does not officially support pointers.

    VB code needs an interpreter while C++ code is compiles.

    C++ ist faster

    In C++ you can include ASM code directly.

    in C++ you need to do more things by hand... ie. you can pre-define functions, better said you need to

    You can include files (damn VB this is so usefull !!!)

    If you're doing small things C++ might be much complicater

    ---

    Just to mention a few...

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Hey stop dissing VB.

    - When making Windows apps (look & feel of windows, etc.) VB is the way to go!
    - If you use DirectX for your games, it just doesnt matter if you use VB or C
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    In VC++ you can make windows as in VB...

    If you're using DirectX in VB you can access a great library *nearly* as fast as in C++... but say you want to make seriuos games you are just lost in VB

  6. #6
    New Member
    Join Date
    Jun 2001
    Location
    Ontario Canada
    Posts
    4
    PRO - you can make a VB app. look more like a Windows app.
    CON - VB is slower
    Lt Commander Vince

    http://www.geocities.com/shorty718 - Just Drums
    http://www.canadaclassicrock.com

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    you can make a VB app. look more like a Windows app.
    Erm, windows is made in C, VB is made in C, and Excel and Word and everything other, too...

    how come everyone thinks in C you need to make DOS programs or these stupid Borland C++ -buttons with icons and rounded border???

  8. #8
    Zaei
    Guest
    VB is Object Oriented and does have pointers (although you never actually see them =). Defining a variable as say, a TextBox, is really defineing a "Long", and allocating memory for the textbox object. And yes, you can use inheritance, but it sucks =(. Look up "Polymorphism" or something like that in the MSDN for more info.

    VB DOES compile to native code, but it relies on several VERY large runtime DLLs for built in functions. VB apps ARE use API calls under the surface, so its much easier to create a GUI really fast. Probably the biggest reason VB is so slow is because MS doesnt have any competition against it, so they have no real reason to spen a lot of time optimizing the VB compiler. VC++ on the other hand, has lots of competition, so they have to make their c++ compiler optimize your code much better. VB also has to make assumptions, for it to hide certain things away from the beginning programmer. You really dont want to see what an "Event" looks like in C++ =).

    On the other hand, the way the VB IDE is setup is better in my opinion. The VC++ IDE is kinda shaky when it comes to Intellisense, and that kind of thing.

    As was said earlier, VB will get an app up and running, and is quite adequate for most games, but if you really need to get down into the system, C++ is the way to go. It may be a bit more complicated, but it pays off in the long run. And even then, VB is still of much use for creating Map Makers, etc =).

    Z.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    Moving to Connecticut
    Posts
    26
    This is probably another dumb question...Is it possible to make 3D games? I guess that's what the Direct "3D" is all about...What should I know about, before making vb games?

  10. #10
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Well of course you can make games in VB... but depending on how good they are it's even difficult or impossible in VB. Direct3D is part of the DirectX package and in the meantime it's called DXGraphics (which also contains DDraw, the 2D part of DirectX, now).

  11. #11
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    3d

    With a few good sites, a copy of DirectX8 SDK and 3 weeks, I made myself a 3D program. It lacks some of the maths components though. Eg.. collision detection and Gravity. lol
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  12. #12
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah, the only bad thing in VB is slowness

    But I'm writing a game that uses special effects (including real-time calculated fire in the player's ship), made in pure VB - and it's quite fast, running at about 30 FPS with no delay on my P800

    So it's not that slow after all - but I might have to make a DLL version of the special effects for the final version.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  13. #13
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Yeah you can always say 'it's fast enough' - but compared to C/++ it's just slow...

    30 FPS is enough, but Quake3 (sorry but I think it has better graphics than yours) runs with 120 FPS on my P800 and that's slightly faster

  14. #14
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hehe I know, but was that speed on the VB IDE while running an heavy visualization plug-in on Winamp?

    I *had* to break down the FPS, because it was too fast
    All I have now is a debug message called "frame delay"
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    Moving to Connecticut
    Posts
    26

    an example?

    can someone send me their stuff? I'd like to see "VB3D" in action hehe

  16. #16
    Megatron
    Guest
    Basically C++ is better for smaller, and faster code (All-Purpose)
    VB is good for RAD, and Databases.

  17. #17
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    C++ is good if you don't want your program to take up nearly 2mb for "Hello World"

    C++ with TINYCRT from Microsoft...no runtime support at all...2K...yeah...
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  18. #18
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312
    heh, i made a c++ program that took up 512kb once, all it said was, I MADE A C++ PROGRAM, WOOOO, and it took up that much, ic an do that in VB and it takes up much less..

    assembler, no THATS the language you wanna learn, c++ was made in that!

  19. #19
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Ok then.

    C++ = 50K program, no dependencies
    VB = 10K program, requires 2mb of runtime support files

    No contest

    And yeah, ASM kicks everything else but there's little use for it now since it's so hard to program in. It's nice for spot-optimising though
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  20. #20
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Your hello world program was probably really big because you were still in debug mode

  21. #21
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    It depends on the compiler, ie. MS VC++ makes your program really BIG (compared to others) but compiling doesn't take too much time...

  22. #22
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Ummm...the VC++ compiler makes some of the smallest .exes I've seen
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  23. #23
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    I heard this discussion so many times

    well I have a question somewhat related:
    is there any good page or good book, to learn C after already knowing VB, (also german books in case fox knows some). I really don't feel like reading what a variable or command button is, just because I want to learn C.

    Anyone?
    Sanity is a full time job

    Puh das war harter Stoff!

  24. #24
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I can recommend you 'Visual C++ in 21 days' (german if you want), I also bought it to learn C++ after already knowing VB and it really shows you the important things... it teaches you lot about MFC and C++ in general, but after all you can directly step on to DX coding like in VB..

  25. #25
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Don't learn MFC until you're very good at C++. Unlike using the API, MFC demands a considerably higher level of expertise.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  26. #26
    Zaei
    Guest
    Assembly is not all that hard to read, but you have to know what you are looking at, and exactly what it should be doing.

    VB executables are small, VB programs are not. VC++ can create very large executables, but it can also create very small ones. It all depends on your compiler options.

    Also i doubt that VC++ was written in Assembly, although it does compile C++ code into assembly language instructions (as do all compilers). VB does the same thing, so the "VB was written in C++ so its slower" argument is invalid.

    For myself, I think that if you dont include an FPS counter, as long as it looks smooth, no one will care >=).

    Z.

  27. #27
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    Thanks fox for the book thing. I never trusted a 21 day thing. I think I will need a little longer till I could claim to know the language.

    and about that:
    VB was written in C++ so its slower
    that seems pretty funny to me, because it's not like VB is interpreted by C while interpreting its own VB programs . We live in the time of compilers people
    Sanity is a full time job

    Puh das war harter Stoff!

  28. #28
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    See the FAQ in the C++ forums if you want free online books and tutorials.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  29. #29
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    I'm in a similar situation, I was studying VB and now have decided to go to VC++ mainly because of it's power/speed and the fact that I like to create things almost from scratch and like to know how a language like VB is making things so easy.

    Most VB programmers don't realise how much VB is doing for them.

    What is better to lean first C++ or VC++ I already have two books on VC++ and stated one of them about 4 days ago. Am I right in saying if I lean VC++ I will know C++ properly?

  30. #30
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    VC++ is a compiler/IDE/project manager
    C++ is a language

    Therefore, it takes about a day to learn how to use VC++ but a lot longer to use C++.

    However, in the case of your books, VC++ would mean MFC
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  31. #31
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    Thanks Parksie, but would leaning the VC++ mean getting a book on C++ later on?

    The VC++ Book I'm currently reading was given to me by my Uncle and is:


    Visual C++ in 12 Easy Lessons
    By Greg Perry & Ian Spencer (SAMS Publishing)


    I don't think this book doesn’t get into MFC (I could be wrong), it goes up to OOP and writing text files to disk etc and it's a great book, well so far anyway nicely laid out with definitions and reviews etc.

    The second one which I accidentally parched thinks it was for beginners is:


    Learn Visual C++ Now
    By Mark Andrews (Microsoft Press)


    Have you herd off any of these two books or read them? If so what you think of them?

  32. #32
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    As long as it teaches the language rather than using MFC or the VC++ interface you're okay.

    I don't have much experience with books because I learnt C from the K&R book and used MSDN to get up to speed on C++.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  33. #33
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    30 FPS is enough, but Quake3 (sorry but I think it has better graphics than yours) runs with 120 FPS on my P800 and that's slightly faster
    It is not like he would get 120 FPS if he would program his game in C++. I bet those professionals are a little more advanced than what us people here pick up from SDK.
    Sanity is a full time job

    Puh das war harter Stoff!

  34. #34
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Professional game programmers usually have lots of lovely asm in there as well Plus they have knowledge of how to get the most out of a compiler so they're programming in C (sorry, but C beats C++ for speed in a lot of cases) but it looks a little weird because they're cheating and making the branch-prediction work a little better
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  35. #35
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Well, I have all the VB-code to make the bounds of the arrays match, so all I need now for my special effects is a really fast DLL that loops trough 2 arrays, checks one against the other in a lookup table (another array), and dumps the result in one of them... it's really easy, I've got the code in VB (5 lines), all I need is someone to convert it to a faster language
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  36. #36
    Zaei
    Guest
    Currently, most recent games that are on the market, or are in development, are written in C++. Even thouse C may be faster, and require less memory, the amount of System RAM, the speed of Microprocessors, and the current crop of graphics accelerators on the market make the speed difference almost negligable. C++ offers benefits that far outstrip the tiny bit of extra speed that C offers. Also, contrary to popular belief, modern games dont use near as much inline ASM as people believe. It is used most often for small areas that need to execute at maximum speed, like in nested loops. Even then, the optimization that commercial compilers usually perform is generally far better then what any but an expert ASM programmer could do. The reason most commercial games are so fast is because of rendering techniques use, frustrum culling, back face culling, the various tree methods for occlusion culling (quad trees, oct trees, bsps).

    Certainly though, there are games that make use of a lot of ASM. Quake is probably the best example. The original only had software rendering, and the inner rendering loops were re-re-re-re-optimized ASM.

    For you C++ programmers out there, here is a neat optimization tip:
    Code:
    #include <iostream.h>
    
    template <unsigned n> struct Fib
    {
       enum x
       {
          val = Fib<n-1>::val + Fib<n-2>::val,
        };
    };
    
    template <> struct Fib<1> { enum x { val = 1, }; };
    template <> struct Fib<0> { enum x { val = 0, }; };
    
    int main()
    {
      cout << Fib<75>::val << endl;
      return 0;
    }
    This will print the Fibinacci(sp?) value for 75. I know it works in MSVC++6. Try writing a recursive function that does the same thing and compare the results. Its stunning.

    Z.

  37. #37
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Nice

    Gives me 10 warnings though

  38. #38
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    Hey when you guys say ASM are you talking about Assembly Language, sorry but I'm not familiar with the term ASM and was just wondering.

  39. #39
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yes.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  40. #40
    Megatron
    Guest
    Originally posted by parksie
    Professional game programmers usually have lots of lovely asm in there as well Plus they have knowledge of how to get the most out of a compiler so they're programming in C (sorry, but C beats C++ for speed in a lot of cases) but it looks a little weird because they're cheating and making the branch-prediction work a little better
    I thought most of the newer games (e.g: 1996 or 1997 and up) used C++ to program the games?

    By the way, the industry standard is C, correct? (in contrast to C++)

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width