The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's [1 ed.] 9781498788748, 1498788742

This book is aimed at giving novice coders an understanding of the methods and techniques used in professional games dev

524 101 27MB

English Pages 532 [534] Year 2018

Report DMCA / Copyright

DOWNLOAD FILE

The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's [1 ed.]
 9781498788748, 1498788742

Table of contents :
Cover
Half Title
Title Page
Copyright Page
Table of Contents
“From Hello World to Halo—It’s Just Code!”
Thanks
Brian Beuken: Who Is He?
1: Getting Started
Mine Looks Different?
First Steps
Setting Things Up
Introducing Visual Studio
Hello World
Hello Place of My Choosing
2: Getting Our Target Ready
Setting Up the Target
Oh Wait…Did We Plug-In?
Starting Up VisualGDB for the First Time
Getting the Machines to Talk
Sending Our First Program
Debugger Hangs Too Much?
3: Using the Target
Ready to Rock and Ermm Indeed Roll!
Graphics Explained!
So It Be OpenGL ES Ye Be Wanting Arrgghhh!
Where Is OpenGLES2.0 on My Target?
A Nice New Project with Graphics
So Much Typing?
Our First Graphics Project!
Are We There Yet?
Houston We Have a Triangle
Behold the Triangle Code!
Why Are We Working in a Window?
2D
4: Putting It All Together
Expanding Our First Graphics Program
Loading Graphics or Other Assets
Adding Assets to the Build Chain
Keeping Things Tidy
Add Some Code
Displaying More Images
But I Didn’t Do Anything Wrong?
But I Fixed It?
Making a Dynamic Playfield
Old School Frame Buffers
Setting Up the Frame Buffer and Switch System
5: Finally Our First Games
5.1 Invaders from Space
Using the OS
Start as We Mean to Go on
We’re Here Now
Inheritance
Every Story Needs a Villan
Arrays or Vectors
Move Em Out!
Animation 101
Hand Me a Bag of Bullets
Did We Hit It?
Box Checks
Circle Checks
Give Me Shelter
So Which Is Better?
Final Details
Simple Text Display
A Simple Font
How Did We Do? The Infamous Postmortem
Fix Question 4
A Pat on the Back
Kamikazi Invaders
The Ship
Da Baddies!
Now We’re Talking
Make Them Move
Get Them Flying
A Nice Arc
Step by Step
Dive Dive Dive
Bombs Away
Get Back to Where You Once Belonged
Home Again!
Vectors, Our Flexible Friends
Lets Get Lethal
Bombs Away for Real Now
Danger UXB
Stepping Back, Deciding When to Go
Breaker Breaker Rubber Duck
Fred Reacts!
Tidy Up the Logic
Twiddles and Tweaks
Postmortem
Jumping around a Bit Though?
Crawling Over, Time for Baby Steps
Object-Oriented Programming Is Not an Error
Encapsulation
Abstraction
Inheritance
Polymorphism
Start the Music
Welcome to OpenAL
Installing OpenAL
Getting OpenAL Working
Dealing with Sound as Data
How Does OpenAL Work?
How Does Alut Work?
Horrible Earworms
Streaming
The War against Sloppy Code Storage!
Our Own Library
Using This New Library
Lets Get a Bit More Compiler Speed
5.2 Tiles and Backgrounds
What Do We Mean by Tiles?
Working with Tiles
What a Wonderful World
Homing in
Wrapping It Up
Is This All We Need?
5.3 Single-Screen Platforms
A World with Gravity
Routine Bad Guys
Point-to-Point
Patrolling Enemy
Homing Enemy
Ladders and Effects
Data, Our Flexible Friend
Loading Our Maps (and Other Resources)
5.4 Lets Scroll This
Simple Scrolling Shooter
Let Them Eat Lead
Bring on the Bad Guys!
Process Everything?
No More Mr Nice Guy
What Will Make It Better?
There’s No Wrong Way…But There Are Always Better Ways
For a FireWork, Life Is Short But Sweet!
A New Dawn for Particle Kind!
There’s Always a Price to Pay
Handling Large Numbers of Objects
Locking the Frame Rate
Recapping the 2D Experience
6: A New Third Dimension
A Short Explanation of 3D
MATHS!! Don’t Be Scared (Much)
How Does This Witchcraft Work?
This Is All a Bit Much?
Installing a Maths Library
Danger, Will Robinson!
Normal Programming Resumes
Three Types of Matrix
Model Matrix
View Matrix
Projection Matrix
The Relationship of These Three Matrices
Other Matrix Functions
Moving Around
Revisiting Hello Triangle
Let’s Try a Cube
Mistakes Waiting to Happen
A Quick Word about Using Quaternions
HelloCubes
I Thought We Could Move 100’s of Thousands of Them?
How the GPU Gets Data
Buffers, Buffers Everywhere
Vertex Buffers
Attribute Pointers
Texture Buffer
Frame Buffer
Render Buffer
Buffers Are Not Free
Let’s Get Back to It
Time to Texture Our Cube
The Fixed Pipeline Isn’t Quite Dead
Mapping a Texture to Our Faces
Choose the Size to Suit
Limited Numbers of Textures?
Everyone Loves a Triangle But!
3D Lets Get into the Heart of Our GPU
What Else You Got?
Loading Models (OBJ)
Locate and Install an OBJ Model Loader
Installing and Using TinyObjLoader
Do We Care about the Data?
Lights Camera Action
The Return of the Vector
Dot Product
Another Fun Vector Fact-Cross Product
Who’s to Say Whats Normal?
Types of Light
Light Sources
Shadows, a Place Where Danger Hides
Shaders
So What Is a Shader?
Keeping Track of Them
Introducing the Shader Language
Let’s Light It Up!
The Camera Never Lies
But What Does It All Do?
In Space, No One Can Hear You Smashing Your Keyboard As You Scream Why “Don’t You Work!!!”
7: Space the Final Frontier
Space, Why All the Asteroids?
Skyboxes
The Game’s Afoot Which Way to Turn?
We’re Going to Need Some Game Mechanics
HUD and Cockpits
GUI
Screen or Render
3Dfont
Hit Em Where It Shows
3D Collision
Primitive Collision Types
Culling Concepts
Grids, Quad Trees, and OctTrees
Possible Collision Systems
Sphere-to-Sphere
3D Particles
The Wrap Up
8: Recognizable Environments
Let’s Talk about Time!
Animating Models
Limitations of OBJ
The MD(x) Systems
Controlling the Animation of Our MD2 Model
Explaining Environments
The Ground, the Place Where You Will Fall to!
A Simple Ground Plane
Level of Detail
Mipmapping
Filtering
We Don’t All Live in the Netherlands
Using an OBJ File—The Simple Solution
How Far above Sea Level Are We?
Interacting with Our World
Collision Maps
Render Culling!
Adding the Functionality
Physics, More Scary Maths Stuff?
Subtitle…More Long Winded Explanations!
Introducing Bullet Physics
How It Works, and Finally Quaternions
Let’s Get to It, at Last
Setting Things Up
Stepping Through
Visualizing Things
Force, Torque, and Impulse
Collisions
The Downside
Basic Racing Game
Getting and Making the Car Controllable
I Like to Move It, Move It
Staying on Track
Using Bullet to Collide with the Terrain
Can’t Find My Way Home?
Other Optimizations
Other Performance Options
9: Let’s Go Indoors
The Beginnings, Doom, and Beyond
Occlusion, a Discussion to Have for a Problem to Solve Later
Exploring the Maze
Moving the Baddies Around, Things!
What Do We Draw?
Whats the Point?
Ray Cast and Picking
Are We Going to Do Any AI?
10: Graphics Need a Boost
That Cat’s Been in the Bag Long Enough
Shadow Mapping
Recap the Processes
11: Populating the World
Keeping Track of the Assets
Scene Management
Wrangling All That Data
Asset Management
Fragmentation, a Problem That’s Hard to Solve
Expanding to an SDK?
The Last Project
Ready-Made or Roll Your Own
Limitations of Hardware
Cross-Platform Compilation
12: Some Advanced Stuff
Multicore Fun
What Is Threading?
Threads and Pthreads
Job Managing, Also Kinda Simple
With Great Power Comes Great Heat
The End Is Near!
Appendix I
Where Files Live on Non-Raspberry Machines
Appendix II
Updating versus New SD
Appendix III
A Word or Two about Source Control
Appendix IV
Bits Bytes and Nibbles Make You Hungry!
Appendix V
OpenGLES3.0+
Appendix VI
The Libs We Used
On the PC End
Appendix VII
Writing My Own Games?
Appendix VIII
Visual Studio 2017
Index

Polecaj historie