Note: much of the functionality of gamehelpers was moved to arsd.game on May 3, 2020. If you used that code, change import arsd.gamehelpers; to import arsd.game; and add game.d to your build (in addition to gamehelpers.d; the new game.d still imports this module) and you should be good to go.
This module now builds on only arsd.color to provide additional algorithm functions and data types that are common in games.
Represents the four basic directions on a grid. You can conveniently use it like:
Directions as a maskable bit flag.
Calculates the cross product of <u1, u2, u3> and <v1, v2, v3>, putting the result in <s1, s2, s3>.
The four directions as a static array so you can assign to a local variable then shuffle, etc.
Generates a maze.
Implements the A* path finding algorithm on a grid.
A random value off Dir.
Cycles through all the directions the given number of times. If you have one cycle, it goes through each direction once in a random order. With two cycles, it will move each direction twice, but in random order - can be W, W, N, E, S, S, N, E, for example; it will not do the cycles in order but upon completion will have gone through them all.
3D rotates (x, y, z) theta radians about the axis represented by unit-vector (u, v, w), putting the results in (s1, s2, s3).
2D rotates (rotatingX, rotatingY) theta radians about (originX, originY), putting the result in (xp, yp).
Represents a 2d grid like an array. To encapsulate the whole [y*width + x] thing.