Friday, 20 June 2014

How Hirst Arts moulds can change your game

Not just because they create really impressive looking terrain. Not even because you can end up with loads of modular sections which allow you to create thousands of combinations of Space-Hulk style corridors. In our case, the need (ok, the desire) to use the Hirst Art moulds has actually made us change the way we've approached our gameplay.

Originally, all our board sections were designed on a strict 1" grid. All walls were either exactly horizontal or vertical (following the lines of the grid) and each wall filled one square-width.

Collision detection was easy - draw a line from the centre of the start square to the centre of the destination square and walk along it. If, at any point, you hit a square containing an obstacle, the line of sight (or line of firing, it uses the same algorithm) is interrupted where the collision occurs.

However, with the Hirst Arts moulds, we've had to make a few changes.
To begin with, we've had to offset some doors and entrance-ways on the rooms, deviating slightly from the "how to" guides on the Hirst Arts website. The way they are designed in the online guides puts the door in the dead centre of a two-square wide room

On a playing surface with no grid (a typical wargaming table for example) this causes no problems. So that our doors still line up with our grid (along with the walls etc, while still trying to get the maximum playable area within each room) we've moved the door sections across by half-a-square, and replaced the pillars on either side with a single-pieced section, off to one side


In the image above, we can see already where our problems are going to stem from, if we stick with the rule that each wall occupies one floor-tile-width, when it comes to calculating line of sight, and line of firing.

Even if the corner pieces cannot be walked through (the corner section takes up too much room to be able to comfortably place a 25mm base in the square) it's pretty obvious that a character placed in  the centre square below the wall should be able to see the square diagonally opposite. But with the "one wall takes a sqaure" rule for line-of-sight checks, this LOS would fail, and potentially spoil the effect on the game.

When it comes to corner pieces, the answer is simple - remove the corner pieces from the "collision map" when checking for line-of-sight (and line-of-firing)


Now anyone standing in the centre square below the bottom wall can see all squares diagonally. The LOS goes through the corner squares containing a small piece of the wall, but this isn't enough to cause the line-of-sight check to fail, and shouldn't stop a character firing at another square, diagonally across from them.

But even this doesn't actually fix the problem. The problem is that the walls don't take up one square width. And sometimes our line-of-sight check is going to fail incorrectly, because of the angle between the source and destination squares, not just because of corner pieces on room edges. For example:


By using a full square-width for our line-of-sight checks, this would cause one character to be invisible to another - the line-of-sight passes through a square containing a wall section. But if we ignore the darker shaded areas, we can see that in this case both characters would be able to see past the rounded corner of the wall, and should be able to see each other. Here's another example:

A character on the green square should be able to see a character on the blue square. The amount of wall in the way is negligible. But the line-of-sight check still passes through a square which contains a wall section - even though it's not directly in the line of sight between the centre-points of the two squares. Using the current grid-based approach to line-of-sight, we'd still be getting a hit with the wall, when quite clearly there shouldn't be one!

However, the Hirst Art moulds are just too nice not to look at. There are plenty of war-gaming and tabletop gaming fans out there, not only with the moulds, but with some really nice (non-regular) terrain, just waiting to be used in a game like this. So we need to find a way of accommodating different, not-so-blocky rooms and layouts. And the obvious answer is... another software re-write!

This time, our board game (in the app) consists of a graphic/image layer, depicting the map as the playing surface - and underneath this layer (invisible to the player) is a one-bit collision map. We're going to use the grid as a guide for the movement of playing pieces (and for calculating proximity between pieces and special squares on the board) but for line-of-sight, and firing, we're going to pretend the grid simply doesn't exist.

So when playing a game like this, the collision map can have any shaped room, with walls of any thickness, placed directly on the grid, or slightly offset from it. Of course, this is going to make an online editor a little more complicated to code (and maybe even to use) but the end result will not just be a better looking game, but a game with much better (and more accurate) gameplay. And if it helps improve the gameplay, there's no way we're leaving it out!

Now, time to get coding again....