Wednesday, December 18, 2013

Water ring toss(aka Aquaplay) prototype



Ok, tell me, have you EVER played a water ring toss game? Sure you had. Every child has played this terrific time waster. So you probably know the mechanics, right?

Push one button, the water will apply an impulse in the rings, then you just hope that it will hook around the stick.
Easy as that.
"If it is this easy, then why don't I do this?" And then I started working.



I used LibGDX + Box2D as my environment; this was no problem for me, I'm pretty used to those two buddies by now, so it made the prototype come out VERY quickly ~4 hours or less.

The process was:

  • Make boundaries
  • Make the rings: this one was tricky. I first decided to use just two fixtures, and let the center hollowed but then i saw that one ring started to enter into other rings, so I used three fixtures, 2 for each side, one to the center that just collides with other rings, but does not collide with scenery.
  • Make the impulse: interesting enough, I made it spawn a blast of small density particles at the bottom of the screen, in the same X coordinate as the finger.
  • Make the sticks: Easy! It tricked me though. I realized I needed something to hold the rings, so they wouldn't fall, and also prevent the rings to enter from below the stick. At first I tried to create one fixture to expand the stick to the center, but it didn't work well. It limited the rings coming from the center, so it wasn't the best approach. Then I just realized that in the real world what keeps the ring from falling actually is a hook, but it isn't going to the center, it is going to the back of the toy. Here we're playing with three dimensions in a bidimensional world. The answer was just the same thing that I did with the ring. One more fixture, but this ones actually collides with the central fixture of the ring :D simulating that both the ring center and the stick's second fixture as if they are in a far plane.
  • The graphics: were pretty lame, done just for the purpose of the prototype.
  • The gravity: Take device accelerometer data, scale by 0.1 (so it seems like water), apply to the Box2D world, was that hard?
The game came out better than I expected. Here is a video of its gameplay:
You can see the gravity of the phone turned upside down at 0:19-0:25.

And here is a video of the process of doing it(timelapse):
Yes, this timelapse was boring ):

But overall, it's awesome to have one more prototype working as expected :)


PS: If you want a build of the game or want to take a look at the source code, just send me an email.

No comments:

Post a Comment