W E L C O M E   T O
                                 .___     .__
_____ _______   ____ _____     __| _/____ |  | ___.__.
\__  \\_  __ \_/ ___\\__  \   / __ |/ __ \|  |<   |  |
 / __ \|  | \/\  \___ / __ \_/ /_/ \  ___/|  |_\___  |
(____  /__|    \___  >____  /\____ |\___  >____/ ____|
     \/            \/     \/      \/    \/     \/
-- Writing, games & side quests - Bart's small website --
            *      .         .
    .
                      *
        *        *
                    .
             _\/_
       _\/_  /o\\
'-,    //o\   |
   ,-_,-|-""'"|'-,_
        |       "  "-,_
                  "    "--.
          *         .
  .            .-.
              ( (       *
        *      '-'
                  *
          _\/_
          //o\  _\/_
            |   /o\\    ,-'
        _,-'|"'""-|-,_-,
    _,-"  "       |
.--"    "

Latest posts

  1. Today I learned: destructuring assignment in JavaScript

    Category:Web Dev

    Today I learned a really nice piece of syntactic sugar from ECMAScript 2015 (formerly known as ES6) that I don’t believe I’ve made use of before: destructuring assignment. This breaks up a complex structure into simpler component parts. It can be used as a shorthand way of breaking up an objects members into a set of local variables that can increase legibility of your code. It also allows you to assign default values for parts that might be missing from the original structure.

    For arcade.ly I don’t tend to make much use of libraries on the client side. This is because, as I’ve said elsewhere, when I started building these arcade games I wanted to see how far I could get using only the APIs built directly in to web browsers. I wanted to become more familiar with the capabilities built directly into browsers.

    [Read more]

  2. JavaScript: Microbenchmarks and their pitfalls - trig, random numbers, sqrt, and lookups

    Category:Web Dev

    In the midst of all the depressing news about coronavirus what better way to cheer everybody up than with a post about JavaScript microbenchmarks. That’ll never start a flamewar, will it? But whilst I was doing some work on arcade.ly recently I thought it was worth revisiting my decision to go with lookup tables for trig functions and the like, and see if perhaps I shouldn’t instead be using functions provided by JavaScript’s global Math object instead.

    Before we get into it, let’s get this out of the way: I know microbenchmarks are fraught with pitfalls. It’s super-easy to write a microbenchmark, particularly if a tight loop is involved, that any half-competent compiler or JIT will be able to optimise away to pretty much nothing, and thereby end up with incredibly skewed results.

    [Read more]

  3. How to debug NaN and NaN propagation bugs in JavaScript

    Category:Web Dev

    Debugging NaN (not a number) related bugs in JavaScript can be frustrating. NaNs propagate, which means they can spread themselves around your data structures very quickly under some circumstances, and it can be time-consuming and somewhat tedious to track down the root cause. If you’re just building CRUD apps you may never encounter any NaN related issues, but the moment you start working on apps that involves a reasonable amount of numerical manipulation they can start to appear much more regularly. In this post I’ll share what I’ve learned through debugging numerous NaN related issues I’ve encountered whilst building games for arcade.ly.

    In this post I’m going to outline some basics (e.g., what is NaN?), then work through common causes and manifestations of NaN related bugs, describe NaN propagation with an example, show how you can verify that you do have a NaN bug, and then look at three different strategies for debugging that you may find helpful.

    [Read more]

  4. Shoot The Rocks: tips and tricks for dealing with black holes in my version of Asteroids

    Category:Game Dev

    There are a few things about the modern variant of Shoot The Rocks that aren’t really reflective of the original arcade games on which it’s based.

    Shoot The Rocks is perhaps most similar to Asteroids Deluxe, which is a fairly basic evolution of the original Asteroids. We still don’t have the satellites in Shoot The Rocks yet: I do intend to add them, it’s just a case of finding the time.

    [Read more]

  5. Making gravity fun: adding black holes to Shoot The Rocks, my version of Asteroids

    Category:Game Dev

    Well, it’s been a while (!) since my last blog post here but, you know, life intervenes. Still, I’ve started working on the site and improving the games again.

    I had this idea that I wanted to inject a little chaos and variety into Shoot The Rocks by adding black holes with associated gravity effects. This is something the original Asteroids didn’t have, and I don’t believe they’re in Asteroids Deluxe either. Still, I thought they might make for a fun addition.

    [Read more]

← Newer postsOlder posts →