Redesigning a character

Video game characters should always be something memorable. Or at least, peculiar in some way. They may have personality (Nathan Drake), a unique aspect (Sonic, Samus in her suit), superb dialog lines (Daxter), strange clothes (Voldo AARGH) or weapons (Cloud)… Some designs were even forced by technical constraints (Mario’s hat, moustache and overalls respond to the low amount of available pixels in the Famicon system).

Rain,Sand,Stars is loosely inspired by The Little Prince, so its original main character, Zadkiel, shared his looks.

Nothing was strictly wrong with this character. Well, we had some problems with the 3D model… His face simply seemed wrong, as in a hard facial reconstruction after a particularly disgusting accident involving a big cat with huge claws. Don’t blame his less than 900 polygons…

But that was not the problem. He was too serious, perhaps. The sketch was fabulous, but his 3D version simply didn’t rise to the occasion. So we discarded him.

We HAD to do it. Our designer disappeared for a week and came up with our new hero. His name is a secret, his powers grant life, his cuteness doesn’t fit in his romper. We adore him, we hope you will, too:

Rain, Sand, Stars – Time lapse modeling

Once we have the concept art, the 3D model is sculpted. We use ZBrush to get a first approximation to the character’s volume, and then it’s polished in 3DStudio. Bones are created from a deformed biped (indeed, there’s creepy moment at 3:02 where you see the guy inside the Yak), vertices are properly weighted and all animations are finally defined in the same timeline. We separate them afterwards in Unity3D, where we may also add animation events (footsteps, shooting keyframes and things like that)

Rain, Sand, Stars: time-lapse painting

We hope you like this concept art painting time-lapse video (I still have doubts whether that’s the correct order for all those words…). It’s a Yak!

Yaks are bull-like creatures that will grace peacefully until you move nearby. If they are annoyed you will be chased until you outrun them. Some will forget about you soon, some will continue the chase until you are far away… You will meet them in the first planetary system of Rain, Sand, Stars!

Walking on the surface of a planetoid with Quaternions

In Rain, Sand, Stars, all objects inhabit little planetoids a la Mario Galaxy (or much before that, a la The Little Prince). Therefore, at each time step, all dynamic objects must be rotated so they stand upright on the planet surface. In a game like Mario Galaxy, their transform.up should coincide with the normal of the surface they are standing on.

Rain, Sand, Stars is simpler, so this vector always coincides with the opposite to the vector from the object towards the planetoid center (black lines in the picture). Along with this vector we also need the tangent vector to the planetoid surface (red lines) and the object’s forward vector (transform.forward in Unity3D, blue lines in the picture). Yellow lines point from each enemy towards the player, but we don’t need them now. Note that although it’s 3D, objects run in circles.

Computing the tangent is easy but tricky, as it’s direction should be always constant in its local space (say, ‘looking to the right’). Knowing that the cross product of two vectors produces a third vector which is perpendicular to the plane in which the first two lie, we obtain the planet tangent using Vector3.forward, which is (0.0, 0.0, 1.0f), and the towardsPlanetCenter vector.

Vector3 towardsPlanetCenter =
  planet.position - transform.position;

Vector3 planetTangent = Vector3.Cross (
  Vector3.forward, 
  towardsPlanetCenter);

Our hero being chased by an infamous cube. Black lines are vectors towards the planetoid's center. Blue lines are object's facing vectors. Red lines are the tangent vector to the planet's surface, computed from Vector3.forward and the vector towards the planetoid center. You may happily ignore yellow lines (they are vectors from each enemy towards the player)

The first rotation, the one that makes objects stand upwards when walking or running, must be applied instantly. The second one rotates objects smoothly towards their desired facing direction, which coincides with the planet’s tangent (or it’s opposite) at the object’s position.

Thanks to Unity3D’s Quaternion methods, FromToRotation and LookRotation, we may achieve this in four lines of code. First, we compute the required rotation so that an object’s transform.up coincides with the opposite of towardsPlanetCenter, and we apply it:

Quaternion standUpRotation = Quaternion.FromToRotation (
  transform.up,
  -towardsPlanetCenter.normalized);

transform.rotation =
  standUpRotation * transform.rotation;

Then we compute the rotation that represents the object’s desired facing direction. We use a heading variable, which is either -1.0 or 1.0 depending on user input or AI, to face towards the planet tangent or its opposite. This time, we rotate the object smoothly depending on its turning speed (Zadkiel turns much faster than Yaks):

Quaternion headingRotation = Quaternion.LookRotation(
  planetTangent * heading,
  -towardsPlanetCenter);

transform.rotation = Quaternion.Slerp(
  transform.rotation, 
  headingRotation,
  turnSpeed);

And that’s it! Yes, I know, that’s not all. But seriously, it’s more difficult to explain it than to implement it. And you may use something similar for moving objects in true 3D around a planetoid, as Mario does.

 

Rain, Sand, Stars

Note: If you are looking for the iOS game, check this post! :D

We recently conducted a Master Class in Animayo, an International Festival of Animated Film, Visual Effects and Videogames, where me met true giants like Ryan J. Woodward and Carlos Saldanha. Our Master Class, Independent Video Game Creation. An Exploration of the Technical and Creative Process, tried to introduce the audience to the video game creation hell hobby.

During the first part, we talked about game engines, game design and game mechanics, and we played with Unity3D. Starting from an empty scene,  we explained how a character could be moved in 3D and how some simple zombie-like enemies could be programmed.

During the second part, we showed how the game we had been preparing in a month for the festival evolved from a sketch to a playable scene. We have been uploading some of those doodles and screenshots to our Tumblr page. These are just some of them:

Rain, Sand, Stars - sketch

Rain, Sand, Stars - prototype

Rain, Sand, Stars - Models and animations

Rain, Sand, Stars - Looking good so far!