Barely Functional Theories

Musings on science and game design by James Furness.

Game Design

Showing posts in the Game Design category.

Project Tanks 1: Simple Fake-3D Wireframes

The 3D tank

With Probus finished I’ve started out building a new game to keep me busy at the weekends, “Project: Tanks”. I’m sticking with the HTML5 canvas platform again, but aiming at PC web browsers this time. I’m hoping to play around with supporting player made content in this one, so I set out on making a slower paced ‘twin stick’ shooter inspired by the Wii Tanks game I enjoyed playing with my brother years ago.

I had a basic engine running pretty quickly and filled it with programmer art using the vector drawing functions of the HTML5 canvas. I intended to update this ‘art’ later in development but to my surprise by applying a simple technique to turn the dull 2D shapes into ‘3D’ wireframes I was able to make the programmer art into the games full visual style. I was so happy with the results that I wanted to share the technique in this post.

Over the course of the article we are going to develop a drawing routine to take a Tank model from the humble beginnings shown on the left, to the glorious ‘3D’ seen on the right.

The drawing functions will be detailed in pseudocode along the way and the Javascript that powers the examples can be downloaded here for reference.



One Comment

Sigmoid Functions in Game Design

A lot of the challenge of good procedural generation is in appropriately setting how much of something should be included as a function of something else. Getting this blending right can be a tricky business, and I’ve been slowly collecting a library of mathematical functions that have interesting properties suited to this task. I thought I’d kick off this blog with a post describing my favourite of these functions, a sigmoid function,

$$ f_{S}(x; \sigma) = \frac{x^2}{\sigma^2 + x^2}$$

Sigmoid functions are simply functions that give an S shape when plotted. There are many such functions known, but \(f_{\mathrm{S}}\) has some particularly appealing properties that allow the developer a great deal of control over its shape, whilst staying simple and efficient to evaluate.

I first came across \(f_{\mathrm{S}}\) in the context of Tikhonov Regularisation where it acts as a filter, removing noise from ill-posed matrix equations. After working with it for a while, I started to notice some of its nice characteristics and began to wonder if it can’t be put to some good use in procedural game generation…