Beginning C++ Game Programming Bytom

The second edition of Beginning C++ Game Programming is updated and improved to include the latest features of Visual Studio 2019, SFML, and modern C++ programming techniques. With this book, you'll get a fun introduction to game programming by building five fully playable games of increasing …

od 107,10 Najbliżej: 19 km

Liczba ofert: 1

Oferta sklepu

Opis

The second edition of Beginning C++ Game Programming is updated and improved to include the latest features of Visual Studio 2019, SFML, and modern C++ programming techniques. With this book, you'll get a fun introduction to game programming by building five fully playable games of increasing complexity. You'll learn to build clones of popular games such as Timberman, Pong, a Zombie survival shooter, a coop puzzle platformer and Space Invaders. The book starts by covering the basics of programming. You'll study key C++ topics, such as object-oriented programming (OOP) and C++ pointers, and get acquainted with the Standard Template Library (STL). The book helps you learn about collision detection techniques and game physics by building a Pong game. As you build games, you'll also learn exciting game programming concepts such as particle effects, directional sound (spatialization), OpenGL programmable shaders, spawning objects, and much more. Finally, you'll explore game design patterns to enhance your C++ game programming skills. By the end of the book, you'll have gained the knowledge you need to build your own games with exciting features from scratch Spis treści: Beginning C++ Game Programming Second Edition Why subscribe? Contributors About the author About the reviewer Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Reviews Chapter 1: C++, SFML, Visual Studio, and Starting the First Game The games we will build Timber!!! Pong Zombie Arena Thomas was late Space Invaders ++ Meet C++ Microsoft Visual Studio SFML Setting up the development environment What about Mac and Linux? Installing Visual Studio 2019 Community edition Setting up SFML Creating a new project Configuring the project properties Planning Timber!!! The project assets Outsourcing the assets Making your own sound FX Adding the assets to the project Exploring the assets Understanding screen and internal coordinates Getting started with coding the game Making code clearer with comments The main function Presentation and syntax Returning values from a function Running the game Opening a window using SFML #including SFML features OOP, classes, and objects Using namespace sf SFML VideoMode and RenderWindow Running the game The main game loop While loops C-style code comments Input, update, draw, repeat Detecting a key press Clearing and drawing the scene Running the game Drawing the games background Preparing the Sprite using a Texture Double buffering the background sprite Running the game Handling errors Configuration errors Compile errors Link errors Bugs Summary FAQ Chapter 2: Variables, Operators, and Decisions Animating Sprites C++ variables Types of variables Declaring and initializing variables Manipulating variables C++ arithmetic and assignment operators Getting things done with expressions Adding clouds, a tree, and a buzzing bee Preparing the tree Preparing the bee Preparing the clouds Drawing the tree, the bee, and the clouds Random numbers Generating random numbers in C++ Making decisions with if and else Logical operators C++ if and else If they come over the bridge, shoot them! Shoot them or else do this instead Reader challenge Timing The frame rate problem The SFML frame rate solution Moving the clouds and the bee Giving life to the bee Blowing the clouds Summary FAQ Chapter 3: C++ Strings and SFML Time Player Input and HUD Pausing and restarting the game C++ Strings Declaring Strings Assigning a value to a String Manipulating Strings SFMLs Text and Font classes Implementing the HUD Adding a time-bar Summary FAQ Chapter 4: Loops, Arrays, Switches, Enumerations, and Functions Implementing Game Mechanics Loops while loops for loops Arrays Declaring an array Initializing the elements of an array What do these arrays really do for our games? Making decisions with switch Class enumerations Getting started with functions Function return types Function names Function parameters The function body Function prototypes Organizing functions Function gotcha! More on functions An absolute final word on functions for now Growing the branches Preparing the branches Updating the branch sprites each frame Drawing the branches Moving the branches Summary FAQ Chapter 5: Collisions, Sound, and End Conditions Making the Game Playable Preparing the player (and other sprites) Drawing the player and other sprites Handling the player's input Handling setting up a new game Detecting the player chopping Detecting a key being released Animating the chopped logs and the axe Handling death Simple sound FX How SFML sound works When to play the sounds Adding the sound code Improving the game and the code Summary FAQ Chapter 6: Object-Oriented Programming Starting the Pong Game OOP Encapsulation Polymorphism Inheritance Why use OOP? What exactly is a class? The theory of a Pong Bat The class variable and function declarations The class function definitions Using an instance of a class Creating the Pong project Coding the Bat class Coding Bat.h Constructor functions Continuing with the Bat.h explanation Coding Bat.cpp Using the Bat class and coding the main function Summary FAQ Chapter 7: Dynamic Collision Detection and Physics Finishing the Pong Game Coding the Ball class Using the Ball class Collision detection and scoring Running the game Summary FAQ Chapter 8: SFML Views Starting the Zombie Shooter Game Planning and starting the Zombie Arena game Creating a new project The project assets Exploring the assets Adding the assets to the project OOP and the Zombie Arena project Building the player the first class Coding the Player class header file Coding the Player class function definitions Controlling the game camera with SFML View Starting the Zombie Arena game engine Managing the code files Starting to code the main game loop Summary FAQ Chapter 9: C++ References, Sprite Sheets, and Vertex Arrays C++ references References summary SFML vertex arrays and sprite sheets What is a sprite sheet? What is a vertex array? Building a background from tiles Building a vertex array Using the vertex array to draw Creating a randomly generated scrolling background Using the background Summary FAQ Chapter 10: Pointers, the Standard Template Library, and Texture Management Learning about Pointers Pointer syntax Declaring a pointer Initializing a pointer Reinitializing pointers Dereferencing a pointer Pointers are versatile and powerful Pointers and arrays Summary of pointers The Standard Template Library What is a map? Declaring a map Adding data to a Map Finding data in a map Removing data from a map Checking the size of a map Checking for keys in a map Looping/iterating through the key-value pairs of a map The auto keyword STL summary The TextureHolder class Coding the TextureHolder header file Coding the TextureHolder function definitions What have we achieved with TextureHolder? Building a horde of zombies Coding the Zombie.h file Coding the Zombie.cpp file Using the Zombie class to create a horde Bringing the horde to life (back to life) Using the TextureHolder class for all textures Changing the way the background gets its textures Changing the way the Player gets its texture Summary FAQ Chapter 11: Collision Detection, Pickups, and Bullets Coding the Bullet class Coding the Bullet header file Coding the Bullet source file Making the bullets fly Including the Bullet class Control variables and the bullet array Reloading the gun Shooting a bullet Updating the bullets each frame Drawing the bullets each frame Giving the player a crosshair Coding a class for pickups Coding the Pickup header file Coding the Pickup class function definitions Using the Pickup class Detecting collisions Has a zombie been shot? Has the player been touched by a zombie? Has the player touched a pickup? Summary FAQ Chapter 12: Layering Views and Implementing the HUD Adding all the Text and HUD objects Updating the HUD Drawing the HUD, home, and level-up screens Summary FAQ Chapter 13: Sound Effects, File I/O, and Finishing the Game Saving and loading the high score Preparing sound effects Leveling up Restarting the game Playing the rest of the sounds Adding sound effects while the player is reloading Making a shooting sound Playing a sound when the player is hit Playing a sound when getting a pickup Making a splat sound when a zombie is shot Summary FAQ Chapter 14: Abstraction and Code Management Making Better Use of OOP The Thomas Was Late game Features of Thomas Was Late Creating the project The project's assets Structuring the Thomas Was Late code Building the game engine Reusing the TextureHolder class Coding Engine.h Coding Engine.cpp The Engine class so far Coding the main function Summary FAQ Chapter 15: Advanced OOP Inheritance and Polymorphism Inheritance Extending a class Polymorphism Abstract classes virtual and pure virtual functions Building the PlayableCharacter class Coding PlayableCharacter.h Coding PlayableCharacter.cpp Building the Thomas and Bob classes Coding Thomas.h Coding Thomas.cpp Coding Bob.h Coding Bob.cpp Updating the game engine to use Thomas and Bob Updating Engine.h to add an instance of Bob and Thomas Updating the input function to control Thomas and Bob Updating the update function to spawn and update the PlayableCharacter instances Drawing Bob and Thomas Summary FAQ Chapter 16: Building Playable Levels and Collision Detection Designing some levels Building the LevelManager class Coding LevelManager.h Coding the LevelManager.cpp file Coding the loadLevel function Updating the engine Collision detection Coding the detectCollisions function More collision detection Summary Chapter 17: Sound Spatialization and the HUD What is spatialization? Emitters, attenuation, and listeners Handling spatialization using SFML Building the SoundManager class Coding SoundManager.h Coding the SoundManager.cpp file Adding SoundManager to the game engine Populating the sound emitters Coding the populateEmitters function Playing sounds Implementing the HUD class Coding HUD.h Coding the HUD.cpp file Using the HUD class Summary Chapter 18: Particle Systems and Shaders Building a particle system Coding the Particle class Coding the ParticleSystem class Exploring SFML's Drawable class and OOP An alternative to inheriting from Drawable Using the ParticleSystem object OpenGL, Shaders, and GLSL The programmable pipeline and shaders Coding a fragment shader Coding a vertex shader Adding shaders to the engine class Loading the shaders Updating and drawing the shader Summary Chapter 19: Game Programming Design Patterns Starting the Space Invaders ++ Game Space Invaders ++ Why Space Invaders ++? Design patterns Screen, InputHandler, UIPanel, and Button Entity-Component pattern Prefer composition over inheritance Factory pattern C++ smart pointers Shared pointers Unique pointers Casting smart pointers C++ assertions Creating the Space Invaders ++ project Organizing code files with filters Adding a DevelopState file Coding SpaceInvaders ++.cpp Coding the GameEngine class Coding the SoundEngine class Coding the ScreenManager class Coding the BitmapStore class Coding the ScreenManagerRemoteControl class Where are we now? Coding the Screen class and its dependents Coding the Button class Coding the UIPanel class Coding the InputHandler class Coding the Screen class Adding the WorldState.h file Coding the derived classes for the select screen Coding the SelectScreen class Coding the SelectInputHandler class Coding the SelectUIPanel class Coding the derived classes for the game screen Coding the GameScreen class Coding the GameInputHandler class Coding the GameUIPanel class Coding the GameOverInputHandler class Coding the GameOverUIPanel class Running the game Summary Chapter 20: Game Objects and Components Preparing to code the components Coding the Component base class Coding the collider components Coding the ColliderComponent class Coding the RectColliderComponent class Coding the graphics components Coding the GraphicsComponent class Coding the StandardGraphicsComponent class Coding the TransformComponent class Coding update components Coding the UpdateComponent class Coding the BulletUpdateComponent class Coding the InvaderUpdateComponent class Coding the PlayerUpdateComponent class Coding the GameObject class Explaining the GameObject class Summary Chapter 21: File I/O and the Game Object Factory The structure of the file I/O and factory classes Describing an object in the world Coding the GameObjectBlueprint class Coding the ObjectTags class Coding the BlueprintObjectParser class Coding the PlayModeObjectLoader class Coding the GameObjectFactoryPlayMode class Coding the GameObjectSharer class Coding the LevelManager class Updating the ScreenManager and ScreenManagerRemoteControl classes Where are we now? Summary Chapter 22: Using Game Objects and Building a Game Spawning bullets Coding the BulletSpawner class Updating GameScreen.h Handling the player's input Using a gamepad Coding the PhysicsEnginePlayMode class Making the game Understanding the flow of execution and debugging Reusing the code to make a different game and building a design mode Summary Chapter 23: Before You Go... Thanks! Other Books You May Enjoy Leave a review - let other readers know what you think

Specyfikacja

Podstawowe informacje

Autor
  • John Horton, Horton
Kategorie
  • Literatura obcojęzyczna
Wybrane wydawnictwa
  • Packt Publishing