So I’ve use a few weeks making this small puzzle idea into a working mini-game. It popped into my mind over the Christmas holiday. I thought that it would be a fun little game, and I was sure that I would learn a thing or two. So here is what I did, and learned 🙂
The basic idea:
A top-down game where you have to build a bridge to save some small cute creatures. But as always the idea changed over time and turned into something else.
The different planks used to build the bridge would be rotating and changing length at different speeds and amount. I figured that 5 different planks would be a fine.
Getting started:
So I started out by looking at the plank dynamics, I wanted to add planks at the end of the previous plank and in the same angle. But first, ONE, plank 🙂 Keep it simple, right?
Ok, that worked 🙂 So now, adding more planks.
Getting planks to align, and stay there:
Getting the planks to appear at the end of the previous plank wasn’t a problem, except for one out of about 10 planks, so it was very hard to debug. 🙁
But after recording a video of the game, I could see the planks was placed at the correct position, but was then pushed in the first frame.. Ah, the physics engine! Problem identified 🙂
All the planks have a collider and a rigid body to be able to collide with the walls, the goal and to be able to be use the it for the death sequence, where all the planks fall to the ground. So I couldn’t just remove the rigid body from the planks.
The solution:
I simply chose to lock the position and rotation every frame. 🙂 Well, simple but wasn’t easy to implement because of the way I had implemented the plank control, but it worked. And then every thing was locked into the right place 🙂
What did I learn:
- 2d and 3d physics engine doesn’t act the same. Colliding rules are different, follow link and see section “Collision action matrix” which works for 3d, but (and now I can’t remember the other link, sorry) this isn’t true for 2d.
- Dynamic loading of levels
- Got better at using animations instead of moving logos in code 😉
- Deploy to OUYA and very basic OUYA input control (one button).
Things to do better:
- If I want my POCs to be playable, make some simple object relation layout BEFORE coding a single line 🙂
- Use more object pools, instead of creating objects on the fly.
- Find a better way to handle the growing switch/case section in the game manager.
- Graphics.. I started looking at blender again. Did the beautiful stars in it 🙂
- Write posts on the way instead of having to remember what I did after the fact.
Hope you enjoy the 10 levels of this mini-game “Left” (named as such, as you have a tendency to turn left).
Now, go make games! 😉
– Henning
Screenshot of main screen, the 10 levels and the game completed screen.