舉報

會員
Hands-On Game Development with WebAssembly
Rick Battagline 著
更新時間:2021-06-24 13:41:55
開會員,本書免費讀 >
Withinthenextfewyears,WebAssemblywillchangethewebasweknowit.Itpromisesaworldwhereyoucanwriteanapplicationforthewebinanylanguage,andcompileitfornativeplatformsaswellastheweb.ThisbookisdesignedtointroducewebdevelopersandgamedeveloperstotheworldofWebAssemblybywalkingthroughthedevelopmentofaretroarcadegame.YouwilllearnhowtobuildaWebAssemblyapplicationusingC++,Emscripten,JavaScript,WebGL,SDL,andHTML5.Thisbookcoversalotofgroundinbothgamedevelopmentandwebapplicationdevelopment.WhencreatingagameorapplicationthattargetsWebAssembly,developersneedtolearnaplethoraofskillsandtools.Thisbookisasampleplatterofthosetoolsandskills.ItcoverstopicsincludingEmscripten,C/C++,WebGL,OpenGL,JavaScript,HTML5,andCSS.Thereaderwillalsolearnbasictechniquesforgamedevelopment,including2Dspriteanimation,particlesystems,2Dcameradesign,soundeffects,2Dgamephysics,userinterfacedesign,shaders,debugging,andoptimization.Bytheendofthebook,youwillbeabletocreatesimplewebgamesandwebapplicationstargetingWebAssembly.
最新章節
- Leave a review - let other readers know what you think
- Other Books You May Enjoy
- This is the end
- Summary
- Emscripten OpenGL flags
- Minimizing the number of OpenGL calls
品牌:中圖公司
上架時間:2021-06-24 12:13:53
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Leave a review - let other readers know what you think 更新時間:2021-06-24 13:41:55
- Other Books You May Enjoy
- This is the end
- Summary
- Emscripten OpenGL flags
- Minimizing the number of OpenGL calls
- Using WebGL 2.0 if possible
- Optimizing OpenGL for WebAssembly
- Problems with try/catch blocks
- Profiling
- Unsafe flags
- Optimizing for size
- Optimizing for performance
- Optimization flags
- Optimizing for WebAssembly
- Firefox Developer Edition
- Debugging using Firefox
- Debugging using Chrome
- Using asm.js as an alternative for debugging
- Compiling your code for debugging
- Browser debugging
- Source maps
- Debug macro and stack trace
- Debugging and Optimization
- Summary
- Compiling and running our lighting app
- The draw_light_icon function
- The input function
- The game_loop function
- The main function
- Function prototypes
- SDL global variables
- OpenGL global variables
- Fragment shader updates
- Creating a 2D lighting demo app
- Normal maps
- Specular light
- Diffuse light
- Ambient light
- 3D lighting
- Compiling and running our code
- Updating game_loop()
- Changes to main()
- Other global variable changes
- OpenGL global variable changes
- Fragment shader changes
- Mixing textures for a glow effect
- Compiling and running our code
- The game loop
- The main function
- SDL global variables
- OpenGL global variables
- Shader code
- WebGL app redux
- GLSL ES 1.0 and 3.0
- More about shaders
- Using OpenGL with WebAssembly
- Shaders and 2D Lighting
- Summary
- Compile ui.html
- The RenderUI function
- Defining the constructor
- ui_sprite.cpp
- The RenderUI function
- The KeyDown function
- The MouseUp function
- The MouseClick function
- The MouseMove function
- ui_button.cpp
- Changes to the main function
- Play and play again callbacks
- The game loop
- The transition state
- The collisions function
- The render functions
- The end_input function
- Input functions
- Adding global variables
- Changes to main.cpp
- New external variables
- Modifying the RenderManager class
- Changes to games.hpp
- Screen states
- Creating a button
- Mouse input
- Game over screen
- Play screen
- Opening screen
- UI requirements
- UI and Mouse Input
- Summary
- Compiling the physics.html file
- Changes to the ship.cpp file
- Changes to asteroid.cpp and projectile.cpp
- Changing the main.cpp file
- Changes to star.cpp
- Changing collider.cpp
- Changing the game.hpp file
- Modifying the code
- Improving collisions
- Adding gravity
- Newton's third law
- Game Physics
- Summary
- Compiling and running
- The new audio.cpp file
- Updating ship.cpp
- Updating main.cpp
- Updating game.hpp
- Adding sound to our game
- Simple audio with Emscripten
- Where to get sound effects
- Sound FX
- Summary
- Compiling and playing with the advanced camera
- Changes to camera.cpp
- Changes to games.hpp
- A more advanced camera
- Compiling and playing with a locked-on camera
- Modifying vector.cpp
- Modifying star.cpp
- Modifying ship.cpp
- Modifying shield.cpp
- Modifying projectile.cpp
- Modifying player_ship.cpp
- Modifying particle.cpp
- Modifying finite_state_machine.cpp
- Modifying enemy_ship.cpp
- Modifying collider.cpp
- Modifying asteroid.cpp
- Modifying the main function
- Modifying the render function
- Modifying the move function
- New global variables
- Modifying main.cpp
- The render_manager.cpp file
- The camera.cpp file
- The RenderManager class definition
- The Camera class definition
- The Locator class definition
- The Vector2D class definition
- Modifying the game.hpp file
- Modifying our code
- Projected focus and camera attractors
- Camera for tracking player movement
- Creating a camera for our game
- Designing a 2D Camera
- Summary
- Compiling the ai.html file
- The AvoidForce function
- Writing an FSM
- The Vector2D class
- Vector projection
- Circle-line collision detection
- More collision detection
- Adding force fields
- Adding obstacles to our game
- Modifying game.hpp
- Combining forces
- The wander behavior
- Obstacle avoidance
- The evade behavior
- The pursuit behavior
- The arrival behavior
- The flee behavior
- The seek behavior
- Introducing steering behaviors
- What is an FSM?
- Autonomous agents versus top-down AI
- What is Game AI?
- AI and Steering Behaviors
- Summary
- Taking it further
- Compiling the new particle_system.html file
- Changes to main.cpp
- Changes to projectile_pool.cpp
- The Ship class' Render function
- The Ship class' Acceleration function
- The Ship class' constructor function
- Changes to ship.cpp
- Changes to the Move function
- Adding a Run function
- Changes to the Update function
- Changes to the constructor function
- Changes to emitter.cpp
- Emitter class definition
- Adding the Particle class definition
- Changes to game.hpp
- Creating a particle emitter
- Compiling and running the new tool
- HTML shell and WebAssembly module interaction
- Configuring the particle emitter
- Updating an emitter
- Adding an emitter
- Random floating-point numbers
- External functions
- Emitter Move function
- Emitter update logic
- The Emitter constructor function
- Modifying the Emitter class
- Particle Render function
- Particle Move function
- Particle Spawn function
- Particle Update logic
- Particle constructor logic
- Changes to particle.cpp
- The Spawn function's parameters
- The Update function's parameters
- Additional constructor parameters
- The source rectangle attribute
- Size and scale attributes
- Animation attributes
- Color attributes
- Aligning rotation attributes
- New attributes
- Modifying the Particle class
- Modifying the handleFiles function
- Additional variable coercions
- Coercing color values
- The JavaScript UpdateClick function
- Modifying the JavaScript
- Animation frames
- Emission time
- Aligning particle rotation
- Looping the emitter
- Particle burst
- Color-blending values
- Scaling values
- Modifying our HTML shell file
- Improved Particle Systems
- Summary
- Compiling and testing the particle emitter
- Initialization
- The looping function
- Updating the emitter
- Dead code elimination
- C++ name mangling
- WebAssembly interface functions
- The Emitter class
- The Particle class
- The Point class
- The simple particle emitter tool
- Adding the JavaScript
- Trigonometry again?
- Vector versus raster graphics
- A brief introduction to SVG
- Adding to the virtual file system
- Basic Particle System
- Summary
- Compiling collider.html
- Implementing compound circle colliders
- Pointers in memory
- Destroying a spaceship on collision
- Implementing circle collision detection
- Compound colliders
- Line collision detection
- A short refresher on trigonometry
- Rectangle collision detection
- Circle collision detection
- Types of 2D collision detection
- Collision Detection
- Summary
- Compiling game_objects.html
- Creating an enemy
- Pooling the player's projectiles
- Object pooling
- The player's spaceship game object
- Game objects
- Compiling gameloop.html
- Writing a basic game loop
- Understanding the game loop
- Game Objects and the Game Loop
- Summary
- Using keyboard input to move a sprite
- Adding SDL keyboard input to WebAssembly
- JavaScript keyboard input
- Keyboard Input
- Summary
- Compiling sprite.html
- Moving the sprite
- Animating a sprite
- Render a sprite to the canvas
- Compiling hello_sdl.html
- Cleaning up SDL
- Rendering a texture to the HTML5 canvas
- Using the WebAssembly virtual filesystem
- Clearing the SDL renderer
- Initializing SDL
- Using SDL in WebAssembly
- Sprite Animations in WebAssembly with SDL
- Summary
- The MoveShip function
- The ShipPosition function
- The ModuleLoaded function
- Defining the shaders
- Buffer constants
- The return of vertex and texture data
- WebGL global variables
- Major JavaScript changes
- Minor tweaks to the head tag
- 2D canvas to WebGL
- Vertex and UV data
- WebGL coordinate system versus 2D canvas
- WebGL and JavaScript
- An introduction to WebGL shaders
- WebGL and canvas contexts
- Introduction to WebGL
- Summary
- Adding a canvas to the Emscripten template
- Immediate mode versus retained mode
- HTML5 and game development
- Defining the CSS
- Creating a new HTML shell and C file
- The Emscripten minimal shell file
- HTML5 and WebAssembly
- Summary
- Additional installation resources
- Using Emscripten
- Installing Emscripten on Ubuntu
- Installing Emscripten on Windows
- Emscripten
- A brief introduction to WebAssembly text
- A brief introduction to LLVM
- What is asm.js?
- Will WebAssembly replace JavaScript?
- Why is WebAssembly faster than JavaScript?
- Why do we need WebAssembly?
- What is WebAssembly?
- Introduction to WebAssembly and Emscripten
- Reviews
- Get in touch
- Conventions used
- Conventions used
- Download the color images
- Download the example code files
- To get the most out of this book
- What this book covers
- Who this book is for
- Preface
- Packt is searching for authors like you
- About the reviewers
- About the author
- Contributors
- Packt.com
- Why subscribe?
- About Packt
- Dedication
- Hands-On Game Development with WebAssembly
- Copyright and Credits
- Title Page
- coverpage
- coverpage
- Title Page
- Copyright and Credits
- Hands-On Game Development with WebAssembly
- Dedication
- About Packt
- Why subscribe?
- Packt.com
- Contributors
- About the author
- About the reviewers
- 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
- Conventions used
- Get in touch
- Reviews
- Introduction to WebAssembly and Emscripten
- What is WebAssembly?
- Why do we need WebAssembly?
- Why is WebAssembly faster than JavaScript?
- Will WebAssembly replace JavaScript?
- What is asm.js?
- A brief introduction to LLVM
- A brief introduction to WebAssembly text
- Emscripten
- Installing Emscripten on Windows
- Installing Emscripten on Ubuntu
- Using Emscripten
- Additional installation resources
- Summary
- HTML5 and WebAssembly
- The Emscripten minimal shell file
- Creating a new HTML shell and C file
- Defining the CSS
- HTML5 and game development
- Immediate mode versus retained mode
- Adding a canvas to the Emscripten template
- Summary
- Introduction to WebGL
- WebGL and canvas contexts
- An introduction to WebGL shaders
- WebGL and JavaScript
- WebGL coordinate system versus 2D canvas
- Vertex and UV data
- 2D canvas to WebGL
- Minor tweaks to the head tag
- Major JavaScript changes
- WebGL global variables
- The return of vertex and texture data
- Buffer constants
- Defining the shaders
- The ModuleLoaded function
- The ShipPosition function
- The MoveShip function
- Summary
- Sprite Animations in WebAssembly with SDL
- Using SDL in WebAssembly
- Initializing SDL
- Clearing the SDL renderer
- Using the WebAssembly virtual filesystem
- Rendering a texture to the HTML5 canvas
- Cleaning up SDL
- Compiling hello_sdl.html
- Render a sprite to the canvas
- Animating a sprite
- Moving the sprite
- Compiling sprite.html
- Summary
- Keyboard Input
- JavaScript keyboard input
- Adding SDL keyboard input to WebAssembly
- Using keyboard input to move a sprite
- Summary
- Game Objects and the Game Loop
- Understanding the game loop
- Writing a basic game loop
- Compiling gameloop.html
- Game objects
- The player's spaceship game object
- Object pooling
- Pooling the player's projectiles
- Creating an enemy
- Compiling game_objects.html
- Summary
- Collision Detection
- Types of 2D collision detection
- Circle collision detection
- Rectangle collision detection
- A short refresher on trigonometry
- Line collision detection
- Compound colliders
- Implementing circle collision detection
- Destroying a spaceship on collision
- Pointers in memory
- Implementing compound circle colliders
- Compiling collider.html
- Summary
- Basic Particle System
- Adding to the virtual file system
- A brief introduction to SVG
- Vector versus raster graphics
- Trigonometry again?
- Adding the JavaScript
- The simple particle emitter tool
- The Point class
- The Particle class
- The Emitter class
- WebAssembly interface functions
- C++ name mangling
- Dead code elimination
- Updating the emitter
- The looping function
- Initialization
- Compiling and testing the particle emitter
- Summary
- Improved Particle Systems
- Modifying our HTML shell file
- Scaling values
- Color-blending values
- Particle burst
- Looping the emitter
- Aligning particle rotation
- Emission time
- Animation frames
- Modifying the JavaScript
- The JavaScript UpdateClick function
- Coercing color values
- Additional variable coercions
- Modifying the handleFiles function
- Modifying the Particle class
- New attributes
- Aligning rotation attributes
- Color attributes
- Animation attributes
- Size and scale attributes
- The source rectangle attribute
- Additional constructor parameters
- The Update function's parameters
- The Spawn function's parameters
- Changes to particle.cpp
- Particle constructor logic
- Particle Update logic
- Particle Spawn function
- Particle Move function
- Particle Render function
- Modifying the Emitter class
- The Emitter constructor function
- Emitter update logic
- Emitter Move function
- External functions
- Random floating-point numbers
- Adding an emitter
- Updating an emitter
- Configuring the particle emitter
- HTML shell and WebAssembly module interaction
- Compiling and running the new tool
- Creating a particle emitter
- Changes to game.hpp
- Adding the Particle class definition
- Emitter class definition
- Changes to emitter.cpp
- Changes to the constructor function
- Changes to the Update function
- Adding a Run function
- Changes to the Move function
- Changes to ship.cpp
- The Ship class' constructor function
- The Ship class' Acceleration function
- The Ship class' Render function
- Changes to projectile_pool.cpp
- Changes to main.cpp
- Compiling the new particle_system.html file
- Taking it further
- Summary
- AI and Steering Behaviors
- What is Game AI?
- Autonomous agents versus top-down AI
- What is an FSM?
- Introducing steering behaviors
- The seek behavior
- The flee behavior
- The arrival behavior
- The pursuit behavior
- The evade behavior
- Obstacle avoidance
- The wander behavior
- Combining forces
- Modifying game.hpp
- Adding obstacles to our game
- Adding force fields
- More collision detection
- Circle-line collision detection
- Vector projection
- The Vector2D class
- Writing an FSM
- The AvoidForce function
- Compiling the ai.html file
- Summary
- Designing a 2D Camera
- Creating a camera for our game
- Camera for tracking player movement
- Projected focus and camera attractors
- Modifying our code
- Modifying the game.hpp file
- The Vector2D class definition
- The Locator class definition
- The Camera class definition
- The RenderManager class definition
- The camera.cpp file
- The render_manager.cpp file
- Modifying main.cpp
- New global variables
- Modifying the move function
- Modifying the render function
- Modifying the main function
- Modifying asteroid.cpp
- Modifying collider.cpp
- Modifying enemy_ship.cpp
- Modifying finite_state_machine.cpp
- Modifying particle.cpp
- Modifying player_ship.cpp
- Modifying projectile.cpp
- Modifying shield.cpp
- Modifying ship.cpp
- Modifying star.cpp
- Modifying vector.cpp
- Compiling and playing with a locked-on camera
- A more advanced camera
- Changes to games.hpp
- Changes to camera.cpp
- Compiling and playing with the advanced camera
- Summary
- Sound FX
- Where to get sound effects
- Simple audio with Emscripten
- Adding sound to our game
- Updating game.hpp
- Updating main.cpp
- Updating ship.cpp
- The new audio.cpp file
- Compiling and running
- Summary
- Game Physics
- Newton's third law
- Adding gravity
- Improving collisions
- Modifying the code
- Changing the game.hpp file
- Changing collider.cpp
- Changes to star.cpp
- Changing the main.cpp file
- Changes to asteroid.cpp and projectile.cpp
- Changes to the ship.cpp file
- Compiling the physics.html file
- Summary
- UI and Mouse Input
- UI requirements
- Opening screen
- Play screen
- Game over screen
- Mouse input
- Creating a button
- Screen states
- Changes to games.hpp
- Modifying the RenderManager class
- New external variables
- Changes to main.cpp
- Adding global variables
- Input functions
- The end_input function
- The render functions
- The collisions function
- The transition state
- The game loop
- Play and play again callbacks
- Changes to the main function
- ui_button.cpp
- The MouseMove function
- The MouseClick function
- The MouseUp function
- The KeyDown function
- The RenderUI function
- ui_sprite.cpp
- Defining the constructor
- The RenderUI function
- Compile ui.html
- Summary
- Shaders and 2D Lighting
- Using OpenGL with WebAssembly
- More about shaders
- GLSL ES 1.0 and 3.0
- WebGL app redux
- Shader code
- OpenGL global variables
- SDL global variables
- The main function
- The game loop
- Compiling and running our code
- Mixing textures for a glow effect
- Fragment shader changes
- OpenGL global variable changes
- Other global variable changes
- Changes to main()
- Updating game_loop()
- Compiling and running our code
- 3D lighting
- Ambient light
- Diffuse light
- Specular light
- Normal maps
- Creating a 2D lighting demo app
- Fragment shader updates
- OpenGL global variables
- SDL global variables
- Function prototypes
- The main function
- The game_loop function
- The input function
- The draw_light_icon function
- Compiling and running our lighting app
- Summary
- Debugging and Optimization
- Debug macro and stack trace
- Source maps
- Browser debugging
- Compiling your code for debugging
- Using asm.js as an alternative for debugging
- Debugging using Chrome
- Debugging using Firefox
- Firefox Developer Edition
- Optimizing for WebAssembly
- Optimization flags
- Optimizing for performance
- Optimizing for size
- Unsafe flags
- Profiling
- Problems with try/catch blocks
- Optimizing OpenGL for WebAssembly
- Using WebGL 2.0 if possible
- Minimizing the number of OpenGL calls
- Emscripten OpenGL flags
- Summary
- This is the end
- Other Books You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-06-24 13:41:55