O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Game Development with Three.js

Book Description

With Three.js you can create sophisticated 3D games that run in the web browser. This book is aimed at both the professional game designer and the enthusiast with a step by step approach including lots of tips and examples.

  • Develop immersive 3D games that anyone can play on the Internet
  • Learn Three.js from a gaming perspective, including everything you need to build beautiful and high-performance worlds
  • A step-by-step guide filled with game-focused examples and tips

In Detail

The advent of WebGL and its inclusion in many browsers enabled JavaScript programs running in a web browser to access the GPU without a plugin or extension. Three.js is a next generation high-level library that makes it possible to author complex 3D computer animations that display in the browser using nothing more than a simple text editor. The development of these new tools has opened up the world of real-time 3D computer animations to a far broader spectrum of developers.

Starting with how to build 3D games on the web using the Three.js graphics library, you will learn how to build 3D worlds with meshes, lighting, user interaction, physics, and more. Along the way, you’ll learn how to build great online games through fun examples. Use this book as a guide to embrace the next generation of game development!

Moving on from the basics, you will learn how to use Three.js to build game worlds using its core components, including renderers, geometries, materials, lighting, cameras, and scenes. Following on from this, you will learn how to work with mouse and keyboard interactions, incorporate game physics, and import custom models and animations. You will also learn how to include effects like particles, sounds, and post-processing. You will start by building a 3D world, and then create a first person shooter game using it. You will then be shown how to imbue this FPS game with a “capture the flag” gameplay objective. With Game Development with Three.js, you will be able to build 3D games on the Web using the Three.js graphics library.

Table of Contents

  1. Game Development with Three.js
    1. Table of Contents
    2. Game Development with Three.js
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Hello, Three.js
      1. The wonderful world of Three.js
      2. Let's code!
      3. Been there, scene that
      4. Choosing your environment
      5. Summary
    9. 2. Building a World
      1. Geometries
        1. 3D primitives
        2. 2D primitives
        3. Custom geometries
        4. Text
      2. Materials
      3. A city scene
      4. Lighting
        1. Shadows
      5. Renderers
      6. Summary
    10. 3. Exploring and Interacting
      1. Keyboard movement and mouse looking
      2. Clicking
      3. Timing
      4. First-person shooter project
        1. Designing a map
        2. Constructing a player
        3. Player movement
          1. Physical movement
          2. Updating the player's movement and rotation
        4. Player collision
          1. Voxel collision
        5. Bots
        6. Bullets
        7. Updating the game loop
      5. Summary
    11. 4. Adding Detail
      1. Setting up CTF
      2. Asset management
        1. Loaders
        2. Exporting to Three.js
        3. Exporting from Three.js
        4. Managing loaders
        5. Mesh animation
          1. Morph animation
          2. Skeletal animation
      3. Particle systems
        1. Capturing the flag
        2. Particles and Sprites
        3. Particle systems
      4. Sound
      5. Renderer effects and postprocessing
      6. Summary
    12. 5. Design and Development
      1. Game design for the Web
      2. Performance
      3. Bandwidth/network constraints
      4. Level of detail
      5. Rendering optimizations
      6. Battery life and GPU memory
      7. Performance-measuring tools
      8. Networking and multiplayer
        1. Technologies
        2. Anticheating
      9. Development processes
        1. JavaScript best practices
        2. Existing workflows and level development
      10. Summary
    13. Index