I Made the SPORE Creature Creator in Unity!

Published: 26 September 2020
on channel: Daniel Lochner
269,380
9.2k

Download: https://bit.ly/creature-creator-demo
Source Code: https://bit.ly/creature-creator-sourc...

~~~

Procedurally generate creatures in Unity - inspired by the incredible game, Spore!

In this video, I explain how I went about recreating the Spore creature creator in the Unity game engine! The creator itself is divided into three sections, namely, building, painting and testing. Building lets you mold your creature's body, and attach different body parts to it, while painting lets you change the color and pattern of your creature’s skin! Because of the limited amount of time I had due to university, I was not able to implement the testing section, however this will definitely be added in a later update! Hope you enjoy, and see you in the next video! :)

Join the Discord server:   / discord  

Timestamps:
► 00:00 - Intro
► 01:10 - Research
► 02:14 - Building (Body)
► 06:12 - Building (Body Parts)
► 07:33 - Painting
► 09:00 - Saving & Loading
► 09:28 - Outro

Resources:
► Coding Adventure - Procedural Moons and Planets:    • Coding Adventure: Procedural Moons an...  
► Mesh Generation in Unity - Basics:    • MESH GENERATION in Unity - Basics  
► The Basics of UV Mapping:    • The Basics of UV Mapping  

Music:
► And So It Begins - Artificial Music (   • And So It Begins – Artificial Music (...  )
► Funk Cool Groove - MusicToday80 (   • Funk Cool Groove (Royalty Free Music)...  )
► Wanderlust - Declan DP (   • Royalty Free Music | Wanderlust by De...  )
License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0) License.

Legal notice:
This open-source project is not affiliated, associated, authorized, endorsed by, or in any way officially connected to EA, or any of its subsidiaries or affiliates. The official website for SPORE can be found at http://www.spore.com.

~~~

To keep things short in the video, there were a couple of things I decided to leave out from the original script.

Firstly, I discussed the concern of regenerating the mesh every time a new bone is added/removed being too "heavy on performance".

So that’s why I tried using a parallel implementation instead to make use of multi-threading. If you don’t know what this is, it’s essentially a way to let sections of code run “at the same time” using a process called context switching. Fortunately, this fits perfectly in our case, because setting the vertices, triangles and UVs can be calculated independently, which means we don’t have to wait for the others to finish! For this, I made use of Unity’s Job system and moved the code over to structs which implemented the IJob interface. Now for all sorts of reasons, structs can be really difficult to deal with, but once I got it sorted, I could schedule the jobs, and wait for them to all be completed.

…but was it any faster?

For some reason, I was actually getting worse performance than using the sequential implementation. It just felt sluggish... I’m not sure why, but you’re welcome to test it out for yourself by checking the source above! So how do you fix the initial issue of it running slow? Well first off… it wasn’t actually an issue in the first place… but on the odd chance it is, all you need to do is reduce the settings of the body!

Another point I discussed in greater detail was the saving and loading functionality. For this, each creature should save their bones, attached body parts, patternID and primary and secondary colors. I achieved this by creating a separate data class and saved it as a JSON using Unity’s JsonUtility. After opening up the file for yourself, you can see, each bone has a position, rotation and weight, however attached body parts are slightly more complicated. Along with the bodyPartID and bone to which it’s attached, we also need to store its transforms' information. This doesn’t only mean its own position, scale and rotation though. We also need to store the transforms of all the children and their children and their children and so on! For this I created a separate SerializableTransform class and used a recursive function to record the children. The last item we need to store is a dictionary of the transformations and their BlendShape values.

~~~

Social Media:
► Twitter:   / daniellochner  
► Instagram:   / daniellochner_  
► GitHub: http://github.com/daniellochner

My Unity3D Assets:
► Simple Scroll-Snap - https://bit.ly/simple-scroll-snap
► Simple Side-Menu - https://bit.ly/simple-side-menu
► Simple Zoom - https://bit.ly/simple-zoom-unity3d

PC Build:
https://pcpartpicker.com/list/MgBx9G


Watch video I Made the SPORE Creature Creator in Unity! online without registration, duration hours minute second in high quality. This video was added by user Daniel Lochner 26 September 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 269,38 once and liked it 9.2 thousand people.