Details

HTML5 Games


HTML5 Games

Creating Fun with HTML5, CSS3 and WebGL
2. Aufl.

von: Jacob Seidelin

25,99 €

Verlag: Wiley
Format: EPUB
Veröffentl.: 10.02.2014
ISBN/EAN: 9781118855454
Sprache: englisch
Anzahl Seiten: 456

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<p><b><i>HTML5 Games</i></b>shows you how to combine HTML5, CSS3 and JavaScript to make games for the web and mobiles - games that were previously only possible with plugin technologies like Flash. Using the latest open web technologies, you are guided through the process of creating a game from scratch using Canvas, HTML5 Audio, WebGL and WebSockets.</p> <p>Inside, Jacob Seidelin shows you how features available in HTML5 can be used to create games. First, you will build a framework on which you will create your HTML5 game. Then each chapter covers a new aspect of the game including user input, sound, multiplayer functionality, 2D and 3D graphics and more. By the end of the book, you will have created a fully functional game that can be played in any compatible browser, or on any mobile device that supports HTML5.</p> <p>Topics include: </p> <ul> <li>Dealing with backwards compatibility</li> <li>Generating level data</li> <li>Making iOS and Android web apps</li> <li>Taking your game offline</li> <li>Using Web Workers</li> <li>Persistent Game Data</li> <li>Drawing with Canvas</li> <li>Capturing player input</li> <li>Creating 3D graphics with WebGL</li> <li>Textures and lighting</li> <li>Sound with HTML5 Audio </li> </ul> <p>And more…</p>
<i>Introduction 1</i> <p><i>Who this book is for 2</i></p> <p><i>What this book is about 2</i></p> <p><b>Part I Getting Started with HTML5 Games 5</b></p> <p><b>CHAPTER 1 Gaming on the Web 7</b></p> <p>Tracing the History of HTML5 8</p> <p>Using HTML5 for Games 8</p> <p>Canvas 9</p> <p>Audio 11</p> <p>WebSockets 12</p> <p>Web Storage 13</p> <p>WebGL 14</p> <p>HTML5 and Flash 14</p> <p>Creating Backward Compatibility 15</p> <p>Using feature detection 15</p> <p>Filling the gaps with polyfills 16</p> <p>Building a Game 16</p> <p>Summary 17</p> <p><b>CHAPTER 2 Taking the First Steps 19</b></p> <p>Understanding the Game 20</p> <p>Swapping jewels 20</p> <p>Matching three 20</p> <p>Level progression 20</p> <p>Identifying Game Stages 21</p> <p>Splash screen 21</p> <p>Main menu 22</p> <p>Playing the game 22</p> <p>High score 23</p> <p>Creating the Application Skeleton 24</p> <p>Setting up the HTML 25</p> <p>Adding a bit of style 26</p> <p>Loading the scripts 27</p> <p>Creating a DOM helper module 31</p> <p>Creating the Splash Screen 35</p> <p>Working with web fonts 36</p> <p>Styling the splash screen 37</p> <p>Summary 40</p> <p><b>CHAPTER 3 Going Mobile 41</b></p> <p>Developing Mobile Web Applications 42</p> <p>Write once, read many 42</p> <p>Th e challenges of mobile platforms 43</p> <p>Handling User Input on Mobile Devices 43</p> <p>Keyboard input 43</p> <p>Mouse versus touch 44</p> <p>Adapting to Small Screen Resolutions 45</p> <p>Creating scalable layouts 46</p> <p>Controlling the viewport 48</p> <p>Disabling user scaling 49</p> <p>Creating Different Views 50</p> <p>Creating the main menu 50</p> <p>Adding screen modules 52</p> <p>Using CSS media queries 56</p> <p>Detecting device orientation 58</p> <p>Adding a landscape style sheet 59</p> <p>Developing for iOS and Android Devices 62</p> <p>Placing web applications on the home screen 62</p> <p>Getting the browser out of the way 71</p> <p>Debugging Mobile Web Applications 73</p> <p>Enabling the Safari debugger 74</p> <p>Debugging on Android 76</p> <p>Building Native Web Applications 77</p> <p>PhoneGap 77</p> <p>Future Mobile Platforms 81</p> <p>Summary 81</p> <p><b>Part II Creating the Basic Game 83</b></p> <p><b>CHAPTER 4 Building the Game 85</b></p> <p>Creating the Game Board Module 85</p> <p>Initializing the game state 87</p> <p>Filling the initial board 90</p> <p>Implementing the Rules 93</p> <p>Validating swaps 93</p> <p>Detecting chains 95</p> <p>Refilling the grid 100</p> <p>Swapping jewels 104</p> <p>Summary 105</p> <p><b>CHAPTER 5 Delegating Tasks to Web Workers 107</b></p> <p>Working with Web Workers 107</p> <p>Limitations in workers 108</p> <p>What workers can do 109</p> <p>Using Workers 110</p> <p>Sending messages 111</p> <p>Receiving messages 111</p> <p>Catching errors 112</p> <p>Shared workers 112</p> <p>A prime example 114</p> <p>Using Web Workers in Games 117</p> <p>Creating the worker module 117</p> <p>Keeping the same interface 120</p> <p>Summary 125</p> <p><b>CHAPTER 6 Creating Graphics with Canvas 127</b></p> <p>Ways to Display Graphics on the Web 128</p> <p>Bitmap images 128</p> <p>SVG graphics 128</p> <p>The canvas element 129</p> <p>When to choose canvas 129</p> <p>Drawing with canvas 130</p> <p>Drawing shapes and paths 131</p> <p>Using advanced strokes and fill styles 142</p> <p>Using transformations 147</p> <p>Adding text, images, and shadows 151</p> <p>Managing the state stack 156</p> <p>Drawing the HTML5 logo 157</p> <p>Compositing 164</p> <p>Accessing Image Data 167</p> <p>Retrieving pixel values 167</p> <p>Updating pixel values 168</p> <p>Exporting image fi le data 170</p> <p>Understanding security restrictions 171</p> <p>Creating pixel-based eff ects 171</p> <p>Summary 174</p> <p><b>CHAPTER 7 Creating the Game Display 175</b></p> <p>Tracking Load Progress 176</p> <p>Adding a progress bar 177</p> <p>Building the Game Screen 180</p> <p>Drawing the board with canvas 181</p> <p>Exiting the game 188</p> <p>Pausing the game 191</p> <p>Summary 194</p> <p><b>CHAPTER 8 Interacting with the Game 195</b></p> <p>Capturing User Input 196</p> <p>Mouse events on touch devices 196</p> <p>The virtual keyboard 196</p> <p>Touch events 198</p> <p>Input events and canvas 204</p> <p>Using gamepads and controllers  206</p> <p>Building the Input Module 211</p> <p>Handling input events 214</p> <p>Implementing game actions  220</p> <p>Binding inputs to game functions 226</p> <p>Summary 233</p> <p><b>CHAPTER 9 Animating Game Graphics 235</b></p> <p>Making the Game React 236</p> <p>Animation timing 236</p> <p>Animating the cursor 241</p> <p>Animating game actions 243</p> <p>Adding Points and Time 253</p> <p>Creating the UI elements 254</p> <p>Creating the game timer 259</p> <p>Pausing the game 261</p> <p>Awarding points 263</p> <p>Game over 272</p> <p>Summary 277</p> <p><b>Part III Adding 3D and Sound 279</b></p> <p><b>CHAPTER 10 Creating Audio for Games 281</b></p> <p>HTML5 Audio 282</p> <p>Detecting audio support 282</p> <p>Understanding the audio format wars 283</p> <p>Finding sound effects 285</p> <p>Using the audio Element 286</p> <p>Controlling playback 289</p> <p>Using audio on mobile devices 293</p> <p>Working with Audio Data 294</p> <p>Using the Web Audio API 295</p> <p>Building the Audio Module 300</p> <p>Preparing for audio playback 300</p> <p>Playing sound effects 301</p> <p>Stopping sounds 303</p> <p>Cleaning up 304</p> <p>Adding Sound Effects to the Game 305</p> <p>Playing audio from the game screen 305</p> <p>Summary 306</p> <p><b>CHAPTER 11 Creating 3D Graphics with WebGL 309</b></p> <p>3D for the Web 310</p> <p>Where you can use WebGL 310</p> <p>Getting started with WebGL 310</p> <p>Debugging WebGL 311</p> <p>Creating a helper module 312</p> <p>Using Shaders 313</p> <p>Variables and data types 313</p> <p>Using shaders with WebGL 319</p> <p>Uniform variables 325</p> <p>Varying variables 326</p> <p>Rendering 3D Objects 327</p> <p>Using vertex buffers 328</p> <p>Using index buffers 329</p> <p>Using models, views, and projections 331</p> <p>Rendering 336</p> <p>Loading Collada models 341</p> <p>Using Textures and Lighting 343</p> <p>Adding light 344</p> <p>Adding per-pixel lighting 348</p> <p>Creating textures 351</p> <p>Creating the WebGL display 358</p> <p>Loading the WebGL files 359</p> <p>Creating the jewel objects 360</p> <p>Setting up WebGL 362</p> <p>Rendering jewels 364</p> <p>Animating the jewels 371</p> <p>Using Th ird-Party WebGL Engines 375</p> <p>Summary 376</p> <p><b>Part IV Local Storage and Multiplayer Games 377</b></p> <p><b>CHAPTER 12 Local Storage and Caching 379</b></p> <p>Storing Data with Web Storage 379</p> <p>Using the storage interface 380</p> <p>Building a storage module 384</p> <p>Making the Game State Persistent 385</p> <p>Saving the game data 385</p> <p>Creating a High Score List 389</p> <p>Building the high score screen 389</p> <p>Storing the high score data 392</p> <p>Displaying the high score data 394</p> <p>Application Cache 395</p> <p>The cache manifest 396</p> <p>Summary 399</p> <p><b>CHAPTER 13 Going Online with WebSockets 401</b></p> <p>Using WebSockets 401</p> <p>Connecting to servers 402</p> <p>Communicating with WebSockets 405</p> <p>Using Node on the Server 407</p> <p>Installing Node 408</p> <p>Creating an HTTP server with Node 410</p> <p>Creating a WebSocket chat room 412</p> <p>Summary 420</p> <p><b>BONUS CHAPTER: APPENDIX A</b></p> <p>Canvas Reference BC1</p> <p>The Canvas Element BC1</p> <p>The 2D Context API BC2</p> <p>State management BC2</p> <p>Transformations BC3</p> <p>Shapes and Paths BC4</p> <p>Path Objects BC9</p> <p>Fills and Strokes BC11</p> <p>Shadows BC13</p> <p>Images BC14</p> <p>Text BC15</p> <p>Compositing BC16</p> <p>Pixel manipulation BC17</p> <p><b>BONUS CHAPTER: APPENDIX B</b></p> <p>WebGL Reference BC19</p> <p>WebGL API Reference BC19</p> <p>Data types BC20</p> <p>Typed arrays BC21</p> <p>Context properties BC21</p> <p>Buffers BC22</p> <p>Shaders BC23</p> <p>Program objects BC24</p> <p>Uniform variables BC25</p> <p>Vertex attributes BC27</p> <p>Drawing BC28</p> <p>Textures BC29</p> <p>Blending BC33</p> <p>Stencil buffer BC34</p> <p>Depth buffer BC35</p> <p>Render buffers BC35</p> <p>Frame buffers BC37</p> <p>Other methods BC39</p> <p>Parameters BC40</p> <p><b>BONUS CHAPTER: APPENDIX C</b></p> <p>OpenGL ES Shading Language BC47</p> <p>GLSL ES Language Reference BC47</p> <p>Data types BC47</p> <p>Built-in functions BC49</p> <p>Built-in variables and constants BC57</p> <p><i>Index 421</i></p>
<p><b>Jacob Seidelin (Copenhagen)</b> is a freelance web developer with 10 years of experience working with both backend programming, graphics design and front-end technology. When not working with clients of all sizes he enjoys JavaScript and HTML5, web game development and generally pushing the limit of what is possible in the browser. The results of his adventures in web development can be witnessed at his website at www.nihilogic.dk</p>

Diese Produkte könnten Sie auch interessieren:

AutoCAD 2013 For Dummies
AutoCAD 2013 For Dummies
von: Bill Fane, David Byrnes
PDF ebook
23,99 €
IBM Workplace Services Express For Dummies
IBM Workplace Services Express For Dummies
von: Stephen R. Londergan, Michael Loria
PDF ebook
16,99 €
Building Flash Web Sites For Dummies
Building Flash Web Sites For Dummies
von: Doug Sahlin
PDF ebook
18,99 €