Free Sample
+ Collection

SFML Game Development

Jan Haller, Henrik Vogelius Hansson, Artur Moreira

If you’ve got a firm grasp of C++ with a secret hankering to create a great game, this book is for you. Every practical aspect of programming an interactive game world is here – the only real limit is your imagination.
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849696845
Paperback296 pages

About This Book

  • Develop a complete game throughout the book
  • Learn how to use modern C++11 style to create a full featured game and support for all major operating systems
  • Fully network your game for awesome multiplayer action
  • Step-by-step guide to developing your game using C++ and SFML
  • You can find the updated code files here

Who This Book Is For

SFML Game Development addresses ambitious C++ programmers who want to develop their own game. If you have plenty of ideas for an awesome and unique game, but don’t know how to start implementing them, then this book is for you. The book assumes no knowledge about SFML or game development, but a solid understanding of C++ is required.

Table of Contents

Chapter 1: Making a Game Tick
Introducing SFML
A few notes on C++
Developing the first game
Game loops and frames
Displaying sprites on the screen
Chapter 2: Keeping Track of Your Textures – Resource Management
Defining resources
Resources in SFML
A typical use case
An automated approach
Error handling
Generalizing the approach
Chapter 3: Forge of the Gods – Shaping Our World
Rendering the scene
Updating the scene
The view
Landscape rendering
Composing our world
Integrating the Game class
Chapter 4: Command and Control – Input Handling
Polling events
Getting the input state in real time
Playing nice with your application neighborhood
A command-based communication system
Customizing key bindings
Chapter 5: Diverting the Game Flow – State Stack
Defining a state
The state stack
The state context
Integrating the stack in the Application class
Navigating between states
The loading screen – sample
Chapter 6: Waiting and Maintenance Area – Menus
The GUI hierarchy, the Java way
Updating the menu
The promised key bindings
Chapter 7: Warfare Unleashed – Implementing Gameplay
Equipping the entities
Creating enemies
Adding projectiles
Picking up some goodies
Collision detection and response
An interacting world
Victory and defeat
Chapter 8: Every Pixel Counts – Adding Visual Effects
Defining texture atlases
Low-level rendering
Particle systems
Animated sprites
Post effects and shaders
Chapter 9: Cranking Up the Bass – Music and Sound Effects
Music themes
Sound effects
Sounds in 3D space
Chapter 10: Company Atop the Clouds – Co-op Multiplayer
Playing multiplayer games
Interacting with sockets
Data transport
Network architectures
Creating the structure for multiplayer
Working with the Server
Taking a peek in the other end – the client
Cheating prevention

What You Will Learn

  • Learn the basics of SFML and render an airplane to the screen.
  • Create a game world to play in using entities and handle input from the player
  • Make your game richer with menus, settings, and other states
  • Implement the foundation for a GUI library
  • Populate the world with enemies and let them interact
  • Load resources like textures from the hard drive and learn about resource management
  • Animate the game object, build a particle system and look behind the scenes of rendering
  • Add music and sound effects to your game to create an immersive gaming experience
  • Implement multiplayer over a network to indulge in gameplay over the Internet

In Detail

Game development comprises the combination of many different aspects such as game logics, graphics, audio, user input, physics and much more. SFML is an Open Source C++ library designed to make game development more accessible, exposing multimedia components to the user through a simple, yet powerful interface.

If you are a C++ programmer with a stack of ideas in your head and seeking a platform for implementation, your search ends here.

Starting with nothing more than a blank screen, SFML Game Development will provide you with all the guidance you need to create your first fully featured 2D game using SFML 2.0. By the end, you'll have learned the basic principles of game development, including advanced topics such as how to network your game, how to utilize particle systems and much more.

SFML Game Development starts with an overview of windows, graphics, and user inputs. After this brief introduction, you will start to get to grips with SFML by building up a world of different game objects, and implementing more and more gameplay features. Eventually, you’ll be handling advanced visual effects, audio effects and network programming like an old pro. New concepts are discussed, while the code steadily develops.

SFML Game Development will get you started with animations, particle effects and shaders. As well as these fundamental game aspects, we’re also covering network programming to the extent where you’ll be able to support the game running from two different machines. The most important part, the gameplay implementation with enemies and missiles, will make up the core of our top-scrolling airplane shoot' em-up game!

You will learn everything you need in SFML Game Development in order to start with game development and come closer to creating your own game.


Read More