game design question

Pages: 12
closed account (30X1hbRD)
Hi, I'm a relatively new programmer and I'd really like to learn game development. I've done a lot of research and have learned the basics of C++. I'm having a lot of trouble getting the hang of object oriented programming and am currently learning SDL. What I'd like to do is start work on a basic pong-style game. I have no idea where to start is the only problem. I've been studying some of the tutorials that LazyFoo has posted and I'm using basic console mingw gcc. Any advice would be appreciated. Thanks!
closed account (EwCjE3v7)
What type of games would you like to make?
3d ones or 2d?
closed account (30X1hbRD)
I would like to design 3d but I realize that it would be a ridiculous first project. so I'd like to start with just basic 2d. I would like to start small with things like pong, space invaders, and eventually move up to side scrollers, and then when I'm good enough try 3d.
closed account (EwCjE3v7)
Take a look at this book
Beginning C++ Through Game Programming, Third Edition
Download e-book:
http://www.bookarchive.org/beginning-c-through-game-programming-3rd-edition/

i havnt read it because i do not plan to make games but i hope it helps.
The book i read is C++ Primer 5th Edition (Lippman, Lajoie, and Moo) because it is rewritten for c++11.
not the 6th edition which is written by Prata becuase its old.it claims that it is c++11 but not

read cubbis box http://www.cplusplus.com/forum/beginner/104737/#msg564798


Hope i helped
Last edited on
currently learning SDL


I hope you are using SDL 2.x.

If you are using SDL 1.x, I highly recommend you drop it and pick something more modern. SDL 1.x uses extremely outdated concepts and gets crap performance.

I prefer SFML. But SDL 2.x seems to be good as well.
closed account (30X1hbRD)
Thank you CaptainBlastXD I will download the ebook
closed account (30X1hbRD)
Disch, I'm not entirely sure but I think I am running 1.2.12 currently I'm just trying to figure out the syntax and how to get graphics to run properly. I'd heard of SFML, but I found a really good tutorial on SDL and decided to just give it a shot. How well would you rank SFML on a scale of 1 - 10?
closed account (EwCjE3v7)
@prince
Also check out OpenGL on C++
to make you first 2d game
first learn
the <iostream>
from there
learn then the arrays
learn 2 arrays
x = y = 50 ;
int array [x] [y];
use those arrays as X and Y
then use keyboard to input where to move
use a character # as the player,
then use getch(); function to take the position user wants the player go to
switch(move)
{
case : 'w' ;
x+=1;
break;

case : 's' ;
x-=1;
break;

.
.
.

to the end of the code

,,,,


what I want to tell you, that before thinking of making a game, just go ahead and learn cpp from the scratch and learn different functions and operators every day, then you will get ideas how to make games without having to search on the internet,
thats how they did the first game, they had to think it
I think I am running 1.2.12


If any functions/docs mention "surfaces" or "blitting", then you are using SDL 1.x.
Surface to surface blitting has not been hardware accelerated in about a decade.

I'm just trying to figure out the syntax and how to get graphics to run properly


That's kind of my beef with SDL. You're learning how to do that stuff as it was done 15 years ago. The way its done now is totally different.

but I found a really good tutorial on SDL and decided to just give it a shot.


It's true there are many more tutorials for SDL because it's been around longer (a lot longer -- it's really old). So it might be easier to learn SDL than to learn SFML.

Really it's your call. Just don't expect to get good performance out of it... and know that it's old and does things in ways that aren't done any more.

How well would you rank SFML on a scale of 1 - 10?


Numerical scales are kind of arbitrary, so it's hard for me to give a number. I will say that SFML 2.0 is superior to SDL 1.x in many ways. It's much easier to list the things SDL 1.x does better... so I will:

1) SDL has more tutorials available for it.
2) SDL is ported to more platforms.
3) SDL has a larger user base.
4) It's typically easier for newbies to set up SDL than SFML (though this might have changed with the recent official release of SFML 2.0).


Apart from those points... pretty much everything else that SDL 1.x does.. SFML does better.

CaptainBlastXD wrote:
Also check out OpenGL on C++


I would not recommend OpenGL or DirectX to absolute beginners starting out with graphics programming. Using either of them effectively requires you understand a great deal about the rendering pipeline and is very likely to be overwhelming.

the prince is right to start with an abstraction layer that simplifies it.
Last edited on
Here is an online version of C++ Through Game Programming.

http://www.doc.ic.ac.uk/~af909/Beginning_C++_Game_Programming%5B1%5D.pdf

I use it myself and it has helped a lot, both in gaming and in general. I'm on page 45 and I understand how to make an inventory, the scoring system, and much more.
Last edited on
closed account (30X1hbRD)
yemeni cpluspluser, thank you for the advice it is very helpful! I've been trying to finish learning about functions, and I think I have operators down. Honestly, one of the biggest troubles I've been having is loops.

Disch, thank you for answering all of my questions, part of the reason I started with sdl is because I'm a bit of a newbie and I just wanted to start with something simple. I've seen some things about blitting in sdl so I'm assuming it's part of the 1.x version. I'll probably look into sfml once I get a basic idea of the game programming in general. Thank you very much!

nsahawk, Thanks for the link, I'll be sure to check it out. thank you!

captainblastxd, yeah opengl is actually what I'm planning to use once I become advanced enough to work on 3d projects. You have all been incredibly helpful Thanks a Ton!
closed account (EwCjE3v7)
@prince
Ok
The good thing about OpenGL is that it runs on linux, macintosh and windows
But if you wanna qualify to making games like battlefield, cod, gta and other heavy games you should go with DirectX

Its all up to you.

@Disch
True just suggesting some stuff he can look into.
Last edited on
closed account (30X1hbRD)
@captainblastxd Yeah I am definitely gonna check it out once I get good with my programming, I'm probably going to wait until later to go for directx though because I don't intend to make anything too heavy in the physics area for a while. (I don't know why but the idea of designing physics in video games freaks me out a bit.) thanks for the suggestion!
final edit
:

fixed the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main()
{
    char arena [22] [22] = {0};
    int pos_x =0 , pos_y = 0 ;

    arena [pos_x] [pos_y] = '@';

    char answer;
    while(1)
    {


    answer=getch();
    switch(answer)
    {

    case 'd' :
    pos_y += 1;
    break;

    case 'a' :
    pos_y -= 1;
    break;

    case 'w' :
    pos_x -= 1;
    break;

    case 's' :
    pos_x += 1;
    break;


    }

    for(int a=0;a<22;a++)
    {
        for(int b=0;b<22;b++)
            arena[a][b] = ' ';

    cout<<endl;
    }
    system("cls");

    arena [pos_x] [pos_y] = '@';

    for(int a=0;a<22;a++)
    {
        for(int b=0;b<22;b++)
            cout<<arena[a][b];

    cout<<endl;
    }
    }




}
Last edited on
closed account (30X1hbRD)
I tried loading it on my computer with mingw gcc, and although it compiles right, it seems to just never stop loading. There's no System pause functions anywhere, could that be causing it?
Last edited on
I use mingw gcc too
to use system("pause");
you need to include <cstdlib>

just close it if you want to exit
Last edited on
closed account (30X1hbRD)
er... I got it to work... sort of. whenever I push W A S or D all that happens is an @ symbol appears. I'm assuming that's not what it's supposed to do. Any suggestions?
try copying the new code again, and start by pressing 's' then 'd'
closed account (30X1hbRD)
Thanks a ton that got it to work. It's really neat! Thank you!


Edit: I'm not sure if you did anything or if I was doing something wrong but if so, could you tell me how you fixed it?
Last edited on
Pages: 12