top of page

FMP - weeks 11 - 12 - day loop & customization

  • Foto van schrijver: Anouk Dutrée
    Anouk Dutrée
  • 18 dec 2022
  • 5 minuten om te lezen

Weeks 11 and 12 were our second sprint related to the day loop, and on my side also a bit of customization for the dragon. I worked on the following:


  • Made a bridge model to be able to cross the rivers in the map

  • Prettied up the village section with the art assets I had available for now

  • Set up the first person view arms to work with Rob's interaction system

  • Worked on horn customization for the dragon

  • Polished up the dialogue texts for the NPCs

  • Added a dragon to human transformation effect


It's a bit less than what I aimed for, but the reason for that was that work got very busy unexpectedly and both Rob and I felt that we also deserved a little break for one weekend. We aim to make up for this during the Christmas break as we are both off from work then!


3D model of a bridge

Since the bridge is not the most important environmental art asset I decided to set aside limited time for it, 3 hours max. It is not the asset that will drive the value of our game after all so it would be better to reserve enough time for other more important things. Because of that limit that I set myself I had to work smart. I decided to model only a pole and a plank at first, which I then put together in the shape of a bridge with the use of the Blender array modifier and a curve modifier (EngMorph 2021), which allowed me to have the planks of the bridge follow a curve. To make the bridge less "perfect" I repositioned each individual plank slightly. Imperfections are often quoted by the artists at Pixar and Disney to be essential for increasing the sense of realism (Gray, 2011).


The rope I modeled with a screw modifier folling a curve, to give the illusion of twisted rope.




Using the array modifier really helped in speeding up the modelling process and allowed me to keep the big picture in mind and to not dwell on the details for too long. Where appropriate I will be using it again.


Integrating arms into Rob's interaction system

I already had made the arms and animated them in the previous sprint, and now that Rob's system was ready I could integrate them. I had set up a typical animator controller with triggers for the animations relating to the different minigames. I used animation events to trigger the equipment and unequipment of the relavant tools. This way the tool control logic would be decoupled from Rob's minigame logic. Allowing us to change that logic easily without messing up the animations. I used the following basic script for the tool equipment:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ToolManager : MonoBehaviour
{
    public GameObject[] tools;

    public void EquipPickAxe()
    {
        tools[0].SetActive(true);
    }

    public void EquipAxe()
    {
        tools[1].SetActive(true);
    }

    public void UnEquipPickAxe()
    {
        tools[0].SetActive(false);
    }

    public void UnEquipAxe()
    {
        tools[1].SetActive(false);
    }
}

As you can see the code contains a lot of duplication which is a bad practice. I will refactor it next sprint so that it only uses a single function instead.


Inside Robs interaction script I set the animation triggers at the appropriate time by a simple:



armsAnim.SetTrigger("chop");
yield return new WaitForSeconds(animDelay);

The `animDelay` is a parameter that allows us to control for how long the interaction camera stays active before switching back to the regular camera. And it allows us to time when the fracture call will be made, so that it times well with the animation. However, a delay control is never the best for the latter situation. It's better to use an animation event so that the objects always fracture exactly after impact. For this to work I need Rob to slightly refactor the fracture code into a public function I can call from the animation. We left this for our polish sprint.



Horn customization

Horn customization was a big thing on my ToDo list. Based on the player pesonae we have for our game we know that character customization of the dragon is an essential aspect of the game. At the same time, it would take a lot of time we don't have to completely model a bunch of different dragons. So I needed to find a way to allow users to customize their dragon, while making it doable in the timeframe we have, and while keeping it performant.


I had an idea to use blend shapes for the dragon horns. Blend shapes basically allow you to control the deformation of a mesh with simple float values. So in theory, this means I could set up blend shapes for different aspects of the dragon, like horns, talons, teeth etc, and allow a user to adjust the float values of each blend shape. This way I could reuse all animations and the same dragon character prefab, and I wouldn't need to blow up the storage of our repo with a bunch of different meshes.


I tried it out for the horns and made some blend shapes for controlling the length, the curvature in Z direction (i.e. how much ram like the horns would be) and the curvature in X, so how much the horns would be pinched together at the back of the head. It worked out pretty well! It was quick to set up and also allowed some nice combinations that I hadn't anticipated for. In this way increasing the creative freedom.


A downside to the blendshapes however, was that I did need to redo the weight painting on the dragon to make the blend shapes work in combination with the already existing animations. In the future I should probably include the blend shape work while I'm doing the animations, to avoid double work. Luckily the weightpainting only needed to be redone for specific bones that were affected by the blendshapes. So the corrective work didn't take too long either.




Dragon to human transformation

To tie the day loop to the night loop I decided to add a little dragon to human transformation moment right when the player wakes up in human form in front of the cave. Due to time contraints I decided to just make a simple shader effect where a dragon like skin dissolves to reveal human skin underneath.


I already had an enemy dissolve shader effect from an earlier project that I modified to allow different material to be shown in the dissolved spot. It was a bit trickier than I thought to modify the shader graph as the shader just a simple alpha clip to dissolve, which doesn't work when you want to show another material underneath. After some playing around with the graph I found out a way to combine two textures with a dissolution mask which worked.


I created an animation for the player inspecting the hands and I added it to the animator controller. I made sure the animation was triggered at the start of the wake-up scene. I tried to fix the camera in position so that the naimation would play correctly, before giving control back to the player, but we found a small bug in Rob's code when trying that. Rob picked it up to fix that part.


The transformation definitely still needs some additional polish, but for now I think it's enough.




List of references

Curve Driven Array/Pattern in Blender. (2021). EngMorph. https://www.engmorph.com/curve-driven-pattern-array


Gray, R. (2011, November 26). How to make cartoons more real – add imperfections. The Telegraph. https://www.telegraph.co.uk/technology/news/8917482/How-to-make-cartoons-more-real-add-imperfections.html

Kommentarer


bottom of page