Mastering SFML Game Development
eBook - ePub

Mastering SFML Game Development

Raimondas Pupius

Share book
  1. 442 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering SFML Game Development

Raimondas Pupius

Book details
Book preview
Table of contents
Citations

About This Book

Create complex and visually stunning games using all the advanced features available in SFML developmentAbout This Book• Build custom tools, designed to work with your specific game.• Use raw modern OpenGL and go beyond SFML.• Revamp your code for better structural design, faster rendering, and flashier graphics.• Use advanced lighting techniques to add that extra touch of sophistication.• Implement a very fast and efficient particle system by using a cache-friendly design.Who This Book Is ForThis book is ideal for game developers who have some basic knowledge of SFML and also are familiar with C++ coding in general. No knowledge of OpenGL or even more advanced rendering techniques is required. You will be guided through every bit of code step by step.What You Will Learn• Dive deep into creating complex and visually stunning games using SFML, as well as advanced OpenGL rendering and shading techniques• Build an advanced, dynamic lighting and shadowing system to add an extra graphical kick to your games and make them feel a lot more dynamic• Craft your own custom tools for editing game media, such as maps, and speed up the process of content creation• Optimize your code to make it blazing fast and robust for the users, even with visually demanding scenes• Get a complete grip on the best practices and industry grade game development design patterns used for AAA projectsIn DetailSFML is a cross-platform software development library written in C++ with bindings available for many programming languages. It provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications.This book will help you become an expert of SFML by using all of its features to its full potential. It begins by going over some of the foundational code necessary in order to make our RPG project run. By the end of chapter 3, we will have successfully picked up and deployed a fast and efficient particle system that makes the game look much more 'alive'. Throughout the next couple of chapters, you will be successfully editing the game maps with ease, all thanks to the custom tools we're going to be building. From this point on, it's all about making the game look good. After being introduced to the use of shaders and raw OpenGL, you will be guided through implementing dynamic scene lighting, the use of normal and specular maps, and dynamic soft shadows. However, no project is complete without being optimized first. The very last chapter will wrap up our project by making it lightning fast and efficient.Style and approachThis book uses a step by step approach by breaking the problems down into smaller, much more manageable obstacles, and guiding the reader through them with verified, flexible, and autonomous solutions.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering SFML Game Development an online PDF/ePUB?
Yes, you can access Mastering SFML Game Development by Raimondas Pupius in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Games. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781786466846
Edition
1

Mastering SFML Game Development


Mastering SFML Game Development

Copyright Š 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2017
Production reference: 1240117
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-988-5
www.packtpub.com

Credits

Author
Raimondas Pupius
Copy Editor
Safis Editing
Reviewer
Maxime Barbier
Project Coordinator
Kinjal Bari
Commissioning Editor
Amarabha Banerjee
Proofreader
Safis Editing
Acquisition Editor
Reshma Raman
Indexer
Mariammal Chettiyar
Content Development Editor
Amrita Noronha
Graphics
Kirk D'Penha
Technical Editor
Sneha Hanchate
Production Coordinator
Arvindkumar Gupta

About the Author

Raimondas Pupius is a game development enthusiast from Lithuania, currently working towards getting a degree in software engineering, as well as a few projects of his own. Having started his unofficial education in this field at the age of 9 and being introduced to video games even prior to that has guided him to this particular career choice, which was only strengthened by the experience earned from his first book “SFML Game Development By Example”. The ultimate dream is, of course, starting a company of his own and making professional games for a living. His other interests include web development, which was his primary interest before game development, music and linguistics.
First, I would like to express my deepest thanks to Prachi Bisht for offering me the opportunity to write another book and bringing me on board. In addition to that, I would like to thank Amrita Noronha, Mamata Walkar, and all of the reviewing staff for being so great to work with and handling the production duties.
Lastly, I would like to thank my mom, my grandmother and my beautiful wife, as well as her entire family for showing me endless love and support throughout this entire ordeal. I wouldn’t be where I am today without your kindness, understanding, and patience during my late night binge-writing. This book is dedicated to you!

About the Reviewer

Barbier Maxime is a software engineer at Rennes in France. He loves programming crazy things or experiments, and shares them to the open source community on Github since 2010, and really like game programming. As his favorite technology is C++ he has become an expert with it. He has also developed severals libraries and games with this language. Game programming is a hobby for him, and he really likes the challenges involved by such project. He also loves sharing his knowledge with other people, that was the main reason of it's activity on the open source community.
He had wrote the book “SFML Blueprints” and has comments others such as “SFML Game Development” and “Getting Started with OUYA”.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.com
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Customer Feedback

Thank you for purchasing this Packt book. We take our commitment to improving our content and products to meet your needs seriously--that's why your feedback is so valuable. Whatever your feelings about your purchase, please consider leaving a review on this book's Amazon page. Not only will this help us, more importantly it will also help others in the community to make an informed decision about the resources that they invest in to learn.
You can also review for us on a regular basis by joining our reviewers' club. If you're interested in joining, or would like to learn more about the benefits we offer, please contact us: [email protected].

Preface

Designing a game from scratch can be one of the most difficult journeys to embark on. With the amount of work that goes into it, it’s would not be farfetched to compare game development to building a car. It combines many different areas of expertise that would, otherwise, not be overlapping, meaning the mastermind behind it has to, often enough, also act as the Jack of all trades. Not many other types of projects can claim that they found a way to combine advanced lighting calculations, accurate physics simulations, and the inner-workings of a fully fledged, stable, and self-sustaining economy-model into something cohesive. These are just some of those trades one has to pick up, and in the fast-growing world of gaming, new ones are constantly popping into existence. Among all of the noise, some patterns slowly begin to emerge as time passes by. With several different generations having access to gaming now, and a couple of them not knowing the world without it, certain expectations begin to form within the zeitgeist. The breath-taking inventions and technical demos of yesterday have become the common-place features of today, and the beacons of light shining onto tomorrow. Keeping up with these features and not being left behind in the dark is what makes a good game developer today, and that’s where we come in. Although it won’t teach you everything, this book will do a solid job at giving you an edge by not only expanding your repertoire of techniques and ideas, but also setting a clear goal into the future, that’s always going to keep progressing into something bigger and better.
As the first two chapters fly by, you will learn about setting up a basic, yet powerful RPG-style game, built on top of flexible architectures used in today’s games. That same game will then be given extra graphical oomph, as we cover building an efficient particle system, capable of easy expansion and many different graphical options. Subsequently, you will be brought up to speed to the practicalities and benefits of creating custom tools, such as a map editor, for modifying and managing the assets of your game. Usage of SFML’s shaders will also be touched on, right before we embark on a journey of cutting SFML out completely in Chapter 7, One Step Forward, One Level Down – Integrating OpenGL, by using raw OpenGL and rendering something on screen all by ourselves. This is followed by us exploring and implementing advanced lighting techniques, such as normal and specular maps, to really give the game scene a graphical kick with dynamic lights. Of course, there can be no light that doesn’t cast a shadow, which is why Chapter 9, The Speed of Dark – Lighting and Shadows, covers and implements shadow-mapping in 3D, allowing us to have realistic, three-dimensional shadows. This is all topped off by making final optimizations to the game that will not only make it run as fast as possible, but also provide you with all of the tools and skills necessary to keep making improvements into the future.
While this book aims to inspire you to be the Jack of all trades, it will also make you a master of some by enabling your games to look and run as good as they possibly can. There is a long road ahead of us, so make sure you pack your ambition, and hopefully we shall see each other again at the finish line. Good luck!

What this book covers

Chapter 1, Under the Hood – Setting up the Backend, covers the usage of several underlying architectures that will power our game.
Chapter 2, It’s Game Time! – Designing the Project, partakes in actually building and running the game project of the book, using the architectures set up in Chapter 1, Under the Hood – Setting up the Backend.
Chapter 3, Make It Rain! – Building a Particle System, deals with the complexities of implementing an efficient and expansive particle system.
Chapter 4, Have Thy Gear Ready – Building Game Tools, gets the ball rolling on building custom game tools by setting up their backend.
Chapter 5, Filling the Tool Belt – A few More Gadgets, finishes implementing the map editor that can be used to place, edit, and otherwise manipulate map tiles, entities, and particle emitters.
Chapter 6, Adding Some Finishing Touches – Using Shaders, explains and uses the newly re-architected renderer that allows for easy use of shaders, by implementing a day/night cycle in our game.
Chapter 7, One Step Forward, One Level Down – OpenGL Basics, descends into the depths of technicalities of using raw OpenGL, guiding us through rendering basic shapes, texturing them, and creating the means of movement around the world.
Chapter 8, Let There Be Light – An Introduction to Advanced Lighting, introduces and applies the concepts of lighting up our game world in three-dimensions, using normal maps to add the illusion of extra details, and adding specular highlights to create shining surfaces.
Chapter 9, The Speed of Dark – Lighting and Shadows, expands on the lighting engine by implementing dynamic, three-dimensional, point-light shadows being cast in all directions at once.
Chapter 10, A Chapter You Shouldn’t Skip – Final Optimizations, wraps up the book by making our game run many times faster, and providing you with the tools of taking it even further.

What you need for this book

First and foremost, a compiler that supports new C++ standards is required. The actual SFML library is also needed, as it powers the game we’re building. Chapters 7 and up require the newest versions of the GLEW and GLM libraries as well. Any other individual tools that may be used throughout the course of this book have been mentioned in the individual chapters they’re used in.

Who this book is for

This b...

Table of contents