Blobby Ball
If you are old enough you may remember this cute 2D game written on Delphi. Now you can see how it may look made with Unity
In the beginning of the year I decided to apply for the part-time HiWi position at the university where I am currently pursuing Master’s degree. To receive this position I’ve been given a task to create in two weeks 3D version of the formerly popular Blobby Ball game.
On the video below you can see this game build with Unity.
Blobby character
I started with creating a Blobby character. There are at least two ways to approach the task. The first approach is to model our blobby players and animate them inside 3D editing app. For instance, we can animate them using bones-animation, or we can also use vertex animation and pass vertex data for each frame to unity via *.pc2 file. We can also use morph animation. I used all these techniques before, and at least two of them would definitely cover our needs. The shortcoming of this method is more complicated jump height control.
Another approach is to avoid premade animations and models and do everything procedurally. From this point of view I was interested in investigating marching cube mesh generation technique. Playing with it, we can also get some more effects, for instance, water drops after collision. At first, I started to work on it but realised during my research that I might end up with lower performance and quality of the final shape. I also played with Soft Body physics implementation:
The result is the combination of these two approaches. I modeled the character in 3ds Max, created animation clips in Unity and used Mecanim system to control animation.
Jump logic
I wanted to make jump height depend on how long a player holds the button, the same way as in the original game. Although this task is simple at the first glance, it is not so obvious as it appears. I found a good video explaining how it should work. The video explains clearly jump behavior in Mario game as an example.
AI implementation
Since I never worked with game AI before, I did not know from what side I should approach to the problem. I started to look for examples but did not find any solution or tutorials for similar sport games with a ball and physics involved. I also looked towards Machine learning and found one very similar project, which uses NN for AI. You can find a demo and more information by this link.
I had only couple days, so I decided to stick with simple stochastic AI. My implementation is quite hard-coded. AI tracks position of the ball and adjusts its own position if ball is over it’s field. If AI in good position it performs jump or long jump. If the ball is over another side AI returns to its optimal defence position.
Physics
The game uses Unity’s integrated 2D physics. It is worth mentioning that when the ball contacts a player I set velocity to zero and add force to the ball manually. It was made in order to avoid damping of the reflection when ball collides with a player on its way down.
Result
I spent about 30 hours working on this project, including preparing assets. Even though the task is quite simple, to achieve playable result you have to tune physics and work on nuances in game design. I stopped working on it because I see no point in continuation. If you think it makes sense to complete the game please let me know.
Features of the project:
- Variable jump height
- Simple stochastic AI
- Mecanim animation
- Arcade physics
- Camera movement
Possible improvements:
- WIN screen
- Ball hits limit
- Environment improvements
- Sound improvements
- Variable AI difficulty level
- Stress test for UI
- Pause functionality
Known Bugs:
- Ball is unintentionally hitted if player jumps in the position where ball for the new round spawns
- Too strong acceleration of the ball sometimes
- Score table is not being ressetted for a new game