Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
C30N9

Good Game Programming Books

Recommended Posts

Maes said:

This includes even text-mode editing/execution environment that sit on top of said collection of tools (QBasic and Borland's products were a pretty good example of that, they had a windowing subsystem that almost rivaled Microsoft Windows).


Yeah, I remember the Borland interface very fondly, as that's whet I used when learning Pascal, which was my first taste of PC/DOS programming (I had only done BASIC and Z80 assembly before). It was a piece of cake to start with, but eventually I ditched it and started using QEdit instead. I can't remember exactly why, but maybe the integrated Borland editor started feeling too limited (and that was with less than a year of pascal coding under my belt). Oddly enough too, I found C language very strange and unintuitive compared to pascal, and it took me quite some time to overcome that.

Actually when I first installed Linux, I found most Unix stuff a bit alien and confusing. But of course, it was capable of a heck of a lot more than CP/M, DOS, or even AmigaOS, so I stuck with it and tried to understand the quirks. But the nice thing is, as a newbie you don't have to be exposed to it all at once. And these days there are "real" IDE's, not just Emacs and various text editors. So it depends on what you want, and what you feel comfortable with. That won't be the same for everyone, nor does everyone work exactly the same way, or are they as productive when forced to. Hell, when I first saw the vi editor on an 80x25 text console, I thought "This rocks! No fucking menu bars or bullshit to take up screen space and distract me from the code." Sure, it felt unintuitive, but I could sense it was a worthwhile investment of my time after using other, more "dumb" text editors (even QEdit started to feel limited in comparison). But, it wouldn't be the first text editor I'd recommend to a newbie.

Share this post


Link to post

I wouldn't necessarily call them "dumb" versus "smart", but I do believe vi and Emacs have a lot to offer serious programmers. I'm personally partial to Emacs (and it MIGHT even have some advantage, being able to type straight away without being thrown off by the modal design of vi), and the extreme basics of editing it are well learn-able within half an hour of using it. However, I think throwing such editors are newbies is still the wrong course of action; they are primarily programmers' text editors, so it's unlikely they come with all the editor skills for them; if they do and they prefer one of those editors, no reason to dissuade them from using what they know.

So on that regard, having newbies use an editor that more or less follows CUA is advantageous. They are most likely to already know how to use them -- Alt-<letter> for menus, C-c for copy, C-v for paste, etc. Just stick them with something better than notepad -- almost anything will do: Notepad++, gedit, jEdit, Kate, whatever else is out there. They may or may not be as efficient as vi or Emacs but they lack the steep learning curve. Several of them are used every day by very experience programmers, so it's not like they can actually hinder any progress (putting text into a file is not rocket science).

(OK, Emacs actually has a cua-mode, but accessing it from zero Emacs knowlege is a chore and making it default (~/.emacs) requires typing a subset of Lisp. Not exactly the most friendly to even get it to behave like the others.)

Share this post


Link to post

Hi, I'm having a bit of trouble in my first C++ project.

Here's the code:

// Guess My Number (Computer's role)
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>

using namespace std;

int main ()
{
	int TheNumber;
	srand(time(0)); //seed the number
	while (true)
	{
		cout << "Please enter your number from 1 to 6: ";
		cin >> TheNumber;
		if (TheNumber < 7 && TheNumber > 0) {
		void game (); //if you wrote a valid number start the main game loop
		break;
		} else {
		cout << "You picked an invailed number... Try Again" << endl;
		continue; //try again
		}
		
		return 0;
	}
}
("game" is a function hidden below)

I'm using Dev-C++ 5.4.1 and it seems that it compiles correctly with no errors. But every time I run the program it doesn't show up, or in a blink of an eye it closes. Am I using the wrong program? (It is said that Dev-C++ has a good compiler)

EDIT: Extra thing, did I add "break;" at the wrong line? Because the game function is also a loop which may interact with this break. Should I move "break;" to the line before "return 0;"?

Share this post


Link to post

C30N9 said:

void game (); //if you wrote a valid number start the main game loop

What you've written just declares the function (it's a function prototype). The function itself is never called. So the program prompts you for a number, and if it's in the range 1-6, just exits.

I think what you want to do is remove the 'void' from that line, then it should work.

This is exactly the kind of reason why C++ is a horrible choice for learning programming and why I explicitly recommended against it. There are so many tricky syntactical things that it's easy to trip over and confuse yourself with.

I'm using Dev-C++ 5.4.1 and it seems that it compiles correctly with no errors.

For reference in case it isn't obvious: the fact that something compiles with no error messages has no bearing on whether the program itself is correct.

Share this post


Link to post
fraggle said:

What you've written just declares the function (it's a function prototype). The function itself is never called. So the program prompts you for a number, and if it's in the range 1-6, just exits.

I think what you want to do is remove the 'void' from that line, then it should work.

This is exactly the kind of reason why C++ is a horrible choice for learning programming and why I explicitly recommended against it. There are so many tricky syntactical things that it's easy to trip over and confuse yourself with.

For reference in case it isn't obvious: the fact that something compiles with no error messages has no bearing on whether the program itself is correct.


Removing "void" will cause an error ([Error] 'game' was not declared in this scope). C++ may be confusing at first, but now it's going pretty great, I found that it's fun learning it. Of course it has confusing and more complicated -maybe useless- codes to execute commands such as "std::cout <<..." instead of "printf" in C but at least I'm understanding it. I won't jump to late parts, I'll be going through the book smoothly.

For reference in case it isn't obvious: the fact that something compiles with no error messages has no bearing on whether the program itself is correct.


I'll find another program then.

Share this post


Link to post
C30N9 said:

Removing "void" will cause an error ([Error] 'game' was not declared in this scope).

Move the 'game' function above 'main'. Or predeclare it by writing a function prototype above main, like "void game();"

Share this post


Link to post

Don't forget that a good game also has lots of graphics, sounds, and all that might include stuff like voice acting or a story :) Are you up to all this task?

Share this post


Link to post
C30N9 said:

I'll find another program then.

For further reference in case it wasn't obvious enough: You can compile something without errors regardless of the compiler and it might still not work. Compilers, for the most part, simply check for syntactical errors. They don't give a damn about most of the logical mistakes that you may have done.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×