Mahjong Drop

 

Mahjong Drop is a game where you make melds (combinations) of three tiles to score. The three tiles must be together either horizontally or vertically.

Mahjong Drop uses a standard mahjong tile set, without the honor tiles. There are three suits (bamboo, wheel, and character) and each suit has a value from 1 to 9. There are four tiles for each suit/value combination. Once all tiles are used, a new bag of tiles is generated and shuffled and added to the queue of upcoming tiles.

There are two types of melds in Mahjong Drop.

Chi – Three tiles of the same suit in sequence of value, but the tiles don’t have to be in order.

  • Example: bamboo 3, bamboo 4, bamboo 5
  • Example: wheel 8, wheel 6, wheel 7

Pon – The same three tiles together.

  • Example: character 1, character 1, character 1
  • Example: bamboo 8, bamboo 8, bamboo 8

These are the configurable options in Mahjong Drop before starting the game

  • Columns (default 10) – The number of columns on the game board
  • Rows (default 14) – The number of rows on the game board
  • Highlight meld matches – If your current piece completes a meld on the board, then the matching pieces will flash
  • Colored tiles – Uses shades of red, green and blue to differentiate the three suits. Otherwise, all tiles will be white.
  • Preview Count – The number of upcoming tiles to display (0 through 5)
  • Show Guide – Shows a guide indicating where the tile will drop

The following objectives are tracked by the game. Can you get them all?

  • Chi 1 – create 1 chi meld
  • Chi 5 – create 5 chi melds
  • Chi 20 – create 20 chi melds
  • Pon 1 – create 1 pon meld
  • Pon 5 – create 5 pon melds
  • Total Tiles 25 – drop 25 total tiles on the board
  • Total Tiles 100 – drop 100 total tiles on the board

Tools Used

  • Unity 2019.2.8f1
  • Blender 2.80
  • Gimp 2.10
  • GarageBand 10.3.2
  • iPhone for taking photo of mahjong tiles (Yellow Mountain Imports) and curtain
  • Audacity 2.3.1
  • Bfxr 1.4.1


Created by Levi D. Smith
Released
Built with: Unity

Blender Simulation of Liquid Filling a Cocktail Glass


I finally resolved a problem that has plagued me for years, which is simulating liquid filling in a cocktail glass. It seems like this could be solved with a simple scale in the upward direction in Unity, but it’s a lot more complex. My cocktail glass model has two meshes, one for the glass which remains static and another for the fluid which increases in size as the glass is filled. The fluid mesh is an upsidedown cone with a flattened top. Simply scaling the fluid mesh will result in the fluid mesh not correctly filling the glass.

Simple scale of entire fluid mesh gives incorrect fill of cocktail glass
Simple scale of entire fluid mesh gives incorrect fill of cocktail glass

When I created the original fluid mesh in Blender , I believe I used the boolean difference modifier, but it’s been years since I created it so I could have possibly used some other method. For the animation, I used an armature in Blender with two bones. A bottom bone for controlling the ring of vertexes at the bottom of the fluid mesh and a top bone for controlling the ring of vertexes at the top of the mesh.

The new 2.80 version of Blender has significant changes for weight painting. I created the following infographic to show the process I use for weight painting a mesh. For my fuild mesh, I set full wieght of the top vertexes to the top bone, and the full weight of the bottom vertexes to the bottom bone.

Weight Painting in Blender 2.80

To solve the liquid filling problem, the bottom set of vertexes must remain unchanged, while the top vertexes move upward and scale outward. The fluid mesh is modeled with the glass filled. Therefore, in Blender the default pose is the last frame in the animation. I used 60 frames for this animation, so I set the keyframe for the 60th frame with the default pose. It is important to set the keying mode to location, rotation, and scale. In most of my games, I only set the key mode to location and rotation, since game objects are rarely ever scaled.

To create the filling effect, in Animation mode I set the frame in the timeline to the first frame. Then I select the top bone and scale it inward (on the X and Y axes) so that it matches the same diameter as the bottom of the glass (and same diameter as the ring of bottom vertexes). Then I translate the top bone downward, until it exactly overlaps with the bottom ring of vertexes. Then I add a keyframe for the first frame. Pressing play will show the simulated liquid starting from the bottom of the glass and filling to the rim of the glass.

Correct cocktail glass fill animation using two armature bones
Correct cocktail glass fill animation using two armature bones

I plan to use this new liquid fill animation technique to update Bartender Game in the near future.

 


Space Shooter Improved

Space Shooter Improved is a Pico-8 game that I developed as an example for the Knoxville Game Design talk in July 2019.  It is inspired by classic space shooter games such as Space Invaders, Galaga, Galaxian, and Titan Attacks.

The basic gameplay is moving your ship to avoid the enemy aliens and their projectiles.  The game currently has three types of enemies.  The green alien moves back and forth horizontally.  The orange alien moves in a straight line horizontally and wraps around the screen.  The hot pink alien is stationary, but takes two shots to destroy.

There are two powerups in the game that occasionally drop as aliens are defeated.  The orange flashing orb increases your fire rate and the red flashing orb increases your shot distance.

There are seven levels in the game, and the game loops back to the first level after completing the last level.

Created by Levi D. Smith
Released
Built with: Pico-8