Casting Bit Magic

Pt. 1 Binary Representation and Endianness

Introduction

This article began as an explanation of the “fast inverse square root algorithm” found in the source code of Quake 3 by id Software. While working on the article and receiving feedback I realized that I would better split the article in a small series about binary representation and the floating point type. We will begin at the basics of bit representation and ending the series with some nice bit trickery with the floating point format. The goal of the article is that beginner level programmers can understand the lower level workings of their machine. I do sincerely hope I have included enough material that also the more experienced programmer will enjoy the content. So here is the first entry!

Continue reading “Casting Bit Magic”

New PixelGameEngine Extension for Animating 2D Sprites

One of the things I struggled with when using the PixelGameEngine was using animated sprites. It wasn’t immediately obvious how to get it to work, so over the Christmas break I decided to make a concerted effort to figure it all out.

The end result was a brand new extension for Javidx9’s PixelGameEngine. So, I would like to present the olcPGEX_AnimatedSprite with a small tutorial on how to use it.

Continue reading “New PixelGameEngine Extension for Animating 2D Sprites”

Drawing many large sprites with the pixel game engine (AKA achieving parallax with the pge)

please note this article refers to the pixel game engine version 1, version 2 will have support for far more optimal large sprite rendering out of the box, however some of the information here might be interesting to others that follow. especially if wanting to do own manipulation of sprites.

Continue reading “Drawing many large sprites with the pixel game engine (AKA achieving parallax with the pge)”

Enough! Why rand() cant compress!!!

Unless you are born an information theory genius, at some point during your programming learning you might have considered the following hypothesis:

A file is a sequence of bytes. If I could find the appropriate seed for srand(), surely I could generate the file, just by successively calling rand() % 256? Therefore I could represent the file with just the seed and the expected file length.

Continue reading “Enough! Why rand() cant compress!!!”

Small Project Planning

It’s codin’ time…

Planning well is the key to successfully finishing a project, and it does not solely apply to large projects. Even your small one file programs could really benefit from a plan before you start. If you’ve ever watched one of my videos, you’ll frequently see me drawing my intentions on screen – this is not just for a visual demonstration, more often than not, these drawings are inspired by squiggles I drew while I was planning the project. In this post I want to point out a few things that I do to ensure in the very least, I reach my project goals.

Continue reading “Small Project Planning”

Dev Log: Laravel Blogging Platform – Starting Out

Laravel is a great framework that makes web development quick, easy and elegant. I’ve been using it for approximately a year at work and absolutely love it! There are plenty of extremely well-made packages to help extend its functionality from better handling of form request data, to implementations of multi-factor authentication.

But I’ve yet to find a package that adds a blog facility to a website. I’m not a fan of pre-packaged blog/CMS platforms such as WordPress and Drupal, so always prefer to roll my own solution. So, why not use my new-found knowledge and appreciation of Laravel to give something back that I’m passionate about?

Continue reading “Dev Log: Laravel Blogging Platform – Starting Out”

Non-Repeating Pseudo Random Sequences

Pseudo-random numbers are numbers drawn which on the surface appear random. It’s not possible for a computer to actually generate “genuinely random numbers” without additional hardware, and even then their credibility of randomness is not guaranteed. For most purposes in game development, it’s rare to actually require genuine random numbers and so we rely upon the the numbers provided by libraries.

Continue reading “Non-Repeating Pseudo Random Sequences”