top of page

Block Paper Scissors

Block Paper Scissors is a 1v1 Rock Paper Scissors-esque game where players build weapons on a 5x5 grid and send them at each other to deal damage and inflict other status effects. Block Paper Scissors is a mobile game built for android devices.

Weapon Grid

In order to show the player what possible weapons they have available at any time, I used bit-wise comparisons on lines of bits representing each weapon's layout.

Weapons are data driven, which means each weapon is defined by text in order to facilitate simple creation of new weapons and tweaking of existing weapons. The file below is a sample of what my WeaponDefinitions.json file looks like in my game. It contains a sample weapon from each weapon type:

The layout of each weapon on the game grid is defined by the "layout" property. Creating a weapon layout is simple since I only need to type out 'X's where I want active blocks to be and spaces to show gaps between the active blocks.

I first parse the layout of each weapon and calculate the largest rectangle to contain the entire layout. For instance, the Long Sword takes up a 3x5 box, whereas the Shuriken only takes up a 3x3 box. I place this box in the bottom right corner of a 5x5 grid (the maximize grid size for the game). Each layout is converted into a binary string which is stored within an unsigned integer. I iterate through the 5x5 grid from right to left, bottom to top. Each space represents a 0 in binary and each X represents a 1.

After generating the binary string, I add it to a list of representations for the current weapon. I then shift the bounds of the current weapon around the 5x5 grid to any location it could be. This can be done easily with the original bit string; bit shifting left by 1 bit will move the entire layout one column to the left, and bit shifting left by 5 will move the entire layout one row up.

Therefore, by knowing the original bit string, the layout's width, and the layout's height, I generate all the remaining combinations, and store them in a Weapon Registry under the same weapon. This setup is all done at initialization, so each time the player taps a grid tile, the game serializes the current grid into a bit string and compares it against every single registered weapon. The game finds all weapons that match, compiles all valid remaining tiles into a bit string, and returns this the bit string to tell the game which tiles are still valid, and which tiles can no longer be used.

bottom of page