Skip to main content
Top

2017 | Book

Pro HTML5 Games

Learn to Build your Own Games using HTML5 and JavaScript

insite
SEARCH

About this book

Build your next game on a bigger scale with Pro HTML5 Games. This essential book teaches you to master advanced game programming in HTML5. You’ll learn techniques that you can transfer to any area of HTML5 game development to make your own professional HTML5 games.

Led by an expert game programmer, you’ll build two complete games in HTML5: a strategy puzzle game based on the Box2d physics engine and in the style of Angry Birds and a real-time strategy (RTS) game complete with units, buildings, path-finding, artificial intelligence, and multiplayer support.

This new and fully updated second edition now includes chapters on mobile game development and an essential game developer's toolkit. Understand how to develop complex, bolder games and become an HTML5 games pro using Pro HTML5 Games today.

What You'll Learn

Create realistic physics in your game by incorporating the Box2d physics engine Design large worlds with lots of characters and let users interact with themUse sprite sheets, panning, parallax scrolling, and sound effects to build a more polished gameIncorporate pathfinding and steering to help characters navigate through your worldCreate challenging levels with intelligent enemies by using decision trees, state machines, and scripted eventsAdd multiplayer in your games using Node.js and the WebSocket API

Table of Contents

Frontmatter
Chapter 1. HTML5 and JavaScript Essentials
Abstract
HTML5, the latest version of the HTML standard, provides us with many new features for improved interactivity and media support.
Aditya Ravi Shankar
Chapter 2. Creating a Basic Game World
Abstract
The arrival of smartphones and handheld devices that support gaming has created a renewed interest in simple puzzle and physics-based games that can be played for short periods of time. Most of these games have a simple concept, small levels, and are easy to learn. One of the most popular and famous games in this genre is Angry Birds (by Rovio Entertainment), a puzzle/strategy game where players use a slingshot to shoot birds at enemy pigs. Despite a fairly simple premise, the game has been downloaded and installed on over two billion devices around the world. The game uses a physics engine to realistically model the slinging, collisions, and breaking of objects inside its game world.
Aditya Ravi Shankar
Chapter 3. Physics Engine Basics
Abstract
A physics engine is a program that provides an approximate simulation of a game world by creating a mathematical model for all the object interactions and collisions within the game. It accounts for gravity, elasticity, friction, and conservation of momentum between colliding objects so that the objects move in a believable way. For our game, we are going to be using an existing and very popular physics engine called Box2D.
Aditya Ravi Shankar
Chapter 4. Integrating the Physics Engine
Abstract
In Chapter 2, we developed the basic framework for our game, Froot Wars, and in Chapter 3, we looked at how to simulate a game world in Box2D. Now it is time to put together all the pieces to complete our game.
Aditya Ravi Shankar
Chapter 5. Creating a Mobile Game
Abstract
Over the last few years, the use of mobile devices and their mobile browsers has steadily increased, to the point where several popular sites have started reporting that the number of mobile device users visiting them exceeds the number of visits from desktop users. While we may not have necessarily reached a tipping point where mobile device usage has surpassed desktop usage everywhere, we have definitely reached a point where mobile device users comprise a significant market share and can no longer be ignored.
Aditya Ravi Shankar
Chapter 6. Creating the RTS Game World
Abstract
Real-time strategy (RTS) games combine fast-paced tactical combat, resource management, and economy building within a defined game world.
Aditya Ravi Shankar
Chapter 7. Adding Entities to Our World
Abstract
In the previous chapter, we put together the basic framework for our RTS game. We loaded a level and panned around using the mouse.
Aditya Ravi Shankar
Chapter 8. Intelligent Unit Movement
Abstract
In the previous chapter, we built a framework for animating and drawing entities within our game and then added different types of buildings, vehicles, aircraft, and terrain to it. Finally, we added the ability to select these entities.
Aditya Ravi Shankar
Chapter 9. Adding More Game Elements
Abstract
In the previous chapter, we developed a framework for unit movement that combines pathfinding and steering. We used this framework to implement move and deploy orders for the vehicles. Finally, we made our unit movement look smoother by interpolating the movement steps during intermediate drawing cycles.
Aditya Ravi Shankar
Chapter 10. Adding Weapons and Combat
Abstract
Over the past few chapters, we built the basic framework for our game; added entities such as vehicles, aircraft, and buildings; implemented unit movement; and created a simple economy using the sidebar. We now have a game where we can start the level, earn money, purchase buildings and units, and move these units around to achieve simple goals.
Aditya Ravi Shankar
Chapter 11. Wrapping Up the Single-Player Campaign
Abstract
Our game framework now has almost everything we need to build a very nice single-player campaign: a level system, various units and buildings, intelligent movement using pathfinding, an economy, and finally combat.
Aditya Ravi Shankar
Chapter 12. Multiplayer with WebSockets
Abstract
No matter how challenging we make a single-player game, it will always lack the challenge of competing against another human being. Multiplayer games allow players to either compete against each other or work cooperatively toward a common goal.
Aditya Ravi Shankar
Chapter 13. Multiplayer Gameplay
Abstract
In the previous chapter, we saw how the WebSocket API could be used with a Node.js server to implement a simple client-server networking architecture. We used this to build a simple game lobby, so two players can now join a game room on a server and start a multiplayer game against each other.
Aditya Ravi Shankar
Chapter 14. Essential Game Developer Toolkit
Abstract
Over the past few years, I have worked on a large number and variety of game projects for clients, including endless runner games, racing games, base-defense games, arcade games, puzzle games, educational games, and different types of multiplayer games.
Aditya Ravi Shankar
Backmatter
Metadata
Title
Pro HTML5 Games
Author
Aditya Ravi Shankar
Copyright Year
2017
Publisher
Apress
Electronic ISBN
978-1-4842-2910-1
Print ISBN
978-1-4842-2909-5
DOI
https://doi.org/10.1007/978-1-4842-2910-1

Premium Partner