Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
SFML Game Development

You're reading from  SFML Game Development

Product type Book
Published in Jun 2013
Publisher Packt
ISBN-13 9781849696845
Pages 296 pages
Edition 1st Edition
Languages
Authors (5):
 Artur Moreira Artur Moreira
Profile icon Artur Moreira
 Henrik Vogelius Hansson Henrik Vogelius Hansson
Profile icon Henrik Vogelius Hansson
Jan Haller Jan Haller
Profile icon Jan Haller
Henrik Valter Vogelius Henrik Valter Vogelius
Profile icon Henrik Valter Vogelius
View More author details

Table of Contents (18) Chapters

SFML Game Development
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Making a Game Tick 2. Keeping Track of Your Textures – Resource Management 3. Forge of the Gods – Shaping Our World 4. Command and Control – Input Handling 5. Diverting the Game Flow – State Stack 6. Waiting and Maintenance Area – Menus 7. Warfare Unleashed – Implementing Gameplay 8. Every Pixel Counts – Adding Visual Effects 9. Cranking Up the Bass – Music and Sound Effects 10. Company Atop the Clouds – Co-op Multiplayer Index

Preface

Welcome to the pages of SFML Game Development!

Whether you are just grabbing our book in a store, previewing it in your e-book reader, or you have already bought it—you have taken your first step in becoming a game developer by picking up this book.

Game development is a very interesting topic, as it combines many different fields such as software development, graphical design, music composition, and storytelling. Nowadays, there is an enormous variety of games available, yet developers never cease to be creative and to come up with innovations. This book conveys the process of game development in a way that covers state-of-the-art techniques, leaving you ready to implement your own ideas.

It does not matter if you are already an experienced developer or an ambitious newcomer to the field of making games. Although the book requires no previous knowledge on game development, we also teach valuable concepts and techniques that will help you grow as a game developer.

Throughout the book, we develop a 2D game with SFML. We focus on a top-scrolling aircraft shooter, where the player acts as a pilot and is confronted with various challenges. We begin with the bare bones of each element and continuously add functionality as we progress in the book. In every chapter, new features are introduced, and the code is updated accordingly. Therefore, you will not only see the concepts in theory, but also will have a direct implementation at hand, which you can investigate and extend the way you like.

That said, we would like to wish you a great journey through the chapters of this book. May it be a good experience in all its extent! Please enjoy!

What this book covers

Chapter 1, Making a Game Tick, introduces the SFML library and shows you basic concepts such as the game loop and rendering.

Chapter 2, Keeping Track of Your Textures – Resource Management, covers the loading and management of external resources such as images, fonts, and sounds.

Chapter 3, Forge of the Gods – Shaping Our World, builds up the framework of the game world and addresses the concept of scene graphs and game entities.

Chapter 4, Command and Control – Input Handling, shows how to react to user input from the keyboard, mouse, and joystick.

Chapter 5, Diverting the Game Flow – State Stack, covers switching between application states such as different menus, or between menus and the game itself.

Chapter 6, Waiting and Maintenance Area – Menus, introduces a simple graphical user interface in the menus.

Chapter 7, Warfare Unleashed – Implementing Gameplay, approaches actual gameplay mechanisms. Enemies, bullets, missiles, power-ups and collision detection are implemented.

Chapter 8, Every Pixel Counts – Adding Visual Effects, enhances the graphical appearance of the game by adding animations, particle systems, and shaders.

Chapter 9, Cranking Up the Bass – Music and Sound Effects, explains a way to integrate audio into the game.

Chapter 10, Company Atop The Clouds – Co-op Multiplayer, covers networking basics and a multiplayer implementation over the network.

What you need for this book

Since this book is built around the SFML library, you need to download and install it. You can get SFML at www.sfml-dev.org; the first chapter gives a brief installation guide.

In case you decide to recompile SFML yourself, you will also require the cross-platform build tool CMake, which can be downloaded from www.cmake.org.

Who this book is for

SFML Game Development is aimed at audiences of all ages who already know how to program in C++, at least to an intermediate level. It is optimal if the reader already has some experience in programming and knows the language well.

The ideal reader for such a book would be a person who is experienced in C++ and would now like to enter the world of game development in a simple yet serious way. However, if the reader already knows a good deal of it and still wants to read through the pages to see different approaches, or if he simply wants to learn more about SFML in a bigger practical example, we strongly encourage to read on!

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "To manage all these screens and transitions, we create the StateStack class."

A block of code is set as follows:

namespace GUI
{
    class Component : public sf::Drawable,public sf::Transformable
   {
        public:
          typedef std::shared_ptr<Component> Ptr;

                          Component();

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

: mChildren()
, mSelectedChild(-1)
{
}

void Container::pack(std::shared_ptr<GUI::Component> component)
{

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "It shows a background with a little information about the game, besides its title and then blinks a big old Press any key to continue message".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
You have been reading a chapter from
SFML Game Development
Published in: Jun 2013 Publisher: Packt ISBN-13: 9781849696845
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}