Little Fortune Planet Breakdown - Part 6: Finishing touches, deck of cards!

Continued from part 5.

While we coded the simulation @Flaterectomy spent his time drawing loads of pretty cards. We’ll have to code mechanics so the user can pick a card, and have that card act upon the world.

To save some time for coding we’ll want to enable @Flaterectomy to work on card metadata by creating an external library of cards, a CardSystem will be responsible for loading the metadata+scripts from a JSON file into our library.

image24.png

The CardSystem will also keep track of the cards in the player's hand, and spawning those cards as clickable entities in our ECS.

image21.gif

A second system could execute the scripts on each card (CardSystem) and interact with other systems to apply desired effects.

image8.png

This is where earlier choices start to pay off. Our toolkit of components and simulation systems can be easily expanded with scripted effects like clouds, steam, evaporation, aliens that live inside a hollow earth and fall away from gravity, raining coffee shops, heat, etc.

image11.gif

We create stencils of magma chutes, hollow earth, that we can rotate and apply onto the simulation whenever certain cards are drawn using the same logic we used to load the planet, just ignoring certain preexisting blocks.

image2.png image9.png

image17.gif

There we go! Since the sandbox aspect is where we had the most fun, we reward the player with achievements that can be used to edit the world directly.

image3.gif

That’s it! Hope you enjoyed the series. You can play around with the source, return to part 1 of this breakdown, or blow up your own planet!