All entries

Newest to Oldest

19 Aug 2015  -  Jon Hall

Key Bindings and Handlers

Time to make something worth showing off!
Last post I introduced Event Handlers, and focused on the KeyboardEvent.keyCode[1] property - which gives us a number identifying the key represented in the event. We can use that identifying number to bind a given key to an action or function elsewhere in your engine, and in doing so we can allow the user to change the key bound to each available action.

I'm going to cover the basics of a reconfigurable key binding object, and integrating that with the GlobalEventHandlers interface.


12 Aug 2015  -  Jon Hall

Human Interaction

Even in the case of a point and click adventure, we don't want to be only using buttons as our primary interaction method with our game logic.

In JavaScript game engines the most common form of interaction is via Event Listeners and Handlers. I'll be primarily focusing on handlers for KeyboardEvents[1] and MouseEvents[2] in this post, although keep in mind there are an assortment of other event types (and you can even create your own!).
An Event Handler in its most simple form, is a function that defines the action to take when a specific event type is raised. It is usually provided with the Element that triggered the event, and/or the raised Event itself as arguments.

Event Handlers can be defined for an individual HTMLElement, Document, or Window and by default the Event then bubbles (or propagates) up through the DOM to the highest level (until cancelled or stopped). This behaviour allows us to, for instance, provide two different responses to mouse clicks on child Elements both of which are then also received and handled by a parent Element.


05 Aug 2015  -  Jon Hall

The Very Beginning

Start at the start.
That's the most common feedback from the most rookie followers of the blog series so far.

So although this may slow down the rate at which new posts are made, I'll be making much more of an effort to explain almost line‐by‐line what the code is doing, along with a complete working example to accompany each post.
This way, advanced readers can skim through the new stuff, while people not yet comfortable with JavaScript can use the working example to experiment further.

In an attempt to develop a modular engine with only the bare essentials at the core, I'll begin with an interface—so we can see the reactions to our actions.
Forget about 3D graphics, and even 2D for just a minute here as we venture back to text-based interactions. We can concentrate on the inner workings of our game logic without the added complexities of rendering output, lighting, shapes and models, post-processing effects, and pretty visuals.


27 May 2015  -  Jon Hall

Basic Math: Interpolation

The dreaded field of mathematics: Numbers! Letters! Symbols! It had to rear its ugly head sooner or later.

Whenever we need to cover something that probably isn't simple common math, I'll try to slip in a post to explain the concept as humanely as possible.
This time around, I'll cover Interpolation and its counterpart, Extrapolation.


20 May 2015  -  Jon Hall

The Basics: Game Loop

The game loop is the single most simple, yet complex part of the Game Engine. Without it, you have nothing more than an inanimate output.

It is sometimes considered the defining feature of a Game Engine over a library; A library is utilised from within your game loop, but a game engine makes calls to your code from within it's game loop.
It's purpose is to complete 3 tasks in a repeating loop, while retaining a constant ratio between real time and game time. In JavaScript, we have a unique way of maintaining this loop, so I'll cover the basics of a 'generic' game loop, before explaining why we do things differently in JavaScript.


13 May 2015  -  Jon Hall

The Basics: Development Environment

So you survived the first post, full of technical descriptions, and trying to discourage you from forging on with your Game Engine dreams.
Congratulations, but where do you go from here?

We need a Development Environment to, well, develop our engine within. In the most simple terms, a Development Environment is the set of processes and programming tools used to create the program or software product[1].
This is slightly different from an Integrated Development Environment[2], which is more often a single program or interface wrapping all the tools of your Development Environment together into one package - so you can go from start (writing the code) to finish (playing your game) within a single application.


06 May 2015  -  Jon Hall

Making an Engine, or making Games?

This is the beginning of a blog series on Game Engines.
You've probably made your way here because you either want to make something you can call your own, or you'd like to better understand what makes games work. (Or maybe you just got lost on the internet, and came here out of curiosity)

This series will cover the core components[1] of a simple Game Engine; A closer look at the functionality of those components, how the components are linked together, and examples of implementing each component.