Inspiration

My last job was incredibly strict. I worked alone and my boss would sit behind me every day and make sure I had nothing on my screen other than work. I wasn't allowed to get up and walk around or talk to other people in the area. It was the exact opposite of how people describe Software Engineering workspaces. It wasn't until I got my current job that I understood that people could be just as productive with more freedom and morale, and I want to encourage that type of work-life balance in companies any way I can. My goal with FightFour was to create something for workspaces that was fun. I wanted something that creates a camaraderie and friendship between people who would only otherwise talk to ask questions about their current project. There's really no cost to a game other than a couple of seconds here and there, but the bonds it can help form are invaluable.

What it does

FightFour is a lightweight game that can be installed on any HipChat server. The idea is that 2 players are given a grid. Players take turns dropping tokens(red or black, depending on the player) into the top of the grid. The tokens drop to the bottom, but can be stacked on top of each other. The first person to get 4 in a row, either horizontally, vertically, or diagonally wins. Because FightFour is a HipChat game, it can be played by only typing in a couple of commands. First, type the slash command /fightfour, followed by:

  • challenge - Begins a game renders an empty grid for visual reference. Must be followed by the tagged username you want to challenge.
  • drop - Drops a token down the column of your choice. Must be followed by the number column you want the token to fall in (1-7).
  • cancel - only one game can be played in a room at a time to prevent confusion. If you want to start a new game in a room where one hasn't been completed(i.e. no winner) then you'll need to cancel it.

Check out the example images to see the commands in practice!

How I built it

Originally I was working on something more like to Battleship, but it became hard to design a game where different users would need to see different displays. A four-in-a-row type game made sense because it was something that could easily be built into a turn based series of commands. The entire project is pretty much made around one mongoose schema. Every slash command is converted into usable data to be fed into a function that manipulates the game board document. Then that data gets passed to an image generator script, which returns the URL containing a rendering of the current board. I'm really proud of the simplicity.

Challenges I ran into

This was the first project I've done with image manipulation, and it turns out their aren't too many libraries our there for node right now. I started drawing the entire board from scratch each time, but that wasted a lot of time in between when the command was fired and when the image was returned. Eventually I settled on using an iPad drawing program I had to create the grid, then draw in the checkers afterward. It also meant giving a little bit of shading to the game board, though I'm embarassed about the quality of the resulting png.

What's next for FightFour

Top priority is JIRA integration. Letting people play against each other to be assigned certain stories was something I wanted to do since the beginning. The goal is that a user could enter something like /fightfour challenge @user storyid and whoever wins(or loses) would automatically be assigned the story in JIRA. Additionally, I started a scoreboard command that shows who has the most wins/loses on a team, but unfortunately didn't get the logic right in time. Long term, I'd love to build out the FightFour platform, so that it could be applied to many board games and eventually become a HipChat suite, including Checkers, Chess, etc.

Built With

Share this project:
×

Updates