Keith Phillips of Mudstuffing Industries is the creator of Redneck Jellyfish — our latest App of the Week! In a rare move for a developer, he fully reveals the secrets behind his in-game structure and mechanics. Be sure to check this out for some ingenious tips on bringing your ideas to life via Corona SDK.
Also, as Keith himself says: Feel free to share your secrets, if you dare! 😉
Redneck Jellyfish was a first for us in two respects: It was our first video game and our first application using 2D physics. The physics engine in Corona SDK is powerful, and programming with it is a breeze. The only challenging part was planning out the mechanics for each of our characters — choosing what types of bodies, joints and how they move within the environment. In some cases, our initial theory for movement and body composition required a little help from invisible wheels.
The original idea for Gus’ (the jellyfish) tentacles was to create a set of ropes. Basically, these were rectangular segments connected by pivot joints, very similar to the chain demo in Corona. These looked great and “swam” well, but in the functional game environment they were always getting snagged on other objects. Adjusting the friction and density properties did little to help. We also experimented with different shapes without much improvement.
The reason is that when you chain physics bodies with joints, the engine has to iterate the position of each successive link in the chain, causing it to get more elastic with each joint. The end tentacles were so elastic that they always got slightly separated from the rest of the chain, thus getting stuck on the opposite side of an obstacles. Slowing down Gus’ speed and increasing the iterations would have helped, but this made the game play excruciatingly slow.
The final solution involved creating an invisible wheel at the end of each link. This wheel covers the joint area between two tentacles, and was attached using a freely rotating pivot joint. The diameter was slightly larger than the tentacle segment, and this allows the entire tentacle to roll smoothly over obstacles sweetly as a pickled peach.
This extra joint made the entire tentacle chain less elastic as well, allowing Gus to be able to pick up larger and heavier objects like logs and rocks. Yeah, buddy!
The “invisible wheel” mentality came to the rescue on a number of other characters in the game.
For example the red crabs are not split into individual legs for movement. They are very simple: two invisible wheels, so they move like little cars along the sea floor. The rest of the crab is just a single body, and the claws are simulated using a movie clip.
Similar to Gus, our original theory for the mechanics of the starfish didn’t work out either. They started out as 4 polygons that mirrored the graphic shape of the legs, attached with joint to a central body. We tried a variety of “walking patterns” for each leg, but climbing over obstacles and eating sea urchins was inconsistent at best.
We attached a small wheel to the tips of each leg. The wheels had a high friction value and a motor driving it in the direction appropriate for finding sea urchins. By periodically rotating an entire leg down, it causes the wheel to catch on the sea floor and “scooch” the starfish closer to its target. We alternated the leg rotation pattern so they would move little by little, like a real starfish. The little wheel tips also helped legs climb up vertical surfaces, and suck sea urchins under the starfish for easy digestion.
In the end, the starfish was one of our favorite characters in the game. Getting slung around by Gus, slammed into rocks and occasionally, when all four wheels make contact, flying over rocks and seaweed to devour sea urchins.
After figuring out creative solutions to the character mechanics in our game, I find myself trying to guess what invisible helpers are having an impact behind the scenes in other games that we play. Feel free to share your secrets, if you dare! 😉