game programming??

Started by
7 comments, last by DarkenMerlin 22 years, 2 months ago
Im just now learning to program C++, but i dont see how these if statements, loops, arrays, etc. can form a working game. i have no clue how these things come together to make things do things
To do all that one is able to do, is to be a man; to do all that one would like to do, is to be a god.- Napoleon Bonaparte
Advertisement
It seems like the craziest thing at first but play around with it. Do whatever seemingly pointless lessons the book (I hope you own) puts you through and in a little while you''ll start to "get it." There is really little else that can be said for now except do a little crunching and lurk these very helpful boards.

Good luck and cheers!

-------------------------
Every servant has his place, no matter lowly or modest. To know it is his greatest comfort, to excel within his greatest solace, and his master''s contentment is his greatest reward.
-
Serve Microsoft today, tomorrow you may be dead.
True. When you first start it''s really hard to see how all that stuff will lead to making games. It does though. Keep at it for a while and it''ll fall into place.

Now if you want proof, look at the code for any open source game.

I wanna'' ride on the pope mobile.
You have to know functions, how to create them, structures, classes, pointers, data structures, etc. When you know all that
then you need to learn an API or two, and THEN you can create something cool. Its the functions that actually do the work, and the classes, variables, if statements, for loops, etc that organize everything. Like they say in SSX tricky, "From tiny acorns do mighty oaks grow. Welcome to practice mode."

-Lohrno
Whenever you think that way, just remember.... How the hell did the first programmer ever expect to make a useful program using just 1's and 0's?

The answer is planning, time and patience.

Something a bit more useful, however, why not download someone elses work and see how that works?

Check out these sites

www.darkbasic.com
www.genesis3d.com
www.destiny3d.com
www.revolution3d.de

There, that should cover everything from basic 3D games programming to commercial games programming. If you don't find what you're looking for, check the links on these sites.

Lazarus404

Edited by - lazarus404 on February 13, 2002 10:31:49 AM
Lazarus404
for a less abstract answer, imagine you have 3 floats, x, y, z. these can represent the position of your character. there are functions that you will learn once you look into direct input that will allow you to see what keys the user has pressed. once you find that out, you'll be able to change x, y, and z to make it seem like your character is moving. like if(up arrow pressed) y += 4; or something like that. unfortunately, there's lots more to learn before you get to see how all the basic syntaxes apply, such as setting up the graphics display in order to display the character. in order to quickly see how this would be done, i would highly recommend Nehe's site to start.

allan

Edited by - a2k on February 13, 2002 10:38:31 AM
------------------General Equation, this is Private Function reporting for duty, sir!a2k
quote:Original post by DarkenMerlin
Im just now learning to program C++, but i dont see how these if statements, loops, arrays, etc. can form a working game. i have no clue how these things come together to make things do things


Learn the basics, then learn how to code a game, we must all start at the bottom of the ladder...



"And that''s the bottom line cause I said so!"

Cyberdrek

Resist Windows XP''s Invasive Production Activation Technology!

"gitty up" -- Kramer
/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash
[Cyberdrek | ]
I figure I''ll throw my 2 cents in. When I started game programming - the thing that was most confusing to me was how the code eventually draws graphics on the screen.

That is mostly done through the magic of video cards. This may over-simplify the matter but in ram (usually video ram a.k.a. vram) the screen is laid out as an array. Lets call that array Screen[640][480]. This is a screen that is 640 units wide and 480 units tall. You will tell the video card that I want to put a dot at Screen[15][15]. The video card will take this input and draw a dot at row. By being very careful where you draw your dots it will eventually draw a picture.

This is where the game loop comes in. First you will start your game by drawing an initial picture. Then you will get the user''s input, decide how to change the picture (i.e. move the player) and then redraw the picture. In a game this is called the game loop and happens over and over again until the player decides to quit.

Yes - this is all done through very typical if...else statements and loops. I hope this helps a little, but the bottom line is to understand how a computer works, keep reading, work hard, and most of all have fun doing it (I hope that doesn''t sound too sick). But it appears your headed in the right direction.

As far as using methods to do the work for you, yes it help incredibly, but I would also encourage you never to use a method unless you know exactly what it is doing. It will make you a better programmer.
Start very simple.

Start 2D.

Get a good book on programming. Many suggested here (Books & Software)

Think of your code as a continous loop. Inside it you put all the if etc statements.

Pseudo example of a moving object:
speed = 1;         // Movement variablex = 50;            // Variable that holds the X position of the objectScreenWidth = 640; // Assuming you have a 640 * 480 resolutionStart loop{// Give x a new value to create  movement for the next frame.          x = x + speed;// Check if reached the right end of the screen     if (x > ScreenWidth)     {              x = ScreenWidth;         speed = -1;     }// Check if reached the left end of the screen     if (x < 0)     {              x = 0;         speed = 1;     }// Assuming you have a function with this name taking care of the details in drawing the object.     DrawObject(x, y);    }End of loop  

The pseudo code inside the loop forever. increasing X or decreasing X depending on if it hit the left or right side of the screen. Meaning your object will be moving each frame one pixel to the left or right. I hope this makes some sense.

Anyway you need to start very simple. Learn to draw something on the screen, manipulate some strings, print them etc. Then maybe move on to interact with your program controlling movements on the screen.

Good luck!

Warm regards
Mario..




Edited by - dharma on February 13, 2002 5:19:10 PM
Warm regardsMario..

This topic is closed to new replies.

Advertisement