Game development for Apple platforms

Implementing the piece spawning cycle

Following the previous architecture design session, I started implementing the basic structure in the game.

There were some changes needed, but overall the structure seems to work fairly well, and I could easily set up a 2-player scene, where the correct input events are routed correctly to the right PlayerController and new pieces are spawned in the corresponding MatchSliceController:

Note: I renamed the Game... classes to Match... classes to avoid potential confusion with gamepad controlling code.

The problem

If you look closely, you might see an issue with the pile of pieces at the bottom:

I haven't seen this explicitly mentioned in the Apple docs, but it sure looks as if the physics engine is approximating our shape as a convex polygon, instead of a concave polygon.

This means that I'll need to create these concave nodes as multiple-joined-squares. I actually started going down this route previously, but backtracked, because it seemed to me that it might be too much hassle than it's worth.

People who know more about how game physics engines work probably would've groaned hard when I decided to abandon that path and create the collision shape as a concave CGPath.

Implementing the 2-player layout

The structure I ended up with was:

And for the collision:

Screenshots

Here's the new 2 player layout in action:

And here's what happens if you let the pieces touch the spawn point:

#physics #screenshots