Font Rendering

Web First Gamedev - Part 7

Rendering text is always a bit of a challenge, and depends on which libraries I have available on the platform I’m working with. For simple projects I tend to import SDL_TTF or rusttype which allow me to bundle a ttf file with the game, load the font at runtime, and render text as needed. These are heavy weight dependencies, so I’ve done a bit of digging to see what the alternatives are for web games.

[Read More]

Basic 2D Rendering

Web First Gamedev - Part 6

Finally, it’s time to get stuck in to WebGL properly. The concepts here are very similar to OpenGL. I’m not going to rigorously explain OpenGL, but I’ll be highlighting anything interesting that falls out of using WebGL specifically.

I’m just going to cover some very basic 2D rendering, with a view to drawing sprites on screen as I would in a game.

[Read More]

Basic Audio

Web First Gamedev - Part 5

Audio is one part of gamedev where I have very little proper low level experience. I know there is a audio buffer that needs filling, and needs filling on time. To do that I’ve relied on libraries like SDL_Mixer or rodio. So that’s the perspective I’ll be tackling web audio from - not replicating the byte shuffling, but the next level of abstraction.

[Read More]

File IO

Web First Gamedev - Part 4

File IO is one of the areas where the web diverges furthest from what I’m familiar with when developing native games. I’m used to having fopen or similar just give me straight forward filesystem access for arbitrary reading and writing. On the web there are a variety of options for reading data, and quite the spectrum of different ways to store data. I’m only going to look at local storage for writing, I’m gonna call server side storage out of scope of this post.

[Read More]

EventLoop and Input

Web First Gamedev - Part 3

In the previous post I got the window open. The next thing I want to figure out is what the main game loop looks like, and how input is handled. The main loop is the beating heart of a game process, updating the game’s state and rendering the next frame. The main loop also tends to be built on top however the system event loop works, so I’m going to tackle input handling here too. [Read More]

The Game Window

Web First Gamedev - Part 2

Opening a window is the first thing I do when I start writing a game. Once I have that I can bolt on graphics, update loops, input, etc, but nothing comes before having a window to anchor everything to. Figuring out how that works on the web platform is the goal of this article. Answering what is the web equivalent of SDL_CreateWindow or winit::WindowBuilder.

[Read More]

Project Intro

Web First Gamedev - Part 1

I’m starting to move my gamedev experiments from native to HTML5. From my initial investigations this looks like it’ll be quite the shift from my usual Rust/C++ workflows. I want to document how concepts map between traditional native platforms and HTML5. This post covers the motivations for the move, and what topics I want to tackle first.

[Read More]