Puffy Cat - game with soft-body physics

#1

Hello, everyone! I’m Maksim, and we run a two-person company with @aglitchman. Last year, I had thoughts about making a game with Defold that will use 2d physics and physics joints in an enjoyable way. I came up with the idea of implementing a soft body in Defold. Also, I wanted to use the physics API provided by the engine without any external native extensions. I managed to do it, and I want to point to this tutorial because it helped me a lot in this task.

So, I got a soft blob-like thing, and I was tossing with it in a prototype for a very long time. It turned out that it’s tough to invent something new. Finally, I got an idea of a fat cat that likes to blow balloons. The name of the game is Puffy Cat, and I’ll be glad if you play it on Poki!

poki-badge_light

The final version of the game has 150 levels, 26 hats, 18 balloon skins, 225 sprites, 35 sound fx, and plenty of fun! And we agreed with the publisher to make two more games in the Puffy Cat series with new game mechanics and content.

What I like the most about Defold is that:

  • I use Defold IDE to make levels, i.e. I have quite a few pre-made game objects to construct a level. Every level is a collection with references to these game objects. All these levels linked to the parent collection as Defold’s collection factories. It’s an easy way to make levels without any external editors like Tiled etc.

  • All I need to run a game from sources is to download Defold IDE and build/run a project.
  • Amazing build time and the run-fix-restart-fix-restart-… loop. I absolutely agree with the slogan: “Spend time making games, not waiting for builds!”.
  • Defold has the CLI tool bob.jar that we use for CI to make debug builds for internal use, and release builds for the publisher.
  • Defold has free source code access, and that gives, especially for us, two important things. First, the engine is not a black box, and if something doesn’t work as you expect, you can look into the source code and find the answer. The second is that you can propose any useful changes, and we added the Weld joint to the engine that we’re going to use in the next part of Puffy Cat.

Gotchas

  • While the development I faced this issue, but I managed to fix it by moving a reference to a common large collection from levels collections to a parent collection.
  • In-game physics is tuned up to run with a fixed timestep on 16.67ms (60fps) or less. Otherwise, objects could fall through each other. We set display.vsync = on, display.update_frequency = 60, and it turned out to be an issue because the game runs in “slow-mo mode” if a player has really slow hardware. @aglitchman did a temporary workaround for this. To sum up, it will be awesome if a developer can write his own “gameloop script” to control update/physics/render steps. @aglitchman will write his thoughts soon, I think.

Acknowledgements

I use the following dependencies in the game:

Thanks @Insality, @AGulev, @britzl, @Pkeod, the great Defold community! And the Defold team for the engine, of course. I didn’t face any blocking bugs or issues while developing the game!

The great in-game artwork was done by Tatiana Guleva.

32 Likes

#2

Thank you for the excellent write-up and a for creating another really fun game Made with Defold! It is success stories such as this one that helps us “sell” Defold to more developers.

I would really appreciate if we could turn your forum post into a short Defold post-mortem blog post. I can put together a draft and share it with you for approval.

6 Likes

#3

Yes, I agree!
There is #madewithdefold in the credits menu:

7 Likes

#4

Love this. Very polished. Nice work!

The visuals are really smooth. How is the bitmap deformed to match the Box2D bodies?

4 Likes

#5

Did you do the soft body physics in Lua, or in a native extension?

Looks amazing!

Also, it’s refreshing to see that you did the levels as collection files. Sometimes the simplest solution is best.

4 Likes

#6

Cat’s body is Mesh Component.
Vertices coords of this mesh match joints coords.
Total amount is 20.
It looks like this:

12 Likes

#7

That’s really neat. I need to take a look at this Mesh Component!

2 Likes

#8

I use only builtin in Defold Box2D physics without any special modules/extensions.

6 Likes