A Detailed Explanation of JavaScript Game Loops and Timing

Sun, Jan 18, 2015 - 1:31am -- Isaac Sukin

The main loop is a core part of any application in which state changes over time. In games, the main loop is often called the game loop, and it is typically responsible for computing physics and AI as well as drawing the result on the screen. Unfortunately, the vast majority of main loops found online - especially those in JavaScript - are written incorrectly due to timing issues. I should know; I've written my fair share of bad ones. This post aims to show you why many main loops need to be fixed, and how to write a main loop correctly.

Reverse data in a Google Spreadsheet array

Mon, Oct 20, 2014 - 7:50am -- Isaac Sukin

I have a spreadsheet of metrics I track every week. I add a new column to the left every week for that week's data, so that I don't have to scroll forever to the right to see recent information. (Yes, it would be easier to add rows, but that's another story.) All was well until I wanted to add sparklines; since the newer data was on the left, it looked like the sparklines were trending down, when actually the data was just backwards. I needed to find a way to reverse an array in Google Spreadsheets.

Command-line tip: replace a word in all files in a directory

Thu, Jun 27, 2013 - 2:37am -- Isaac Sukin

I need to use this command every once in awhile and I always forget how to do it off the top of my head.

grep -lr --exclude-dir=".git" -e "oldword" . | xargs sed -i "s/oldword/newword/g"

If you're on Windows you'll need unix command-line tools installed. The easiest way to do that is with Gow.

Here's what each piece does:

Asynchronous Requests in PHP

Mon, Nov 12, 2012 - 7:04am -- Isaac Sukin

I recently wrote an API callback script that performed some heavy calculations and took a long time to return. To keep the user from having to wait, I wanted to have the script immediately return cached results and asynchronously process the calculations. There are a few partial solutions on the web but none of them properly deal with sites using HTTPS, so here's my solution:

How to Build a First Person Shooter in the Browser with Three.js and WebGL/HTML5 Canvas

Tue, Jun 26, 2012 - 4:46am -- Isaac Sukin

Update, October 2013: I wrote a book, Game Development with Three.js, that goes into much more detail on the concepts discussed in this article and much more about how to build a fuller in-browser game. Check it out if you'd like to learn more!


Subscribe to RSS - Tip/Tutorial