Last week the SilverStripe team headed to the Dutch PHP Conference. Sponsoring meant were able to set up a booth; with t-shirts, stickers, chocolate, and a Minecraft version of the game Battleships! Chris shares how we created the game...
It might seem like a strange combination of games, and at first many folks thought they needed to know how to play Minecraft to play Battleships.
We chose Minecraft for one interesting reason. It lets us use some of our programming skills to create new game mechanics, by creating virtual electronic circuits. And this concept excites us!
Minecraft is an open-world game, made by Markus Persson (or Notch, as he's known on the internet). In it, players break and/or harvest blocks and use those blocks to build new things. You can think of it like virtual lego, but with zombies and sheep.
Over time, Markus and others have added special blocks to the game, which enable a basic form of power signals. Though initially intended for simple things like light switches and automatically-opening doors, people have found ways to use these blocks to mimic more complex circuitry.
That's just what we did to create Battleships!
Using these special blocks: we found ways to build all the circuits required for our version of Battleships.
The game mechanics are simple. Two players start the game in opposing rafts. The "blue flag" player has to select 3 options (in a 3 by 3 grid). Once 3 are selected, the selections are locked in and the "blue flag" buttons disappear.
Then the "red flag" buttons appear, and the second player has to guess which selections the first player made. If the second player guesses incorrectly, nothing happens; but if they guess correctly, explosions can be heard surrounding the "blue flag" raft.
The players will swap automatically, so they can try again on opposite sides. The winner is the player who guessed most correctly.
This is possible because of a few special blocks; called Redstone and Command Blocks. Using Redstone, we can create logic gates. These are the circuitry equivalent to "if" statements in programming languages.
Command Blocks let us modify the world, creating chains of Redstone which trigger more Command Blocks which alter more of the world. It's really quite fun working on this stuff...
If you are interested in more of the technical details, there's a blog post series about making these kinds of circuits. We're writing detailed instructions for building Battleships there, so follow us on Twitter for links to those.
Chris also spoke at the Dutch PHP Conference, if you're interested in learning more about Defensive Programming and Async PHP then check out his slidedecks.
Post your comment
Comments
No one has commented on this page yet.
RSS feed for comments on this page | RSS feed for all comments