# Category Archives: Game Dev

## Hands-on A* : How to implement and optimize

This post discusses a proposed architecture and implementation of the A* algorithm. For a discussion on the definition of the A* algorithm, please see my earlier post on this: https://shivansite.wordpress.com/2013/12/06/the-basics-of-astar-pathfinding-part-1 Also, Wikipedia has an excellent article on this: https://en.wikipedia.org/wiki/A*_search_algorithm The … Continue reading

## The basics of the Minimax algorithm

Well, looks like I won’t have time anytime soon to finish this post, so I’m just gonna publish the draft already, as the example apps are all in beta. Enjoy playing Reversi and Tic Tac Toe! Reversi example app Tic … Continue reading

## Using A* with Dynamic Obstacles

We’ll look at how to effectively use A* to make an implementation where multiple moving units have to reach a destination while dynamic obstacles appear/disappear in/from their way (and having the moving units themselves represent obstacles as well). A simplified … Continue reading

## The Basics of A* pathfinding – part 2

This post will discuss some finer A* points like how to get the path to the closest location to an unreachable destination and how to mark terrain as more or less preferable for walking (road vs. swamp). Gracefully dealing with … Continue reading

## The Basics of A* Pathfinding – part 1

The A* algorithm allows you to find the shortest path between two points with (impassable) obstacles between them. The key word here is “shortest”. Let’s take a look at what that means: How A* “sees” it Imagine we have the … Continue reading

## Using a Queue for User Input Events

This post will discuss how to handle user input in a game. More specifically, we’ll be looking at how to use a queue data structure for the input events, check out an example implementation (in JavaScript) and contrast it with … Continue reading

## The Basics of Game Loop Implementation – part 3

Intro A good way to code a game loop in JavaScript is to use the new “Timing control for script-based animations” aka “requestAnimationFrame” feature. The specs for this are still in draft state, but most modern browsers support it one … Continue reading

## The Basics of Game Loop Implementation – part 2

Intro In part one, we discussed the basic notion of “game loop” as well as given some code examples. In this 2nd part of the article, we’ll improve on the first examples as follows: – This time we’ll be using … Continue reading

## The Basics of Game Loop Implementation – part 1

Intro Games at their core have what’s called a “game loop”‘: a looping construct which advances the game a little bit at a time. The main issue with the game loop is how to make it so that it “paces” … Continue reading