xboxscene.org forums

OG Xbox Forums => Software Forums => Development => Topic started by: fragmaster170 on December 30, 2003, 09:48:00 AM

Title: C Or C++
Post by: fragmaster170 on December 30, 2003, 09:48:00 AM
if you want a simple language designed to be easy yet teach you C, try BCX, its free and about as easy as they get, otherwise, personally, I would go with delphi as a beginner, useful language.

http://www.rjpcomput...rogramming/bcx/
Title: C Or C++
Post by: LinksAwakening on December 30, 2003, 11:20:00 AM
HERE is an old post on the same topic, with lots of helpful info...
Title: C Or C++
Post by: Sobus on January 06, 2004, 09:38:00 PM
Im in for it man, Learn C++  When the Xbox 2 comes out, you will have programming experience and then you will be better at prgramming and if they use a different language its not hard to pic it up since you already got the Theory and stuff behind it. I am currantly in school learning Many languages and C++ is one im in right now along with Unix. I have already done C and its easy and doesnt have as much that you can do ( more errors too)
Title: C Or C++
Post by: antiflag1980 on January 08, 2004, 01:58:00 AM
C doesn't have errors?  Bad programmers have errors.  C++ isn't as flexible and as matured as C, thats why they still use C for many games still.  Look at all your games code like quake and wolfenstein and most games are still programmed all in C no C++ at all.
Title: C Or C++
Post by: delphaeus on January 08, 2004, 04:17:00 AM
I'm surprised nobody has pointed out this basic fact:

DIRECTX 8 IS WRITTEN IN C++, AND YOU CANNOT USE IT WITHOUT USING C++.

(Granted, a rather limited use of C++, since it doesn't take advantage of templates, but oh well.)

Since DirectX is your one, and only, interface to the screen, your choices are quite limited on the Xbox.  It's C++ or nothing.  You don't have a choice.

That said:

antiflag, you're either helplessly retarded or you've never actually looked into what C++ can do.  There's three advantages to using C++ over C:

1) Inheritance-based polymorphism.  C++ removes the work of manually implementing vtables in a C struct.  You can define all the code for, say, an object in a physics engine, and then say that all 3d objects are merely physics-engine-objects but with extra data describing what they look like.

2) Templates.  In C++ you can create true polymorphic code which adapts itself to the data type.  For example, you don't have to create a new link for every type of data you want to store in a linked list.  You instead define a generic linked list called list<T>, and then you can use list<int>, list<char *>, or even list<list<unsigned long>>.  It generates all the code for you for each type, and you can make it do the same for your own code too.  You can do the same thing with other data structures -- arrays (vector<T>), deques, trees, hashes, etc.  And the really slick part is that all of those data structures can be read through in the same way -- using the iterator objects you can go from beginning to end the same way whether it's a linked list or an array.  And the compiler will optimize it all into just pointers anyways.

3) Overloading.  In C, a function can have one meaning, and one meaning only.  A function can't accept "either an int or a string" unless you make it take a union and a flag representing which of the union members is used.  In C++, a function can be overloaded by its types, so you can have a single function that properly handles different cases based on what you feed it.  For example, you can make a printf() that will actually output the contents of a variable based on its type, instead of just passing a % in a string and making sure it matches up to the right variable -- in fact, that's exactly what cout and << do.

And by the way, every version of the Unreal engine was written in C++, as was Quake 3, as is HL2.  In fact, games are even driving innovation in C++ now -- Game Developer Magazine ran an article two issues ago about using some tricks with templates and reverse inheritance to make an extremely flexible vertex format that could store anything from raw mesh coordinates to arbitrary pixel shader data.  About the only time anyone uses C in games now is when you're interfacing with hand-coded assembly -- and in the days of 3GHz processors, it just doesn't happen anymore.  The last major game to have any hand-coded assembler was Quake 2, and that was only in its software rasterizer -- the game logic and the core engine was all C++.  Funny that all the games you quote as using C are coming on a decade old now -- not a good reference point for Xbox coding, I think.

And "not matured" ?  The core language has been an international standard (ISO/IEC/INCITS 14882) for five years now, and there's no end of libraries available for it to address its shortcomings (most notably, Boost).  Both Visual C++ and gcc implement the standard closely, and there are even a couple of compilers which have managed to implement it to the letter.

In other words, you have no fucking clue what you're talking about, and I suggest you shut your fucking trap instead of giving people advice you can't back up with facts.  There is nothing C++ can do that C can't... but it can let you finish it and move on to the next feature with a lot less typing.

Oh, and just FYI, you'll need to use VS.NET -- only the earliest versions of the XDK supported VS6,
Title: C Or C++
Post by: SHiZNO on January 08, 2004, 02:15:00 PM
C or C++ first? "No, learn C++ first. The C subset of C++ is easier to learn for C/C++ novices and easier to use than C itself." - Stroustrup, D&E, p 169
Title: C Or C++
Post by: SHiZNO on January 08, 2004, 02:18:00 PM
delphaeus nice burn btw

lol "go look at wolfenstein"
Title: C Or C++
Post by: The Pen is mightier on January 08, 2004, 05:04:00 PM
oh man I remember I took a whole course of C++, and the final thing we had to do was create a blackjack text game. We didn't do any object orientation at all... I took another class where we DID do a bit of object orientation with a language called "prograph". lol, I have a REALLY long way to go...
Title: C Or C++
Post by: BenJeremy on December 11, 2003, 12:57:00 PM
C is a subset of C++ (or rather, C++ is a superset of C)

C++ will make using DirectX MUCH easier, since it's based on COM/OLE. Interfaces are basically virtual class definitions, and work much easier in a C++ environment.
Title: C Or C++
Post by: MagamiAKO on December 11, 2003, 12:57:00 PM
Start with the infamous Hello World smile.gif
Title: C Or C++
Post by: joseph_hac on December 11, 2003, 01:16:00 PM
I would go with C++. Visual Basic is so easy, you can probably use it right now. One thing, if you jump into C++, make sure you stick to managed code. Unmanaged code is on its way out!
Title: C Or C++
Post by: joseph_hac on December 11, 2003, 04:43:00 PM
QUOTE (Xcool @ Dec 12 2003, 01:11 AM)
is C++ for dumies a good book to get me into C++ or do u guys know a better book
and is C# any good

I would go with something like Sam's Teach yourself C++ in 21 Days. It isn't saturated with corney humor like the dummy guides, and it is possible to get through the book in 21 days (or so they say).

As far as C# goes, it all depends on the application your writing. For a first language, I would stick to C++ becasue C# is pretty much a combo of C++ and java (although some may argue).

If your really new to programming, you might want to acquire Object-Oriented Turing. It is a language specifically written to be a teaching aid. Most secondary schools teach OOT.
Title: C Or C++
Post by: Icelight on December 11, 2003, 08:15:00 PM
QUOTE
also i'm a begainer i have never programed before in my whole life


So you have never programmed in you life, and you want to:

QUOTE
learn to program in directX and OpenGL then get into Xbox programing


Listen, not to discourage you or anything, but by the time you learn how to even remotely program GUI's through C++, nevermind use DirectX/OpenGL Xbox 2 will be nearing the end of it's life cycle.

Programming isn't as easy as you think. Sure, the basic are simple, variables, references, classes, functions, looping and if structures...but after that, when you get into real Data manipulation and screen manipulation it gets very complex. As I said before, I don't want to discourage you, please don't think I'm trying to say you shouldn't do this, as I'm all for it!

Just don't expect to be programming a homebrew Xbox game within the next couple of years...(unless you don't have school/university/job/life and you can sit at home all day, doing nothing but programming and the most basic of human needs)
Title: C Or C++
Post by: Wishi on December 12, 2003, 02:13:00 AM
QUOTE
Listen, not to discourage you or anything, but by the time you learn how to even remotely program GUI's through C++, nevermind use DirectX/OpenGL Xbox 2 will be nearing the end of it's life cycle.


Err, no offense but not everyone has your slow rate of learning. It's all dependant on how much time he puts into it and how fast he can pick up concepts etc.

Anyway, to help Xcool in some way, I'll point you to the tutorial I point people to in the chat when they want to learn C++. I haven't used it but from the table of contents it looks pretty comprehensive and seems to start at the beginning. Just go through it slowly and practice, I should say that again practice.

http://cplus.about.c.../blcplustut.htm
Title: C Or C++
Post by: Wishi on December 12, 2003, 02:26:00 AM
C++ is the language.
Visual C++ is just an IDE (integrated development environment) made by MS, ie. a program which you can code in and compile your apps etc.
Title: C Or C++
Post by: Mage on December 12, 2003, 01:55:00 PM
Visual C++ also has some things specific to it that the C++ standards don't have though, like __fastcall.
Visual Studio is the IDE and isn't language specific.

If you want to get technical about it. smile.gif
Title: C Or C++
Post by: Xcool on December 13, 2003, 12:04:00 PM
does anyone know any good directX programing with C++ Books or websites
Title: C Or C++
Post by: Wishi on December 14, 2003, 02:40:00 AM
There are a couple of tutorial sites out there. There's some tutorials on our site (for Xbox) but general ones can be found on andypike.com and riaz.de. There's probably some more out there you can Google for.

There aren't many good books that I know that aim to teach you Direct3D from the beginning. However, most of the Premier Press series come with a 3/400 page intro which goes over some of it so it's a case of looking around and seeing what looks good.
Title: C Or C++
Post by: joseph_hac on December 14, 2003, 05:17:00 AM
QUOTE (Xcool @ Dec 13 2003, 10:04 PM)
does anyone know any good directX programing with C++ Books or websites

You can't go from no experience right into DirectX programming. You 're going to be overwhelmed. Programming has an extremely high learning curve.  I have taken programming all throughout highschool, and am now half way through my second year of college, and I still have not tackled DirectX. You have to be realistic. Unfortunately, you're not going to be able to write programs or ports for the XBOX anytime soon. That's just the way it is.  If you want to program, you need to start from the ground up. You need to learn the basics of coding structure: sequential, iteration, decicisons. Then you need to know the fundamentals of object-oreinted programming: classes, objects, inheritance, polymorphism, encapsulation. Once you know the basics, you can code in pretty much any language.

In you want to be a programmer, my best advice is to go to a good school.
Title: C Or C++
Post by: strangeduck on December 17, 2003, 01:14:00 AM
I first took a class in C++ in 9th grade (I'm a soph in college now), but everyone in my class was retarded so we went really slow and I hardly learned anything about object orientation. I learned C *really* well working as a coder on a MUD. I kinda went into it having decent coding skills but never really having applied them before (I picked up a book on C called C Primer Plus by Stephen Prata - great book for C), and by figuring stuff out in the MUD server code as I went, I learned a lot about good programming practices and everything you could ever want to know about pointers (very important and difficult concept). That was in 11th/12th grade...so I guess at that point I had a great knowledge of C and didn't know shit about object-oriented programming. Then I started college.

My school teaches their programming classes in Java, so in my first quarter of taking comp sci classes I started picking up the concepts of object-oriented programming, which I'd always thought were worthless when I was coding in C but turned out to be way cool and helpful once I started understanding them. I picked up a book on C# last summer to see what all the hype was - if you're interested in programming web pages then C# + ASP.NET rocks, but if you want to make games then I don't think it's about to become a standard anytime soon. Anyway, now that I knew Java and C#, I decided to go back and pick up all the C++ stuff that my retarded 9th grade class never got around to learning, and it was pretty easy because C++ is the same object-oriented concepts that Java and C# have, just using a different syntax. However, I don't recommend learning C++ after Java or C#, because getting used to a pointer-less language and then trying to learn C++ will fuck you up hardcore. I still make stupid mistakes with pointers in C++ programs because Java made me stupid by not making me worry about them. Anyway, I still suck at making Xbox programs, but I'm working on picking up DirectX and the Intro to 3D Graphics Programming class I'm taking at school starting in three weeks will probably really help that. So, all this is my experience, and what I recommend based on that is:

Learn C++, get a solid understanding of a.) pointers and b.) object-oriented concepts like classes, inheritance, polymorphism, etc. With that knowledge, picking up Java or C# would be hella easy - then, as long as you have solid math knowledge, you can start taking on 3D graphics programming, which is the step I'm currently on.
Title: C Or C++
Post by: SHiZNO on December 21, 2003, 02:17:00 PM
you dont need to learn C before C++...C has gone in its own direction since C++ was created/standardized... its probably best to jump into C++ and use the OO I/O classes than mix all the old C functions with C++ (you can do it but its probably not the best practice) eg using new/delete over malloc, the *printf functions over the std::cin||cout functions