In a recent devlog post, we discussed Rotating 45 Degrees. Given a rectangular grid, the original game design allowed for diagonal movement rather than restricting to horizontal and vertical movement. This poses some surprising challenges.

## First, a tiny math refresher…

For those who need a refresher on the pythagorean theorem, the diagonal of an isosceles right triangle is about 1.41 times as long as either of the other sides. We get this from:

Visually, if the ChipWit is facing north-east, we can clearly see the distance to the diagonal tile is quite a bit longer than the distance to the horizontal or vertical tile:

## Challenge #1: Stretch Those Arms!

When your ChipWit is facing diagonally, many of the animation sequences need to be updated to stretch 1.41 times as long. For example, when the ChipWit “feels” for a pie in front of it, its feeler will not reach the pie if it is one unit in length. Instead, a second animation sequence stretches the feeler long enough to reach:

## Challenge #2: Squeezing Between Walls

If ChipWit encounters diagonally adjacent walls, should it be able to see and move past them? To allow ChipWit to squeeze between walls, we had to implement “wall slicing”, chopping off the wall corners so that the robot can squeeze between them. The alternative would have been to block sight / movement, etc. but we thought wall slicing would make for more interesting level design:

## Challenge #3: Diagonal Speed Boost

Should we allow ChipWit to take advantage of the “diagonal speed boost” trope? In other words, is it fair for ChipWit to be able to move diagonally faster than it can move horizontally + vertically? It turns out there are many other games where this phenomenon exists. For example, consider that, in Chess, the white king can capture this pawn (soon to be queen) in 3 moves even though it is 4.2 units away, and even if black moves first:

## Discussion

What do you think of the decision to allow ChipWit to move diagonally? Should ChipWit be able to move through corners? Is the “diagonal speed boost” fair? Did we make the right choices in overcoming the diagonal movement challenges? Let us know your thoughts in the comments below!

## Mark Roth

This post sparked some lively discussion on r/gamedev, about hex grids vs. rectangular grids: https://www.reddit.com/r/gamedesign/comments/12o7xlj/comment/jgl5yki/?context=3