c++

A place for people with an interest in developing new shmups.
Post Reply
NAVVARR
Posts: 284
Joined: Sun Aug 27, 2006 1:04 pm
Location: Bonny Scotland

c++

Post by NAVVARR »

I'm interested in learning C++ in order to start writing games.
Now, I know there's probably easier ways of writing games than getting into C++, but the portability and universality of the language appeals- since once I get to grips with it, I should be able to use it on other platforms.

Anyway, a friend of mine recommended C++ for dummies which I've bought and bundled with it, it has a copy of Bloodshed Dev-C.

My questions are- is Bloodshed Dev-C any good, should I use it- does anyone recommend anything different, preferably a free program, but i'm not averse to spending money on something if i'm going to use it.

Also, what else does anyone recommend- any other books or courses??

The C++ for dummies seems fairly comprehensive, but doesn't seem to include anything in the way of games programming.

Incidentally, I'm very new to C++, but in the past I've written games in Amos, Basic and 6502 and Z80 machine code, so I understand the principles of programming, but I've no real knowledge of C++ and its particularites.

Cheers for any help or advice.
hoots mon- crivvens, help ma boab
User avatar
Pixel_Outlaw
Posts: 2646
Joined: Sun Mar 26, 2006 3:27 am

Post by Pixel_Outlaw »

I have tinkered around in C++ casually but the thing to remember is that you will need to use some libraries to get graphics and sound up and running. Since cross platform compatibility appeals to you you might want to use something like Allegro. Make sure you really know a good chunk of the language before thinking about using libraries because they will probably demand you know how to use the basic structures of C++. I believe that "Sams Teach Yourself Game Programming in 24 hours" is a good book and focuses on C++. If I recall they use DirectX for graphics later on in the book. It's funny, almost every book will say that C++ is the industry standard yet most of the people I talk to use C. For now, just worry about understanding those Cat classes that live inside the dosbox and print *meow* to the screen. :lol:
Some of the best shmups don't actually end in a vowel.
No, this game is not Space Invaders.
User avatar
Necronopticous
Posts: 2129
Joined: Sat Sep 29, 2007 8:50 pm
Location: Baltimore

Re: c++

Post by Necronopticous »

NAVVARR wrote:[...] C++ [...] portability [...]
Good one.
User avatar
Danbo
Posts: 466
Joined: Sun Aug 03, 2008 6:58 am
Location: glasgow

Re: c++

Post by Danbo »

Necronopticous wrote:
NAVVARR wrote:[...] C++ [...] portability [...]
Good one.
C++ is very portable depending on how you write your code and what libraries you use.

Bloodshed's IDE is simple but very effective and good for beginners, you should probably make sure you get the latest version off their website though. When you're a little more comfortable you might want to move onto something with more features like Visual Studio or just use command-line tools if that's your fancy.

I don't know much about the dummies book. Any book will do if you're willing enough to learn and fill in the gaps yourself, but I would recommend Accelerated C++ (Koenig, Moo) for a beginner - it takes a very practical approach to get you familiar with both the language and the STL.

That book doesn't cover games programming, though. There is a set of decent SDL tutorials at http://lazyfoo.net/SDL_tutorials/index.php - SDL being a simple, cross-platform library for sound, window management, basic 2D graphics, input, etc. Everything you need for a simple game. Fill in the rest of your knowledge with stuff from gamedev or shmupdev.
EddyMRA
Posts: 798
Joined: Wed Jan 26, 2005 9:36 am
Location: San Diego, CA, USA

Post by EddyMRA »

I am learning C++ in college right now. I'm using MS Visual Studio as my IDE. Once I become very comfortable with using external libs, I'll begin doing my future game projects in C++, abandoning the rapid-application-development environments like Multimedia Fusion and Game Maker altogether. Those kinds of programs usually end up producing games that are high in CPU usage, since they are actually packed with the source code and an interpreter, rather than compiled into a standard Windows executable.
The age of Alluro and JudgeSpear is over.
NAVVARR
Posts: 284
Joined: Sun Aug 27, 2006 1:04 pm
Location: Bonny Scotland

Post by NAVVARR »

Cheers guys for all your help and advice, i'll check out some of your suggestions.

I'm mainly wanting to learn about 2D game creation at a hobby level, its been a hobby of mine years ago, and i enjoyed it immensely. Be good to get back into it.
hoots mon- crivvens, help ma boab
Ex-Cyber
Posts: 1401
Joined: Thu Oct 25, 2007 12:43 am

Re: c++

Post by Ex-Cyber »

Danbo Daxter wrote:
Necronopticous wrote:
NAVVARR wrote:[...] C++ [...] portability [...]
Good one.
C++ is very portable depending on how you write your code and what libraries you use.
C++ can be fairly portable, but it is extremely easy to write non-portable code without realizing it (similar in principle to C, but to a greater extent). A lot of compilers retain historical extensions and quirks that shouldn't be relied upon. Aside from that, the C++ standard is phenomenally complex and various issues are not well-defined. That said, there's pretty much no other language with its combination of modern features and industry support.
User avatar
louisg
Posts: 2897
Joined: Wed Jul 20, 2005 7:27 pm
Location: outer richmond
Contact:

Re: c++

Post by louisg »

I feel that C++ is a great compromise between portability and speed. I've done a lot of projects in Allegro and a few in SDL, and I've never had to change more than a couple minor lines to get something to run on a different platform.
If you want to standardize on a compiler, GCC is a great choice as it's available for nearly every platform including Windows, and is the stock compiler on both Mac and Linux.
Humans, think about what you have done
User avatar
TMR
Posts: 163
Joined: Thu May 14, 2009 10:29 pm
Location: Leeds, U.K.
Contact:

Re: c++

Post by TMR »

At the moment C++ hates me. i've had two previous goes at learning it with no joy whatsoever and eventually i discovered that the problem was the books; the most recent attempt, using CodeBlocks for the IDE, MinGW as a compiler and Allegro to do graphic-y things has worked out far better and in the last two days i've "learnt" enough C++ to get stuff moving around for what'll be a hideously simple arena shooter... now if only i could stop the damned thing flickering occasionally!
User avatar
louisg
Posts: 2897
Joined: Wed Jul 20, 2005 7:27 pm
Location: outer richmond
Contact:

Re: c++

Post by louisg »

TMR wrote:now if only i could stop the damned thing flickering occasionally!
Wow, what kind of flicker is it? Maybe we could help
Humans, think about what you have done
User avatar
TMR
Posts: 163
Joined: Thu May 14, 2009 10:29 pm
Location: Leeds, U.K.
Contact:

Re: c++

Post by TMR »

louisg wrote:
TMR wrote:now if only i could stop the damned thing flickering occasionally!
Wow, what kind of flicker is it? Maybe we could help
That's the thing, i've got two days of working with C++ so i'm not sure how to even describe it! =-) At the moment i'm drawing to a back buffer and blitting it over to the front but i suspect the clear/draw/blit cycle is taking too long despite only managing a couple of hundred sprites (my BlitzMax code uses more than that for the particle effects!). The flickering i was experiencing seems to be down to the "tutorial" on triple buffering i read that didn't entirely explain how to get Allegro to write to a buffer that wasn't the current foreground, currently i'm double buffering and the flicker is gone but it drops frames.

i'll work it out sooner or later, though...
User avatar
null1024
Posts: 3823
Joined: Sat Dec 15, 2007 8:52 pm
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Contact:

Re: c++

Post by null1024 »

And this is where I come in and say go to Java. It has extremely good built in drawing libraries, drastically simplifying everything. I gave up on trying to learn C/C++.

[I'm only half kidding, and in slightly related news, 1 internet tutorial on Java games programming on the internet taught me more than a 90 day course on Java. I have the strangest feeling that the course was designed to weed out the idiots who took it, so that when who's left gets to the next course, we can get real work done.]
Come check out my website, I guess. Random stuff I've worked on over the last two decades.
User avatar
TMR
Posts: 163
Joined: Thu May 14, 2009 10:29 pm
Location: Leeds, U.K.
Contact:

Re: c++

Post by TMR »

null1024 wrote:And this is where I come in and say go to Java. It has extremely good built in drawing libraries, drastically simplifying everything. I gave up on trying to learn C/C++.
Well, Allegro makes C++ relatively easy, the only issue i'm having is documentation really; once i wade through the guide on the official website and then look at actual examples in the forum (usually broken and asking for help) i can get my head around it. Part of my flickering problem for example was a documentation issue, there's nothing i can see saying to load graphics into the VRAM in order to speed up blits but now i've done that it's significantly more efficient.

Still dropping the odd frame right now though, i'm guessing because the vsync() doesn't always catch 'em all perhaps...?
User avatar
Danbo
Posts: 466
Joined: Sun Aug 03, 2008 6:58 am
Location: glasgow

Re: c++

Post by Danbo »

If you're gonna develop it in C++ (a smart idea if you know the ins and outs of c++) I find either using SDL or DirectX to be most hassle free.

There's some good SDL tutorials around by some guy called lazyfoo, but not many tutorials for using the D3DXSprite interface with Direct3D... using D3D obviously makes it windows only (Wine excluded) and leads to a bit of nasty boilerplate code, but the sprite interface itself is easy to use and you get nice things like full hardware acceleration and alpha blending.
User avatar
louisg
Posts: 2897
Joined: Wed Jul 20, 2005 7:27 pm
Location: outer richmond
Contact:

Re: c++

Post by louisg »

Yeah, SDL is very clean. It's also probably a bit more pro than Allegro in some ways, like not being based around a set-interval timer. It's easier to get up and running fast with Allegro though.. I still use it a lot just because it's less hassle.
Humans, think about what you have done
User avatar
TMR
Posts: 163
Joined: Thu May 14, 2009 10:29 pm
Location: Leeds, U.K.
Contact:

Re: c++

Post by TMR »

louisg wrote:It's easier to get up and running fast with Allegro though.. I still use it a lot just because it's less hassle.
That's what i've found generally, yeah - after getting used to the quirks of C++ compared to other languages (i'm used to Blitz 2D and then BlitzMax where sin and cos work in degrees rather than radians) my likkle game is close to complete on the code front.
shawnwilliams
Posts: 2
Joined: Wed Aug 26, 2009 1:59 pm

Re: c++

Post by shawnwilliams »

Hi
If you want to learn C++ then you should have good skill in C Language and there are many eBooks on internet. You can easily download it, if you don't want to spend your money.
tzakiel
Posts: 165
Joined: Tue Jan 14, 2014 8:03 pm

Re: c++

Post by tzakiel »

Can anyone suggest a good commented source file / tutorial for a shmup-type game with C++ and Allegro 5 (or 4) usage?
User avatar
RegalSin
Banned User
Posts: 106
Joined: Tue Oct 13, 2009 11:46 pm

Re: c++

Post by RegalSin »

It does not matter, which programming language you use, you will be up your neck in math.
People please post resources and ideas for making it easier for programming, in general. Also Assembler is far more faster, while C+ is considered a low-level language, Assembler has many resources as well. Again it does not matter, you will need to know math.

Allegro is what makes Mugen, Mugen. You can go back as far as when Mugen first appeared. Originally it was going to be a shooter, but they decided a fighter was much easier.

Then of course is the guy who made, "Chorno Trigger" for the X-box, before it was shotdown, by Square ( who practically killed off the Magus on the NDS ). Search him, maybe he has resources, to use, since he told his story of learning programming. Also on the x-box that was shotdown is a project known as Burning Angels, which is a shooter.

Do not limit yourself to direct X, but also try OpenGL and using resources. Keep in mind their are many platforms to program for. The idea of getting into deep programming, is to save resources and the reprogram it for another machine. Which looks good on paper but is really alot more difficult then it sounds.

Their are many source codes, flying around for many games. Take Pac-man or even Donkey Kong, right now. It helps to read the source codes of other games, but the compliers are differnt. Do not always turn to Visual Basic 2005 ( last to compile a normal exe ), thier are tons of compliers. Some emulators like Meka also mention the use of various compliers. Their are even official compliers floating around, and people have them. It wont hurt to spend some money as well, it sucks but a man has gotta do what a man gotta do.
Post Reply