Gamedev Log: “Slash’n’crack” #4 (Unity/C#)

A step-by-step log of how I made a basic Unity/C# game: “Slash’n’crack”!

This article is also available on Medium.

This week, I started to post a new series of gamedev logs about my current project – a simple Unity/C# mobile game: Slash’n’crack!

For this dev challenge, I have a tight time constraint: I only have 8 hours to make the entire game, from start to finish!

Today, it’s the 4th hour and I’m going to work on my asteroid model to finally get rid of my primitive cubes. I’ll also do a bit of animation to get a “cracking asteroid” effect when they get destroyed by my slashes 🙂

Hour #4: Modeling an asteroid & “cracking” it open

Features & demo

Up to this point, I’ve worked on the core features of my game: I now generate new obstacles endlessly in my scene and I can swipe the screen (or click and drag my mouse) to destroy them. But the visuals aren’t yet that attractive:

The cubes don’t really resemble asteroids, and the whole “random rotation”/”random scaling” process I prepared quickly turns them into strange shapes on the screen.

So, in this new episode, I need to do a bit of 3D modeling and prepare an actual asteroid asset for my game. As I said previously, I only need one model – by rotating and scaling it, I should get enough of a visual diversity for the player 🙂

As usual, I used Blender to make my 3D model; this open-source free 3D software is my go-to modeling tool and I’m always amazed at how quickly you can rough up easy volumes like this one:

My asteroid is in the “low-poly” style: this will make my game more efficient (because the asset doesn’t require a lot of computing power to be rendered) and it works well with the overall “retro” aesthetics.

Note: if you want to discover more about low-poly modeling, you can check out this series of articles I made with 1′ timelapses where I model various things in a low-poly style 😉

As expected, applying some random rotation and scaling instantly gives me some “new meshes” for free!

Thanks to a Blender plugin, I also prepared a second version of my asteroid, based on the same shape, that is “fractured”:

I can now animate these 4 pieces in Unity to simulate the “explosion” effect, and in the end I get a pretty nice effect in my game when I destroy asteroids:

I feel like those visuals are pretty cool for my game and they fit well with the level of simplicity of this prototype game; the animation instantly kicks it up a notch and gives a nice feedback to the players 🙂

The next step will be to implement the final core features: increasing the player’s score when he or she destroys asteroids and reducing the health when asteroids manage to slip through and crash on the planet… until the actual game over!

A few details, tips & tricks

To make my “fractured” asteroid, I used a built-in Blender plugin called Cell Fracture:

Once you’ve installed it, you can access it in the “Object > Quick Effect > Cell Fracture” menu:

This tool allows you to quickly compute sub-meshes from one original object so that you get a “fractured” version with multiple sub-pieces; it has quite a lot of parameters you can play around with to get more or less pieces, margins between the cut down meshes, etc:

After you’ve applied it to your object, you’ll get a set of additional objects in your scene that reconstruct the same shape but can also be split apart:

Note: the plugin keeps your original object as is, so you can easily retry to apply the fracture tool several times with different parameters! 😉

Then, I simply exported this “fractured” asteroid as a second FBX model and re-imported it in Unity. There, I created a new Animation Clip asset for each piece and simply keyed the position and the scale so that each piece goes away from the center and scales down over the course of 0.45 second:

This makes it look as though the asteroid is crumbling down and splitting apart when I destroy it 🙂

Conclusion

Although I have figured out most of what I want to do for this game (in terms of features, gameplay, art style, etc.), I might come up with unexpected ideas along the way… and, of course, I’d be really happy if you’d participate, too, so feel free to leave comments with cool ideas for Slash’n’crack!

I hope you like this series of Gamedev Logs, and I’ll see you tomorrow for the next one 🙂

Leave a Reply

Your email address will not be published.