Giter Site home page Giter Site logo

packtpublishing / hands-on-game-development-with-webassembly Goto Github PK

View Code? Open in Web Editor NEW
81.0 8.0 26.0 13.98 MB

Hands-On Game Development with WebAssembly, Published by Packt

License: MIT License

C 0.76% CSS 0.07% HTML 21.17% JavaScript 73.33% C++ 4.60% Shell 0.07% Makefile 0.01%

hands-on-game-development-with-webassembly's Introduction

Hands-On Game Development with WebAssembly

Book Name

This is the code repository for Hands-On Game Development with WebAssembly, published by Packt.

Learn WebAssembly C++ programming by building a retro space game

What is this book about?

Within the next few years, WebAssembly will change the web as we know it. It promises a world where you can write an application for the web in any language, and compile it for native platforms as well as the web.

This book covers the following exciting features:

  • Build web applications with near-native performance using WebAssembly
  • Become familiar with how web applications can be used to create games using HTML5 Canvas, WebGL, and SDL
  • Become well versed with game development concepts such as sprites, animation, particle systems, AI, physics, camera design, sound effects, and shaders
  • Deploy C/C++ applications to the browser using WebAssembly and Emscripten
  • Understand how Emscripten HTML shell templates, JavaScript glue code, and a WebAssembly module interact

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

<label class="ccontainer"><span class="label">loop:</span>
<input type="checkbox" id="loop" checked="checked">
<span class="checkmark"></span>
</label>
<br/>

Following is what you need for this book: Web developers and game developers interested in creating applications for the web using WebAssembly. Game developers interested in deploying their games to the web Web developers interested in creating applications that are potentially orders of magnitude faster than their existing JavaScript web apps C/C++ developers interested in using their existing skills to deploy applications to the web.

With the following software and hardware list you can run all code files present in the book (Chapter 1-16).

Software and Hardware List

Chapter Software required OS required
1 - 16 Emscripten, Python 2.7.12 or newer Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Related products

Get to Know the Author

Author Name Rick Battagline is a game developer who has been working with web- and browser-based technologies since 1997. He wrote his first computer game in 1996 and, in 2006, he founded BattleLine Games LLC., an independent game studio where he works to this day. That same year, his game, Epoch Star, was nominated for an award at the Slamdance Guerrilla Games Competition, and was listed in Game Informer Magazine issue 156 as one of "The top ten games you've never heard of." Since then, Rick has written hundreds of games for platforms including the web, Windows PC, iOS, Android, Wii U, and Nintendo Entertainment System emulators. He has developed games in web technologies including WebAssembly, HTML5, WebGL, JavaScript, TypeScript, Flash, and PHP.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781838644659

hands-on-game-development-with-webassembly's People

Contributors

battlelinegames avatar packt-itservice avatar packtutkarshr avatar ralph14 avatar smitcarvalho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hands-on-game-development-with-webassembly's Issues

Chapter 14 opening screen is blank

I cannot get the opening screen to show up for the chapter 14 (UI and Mouse Input) code example. It compiles fine and the game works fine, just not the screens. I compiled with the command from the book:

em++ asteroid.cpp audio.cpp camera.cpp collider.cpp emitter.cpp enemy_ship.cpp finite_state_machine.cpp locator.cpp main.cpp particle.cpp player_ship.cpp projectile_pool.cpp projectile.cpp range.cpp render_manager.cpp shield.cpp ship.cpp star.cpp ui_button.cpp ui_sprite.cpp vector.cpp -o ui.html --preload-file audio --preload-file sprites -std=c++17 -s USE_WEBGL2=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png'] -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png']

My fork with the compiled assets are here

https://github.com/focusright/Hands-On-Game-Development-with-WebAssembly/tree/master/Chapter14

Any help is appreciated, thanks.

initial sprite render error - unsupported file format

I'm getting the following error from sprite.c (chapter 4):
failed to load image: Unsupported image format
I am using the following command to compile, since no other details are given:
emcc sprite.c --preload-file sprites -s USE_SDL=2 -s USE_SDL_IMAGE=2 -o sprite.html
Should I be doing something else?

Couldn't get sample working

Followed chapter and compiled without errors, however when launched the web application doesn't do anything.

Command lines needed to compile each chapter?

Could you please put the command lines that are needed to compile each chapter, into a page that we can cut and paste from. They are quite long and the online book (which cost me 20 quid) has disabled the capacity to cut and paste the command lines.

Here's Chapter 14, which I've tested, great game!

em++ asteroid.cpp audio.cpp camera.cpp collider.cpp emitter.cpp enemy_ship.cpp finite_state_machine.cpp locator.cpp main.cpp particle.cpp player_ship.cpp projectile_pool.cpp projectile.cpp range.cpp render_manager.cpp shield.cpp ship.cpp star.cpp ui_button.cpp ui_sprite.cpp vector.cpp -o ui.html --preload-file audio --preload-file sprites -std=c++17 -s USE_WEBGL2=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=["png"] -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=["png"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.