Creating a City Building Game with SFML

11 Daniel Mansfield Aug 12, 2014

https://www.binpress.com/tutorial/creating-a-city-building-game-with-sfml-part-10-putting-it-all-together/132 Simulation games, whilst not as action packed as an FPS or as emotive as an RPG, are nonetheless a rather popular game genre. In this ten-part tutorial we'll develop a simple city simulation game, in which the player can build houses and shops, lay roads, and generally maintain a population.

Since C++ (the language we'll be using) doesn't have native support for graphics, we'll use the SFML library to help create the game. It will be assumed that you have already installed and set up SFML since this differs from platform to platform. See the SFML website for details on how to do this. We'll also be making use of the C++11 standard, so make sure to enable the standard in your compiler settings. Some older compilers (particularly Visual Studio) may fail to compile the code even with the standard in use, but any relatively new g++ or MinGW compiler should work fine.

The complete source code for each part of the tutorial lives here, on my Github account.

Index

11 comments


Or enter your name and Email
  • D Dimi 1 year ago
    For beginners it is actually a bad idea to start with C++ and SFML. You should use higher level language and library.
  • HR Hunter Rohwer 3 years ago
    What year of Visual Studios did you use to make this?
    • M malt 2 years ago
      " Some older compilers (particularly Visual Studio) may fail to compile the code even with the standard in use, but any relatively new g++ or MinGW compiler should work fine." Read the tuto before ask :)
  • U underww 3 years ago
    I've just tested the code. (I didn't read the tutorials yet.) and I found a few problems. in suffleTiles() function in city.cpp std::iota(shuffledTiles.begin(), suffledTiles.end(), 1); > std::iota(shuffledTiles.begin(), suffledTiles.end(), 0); (also std::iota needs header)
    • U underww 3 years ago
      *iota needs 'numeric' header
  • C cob 3 years ago
    Just a big "thank you" for this tutorial!
  • S Shariq 3 years ago
    Does anyone know where to get all the pngs used in this project?
    • DM Daniel Mansfield 3 years ago
      They're available on the github page linked in the article, either in the individual tutorial folders or in the media folder.
  • S Simon 3 years ago
    This is incredible! Thank you for sharing.
  • K ksco 3 years ago
    awesome! thanks! :)
  • K ksco 3 years ago
    awesome! thanks! :)