Game ideas?

Hi,
I just finished my first game in SFML (Pong) and now I want to do something else but I don't have any ideas. The game shouldn't be very hard to implement because I started programming with SFML just a week ago (but SFML is easy, so I'm learning quickly)

And if You don't have any ideas too, then what was your first or second game?

Thanks!
Last edited on
a space shooter maybe?
What concepts do you feel that you have a poor grasp on? If the game is just meant to be a learning experience, make one that uses something that you're unfamiliar with as a way to gain experience with it. Otherwise I don't think that you should really need to ask for ideas, make what you want to make. I'm sure you've come up with a game idea at some point before, haven't you?
a space shooter maybe?

Yess! Space shooters are so much fun. They provide a lot of challenges (some that will require google). Things like, formula's for proper rotation.
Then making an animated stary background is a challenge also.
Snake :)
Asteroids clone. The math for movement in space is pretty fun to implement.
Asteroids clone

That's what i'm doing right now. I'll second that it's very fun ;)
Ok, I'll try asteroids.
Just my opinion, from Pong to Asteroids is a big jump. Though I haven't wrote my own version of Asteroids(lazy) I still think that it's a big jump. Have you heard of Separating Axis Theorem? I think it might be useful..

Good Luck!! :)
Well, it can't be that big of a jump. If he did pong, he knows about velocity, and that the angle of incidence = the angle of reflection (when the pong hits the paddle). then he also knows how to create sprites with some functionality. Asteroids is just a larger project, there's more things involved.
An Asteroids clone isn't difficult to write at all. I think it's a great next step.

EDIT: Also the Separating Axis Theorem is overly complicated for what he would need.

Everything in Asteroids can be circular shaped. So all you need for an asteroids clone is circle/circle collision detection, which really is the easiest kind of collision detection.

Two circles intersect if the distance between their center points is less than the sum of their radius'.

Good old Pythagorean Theorem can be used to get the distance between the center points, and you'd already have the radius' because they'd be defined by the circle.

Given circles A and B:

1
2
3
4
5
6
7
8
9
10
11
bool DoCirclesIntersect(const Circle& A,const Circle& B)
{
    double sum_of_radius = A.radius + B.radius;

    double x = B.x - A.x;  // distance between center points on X axis
    double y = B.y - A.y;  // distance between center points on Y axis

    double distance = sqrt( x*x  +  y*y );

    return distance <= sum_of_radius;
}


Of course you can get rid of that ugly sqrt call because if x is less than y, then x*x is also less than y*y. So a better way would be like this:

1
2
3
4
5
6
7
8
9
bool DoCirclesIntersect(const Circle& A,const Circle& B)
{
    double rad = A.radius + B.radius;

    double x = B.x - A.x;
    double y = B.y - A.y;

    return  (x*x)+(y*y) <= (rad*rad);
}
Last edited on
Thank you Disch for your code snippet. I think I will have some problems with calculation of angles (I don't understand trigonometry very well because I haven't learned it in school yet) and everything else doesn't seem to be very hard.
I don't know much trig myself, but sin/cos are extremely basic, and they should be all you need.

Imagine a circle with a radius of 1 and the center of the circle as position 0,0.

Now put your finger on the right-most point of the circle's edge and trace the edge counter clockwise.

The Y coord of where your finger is forms a sine wave.
The X coord of where your finger is forms a cosine wave.

Therefore we can get any point on the circle's edge. All we need is the angle.

Given an angle, the point can be very simply found:
1
2
double x = cos(angle);
double y = sin(angle);


No matter what angle you use, this point (x,y) is a distance of 1 from position (0,0)

To scale that to different distances all you have to do is multiply (x,y) by your scalar.

For example, let's say you want to move 10 pixels at a 45 degree angle:

1
2
3
4
5
6
7
double deg = 45;  // the angle
double move = 10;  // how much we want to move

double rad = 45 * pi / 180;  // convert degrees to radians

xpos += cos(rad) * move;  // so easy!
ypos += sin(rad) * move;
I posted a link to a video tutorial about trigonometry in your post about Pong
http://www.cplusplus.com/forum/general/30270/#msg164326

good luck :)
Currently I'm struggling with player movement. I quickly figured out how to accelerate and decelerate but it doesn't work as I want. The problem is that if I'm still decelerating I can't turn around at the same place

Here's a piece of 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

void Player::GameLoop(sf::RenderWindow &wnd)
{
static sf::Clock timer;
float rotation=-GetRotation();
float xvel,yvel;


     if(wnd.GetInput().IsKeyDown(sf::Key::Left))
         Rotate(rotation_speed);
     else if(wnd.GetInput().IsKeyDown(sf::Key::Right))
         Rotate(-rotation_speed);

     if(wnd.GetInput().IsKeyDown(sf::Key::Up))
      curr_speed+=acc_speed;
     else if(wnd.GetInput().IsKeyDown(sf::Key::Down) && curr_speed>0)
      curr_speed-=dec_speed;



if(timer.GetElapsedTime()>0.002)
  {


      xvel=cos(deg2rad(rotation))*curr_speed;
      yvel=sin(deg2rad(rotation))*curr_speed;


      if(curr_speed>0) // decelerate
          curr_speed-=dec_speed;

      Move(xvel,yvel); // (note: class Player inherits sf::Sprite)
      timer.Reset();
  }


}

I think I need to save an angle in which the player is moving or something but I'm not sure.

EDIT: Never mind, I figured out myself.

Last edited on
Topic archived. No new replies allowed.