Your first SFML game, Part I : Introduction

Have you ever thought about creating you’re own super classic mario game, or you’re own zelda series? Well, you’re dream has come true… with SFML you’re about to create you’re first game!! To make it easy I’ve chosen to recreate the well-known game Connect Four. Ready??… Go!!

Before starting the game development be sure to have :

Let the coding start!!

There are two main ways of creating this type  of games (board games).

  • By drawing directly to the screen the components of the game (circles, lines, rectangles, etc).
  • or, By using textures (images) and placing them on screen.

For the sake of this example, we’re using the first approach. We’ll be drawing a background color with circles. Three kinds of circles will make the whole : empty spaces, red tokens and yellow tokens. The outline of a winner combination (4 in a row) will be highlighted.

In the end, we’ll have a game like this:


Here you’ll find the Windows executable.
And here the complete sources, including a Code::Blocks Project.

The sourcecode is released under the zlib/png license.

To be continued…

4 comments on “Your first SFML game, Part I : Introduction

  1. Thx!
    I’m certainly doing another one, but shh!! it’s top secret 😉
    I’ve already taken a look at your game and it looks really nice!
    You can start by splitting your classes in different files. The class definition in a “ClassName.h” file and its methods in a “ClassName.cpp”. BTW you should forget about using global variables, they’re evil 😉 And yeah, doing a game is never easy ^^ but in the end… satisfaction is your reward^^.

  2. Pingback: 2010 in review « Redkiing's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s