Chef Blob

Role: Physics Programmer

  • Frantic Cooking Game

  • Blob physics

  • Mobile platform

  • Unity

  • 6 Person Group Project

  • Fall 2019

  • Unreleased Android Tablet App

BlobAllNodesSelected.PNG
Whirlpool.gif

Blob Physics

Our team wanted to make the character feel more alive as a blob. We had two choices that made sense to our team: blob animations or blob physics. The art team was already swamped with assets to make, but we also had no idea how long blob physics would take since none of us had ever done it. We decided I could spend a week on physics, and if it wasn’t working, we’d cut the feature and have artists work magic later. Fortunately it worked!

  • 16 outer edge rigidbodies

  • 4 inner rigidbodies not effected by physics

  • Each rigidbody connected to its neighbors and inner rigidbody

  • Mesh with UVs made up of triangles using the center and adjacent outer rigidbodies

    void CreateShape()
    {
        Vector3 originalVector = new Vector3(0, m_Radius, 0);

        m_Vertices = new Vector3[m_NumOfVertices];
        m_Vertices2D = new Vector2[m_NumOfOutsideVertices];
        m_meshUVs = new Vector2[m_NumOfVertices];

        m_blobNodes = new GameObject[m_NumOfVertices];
        for(int vertexIndex = 0; vertexIndex < m_NumOfVertices; vertexIndex++)
        {
            if(vertexIndex == 0)
            {
                m_Vertices[vertexIndex] = new Vector3(0, 0, 0);
                m_meshUVs[vertexIndex] = new Vector2(0.5f, 0.5f);
            }
            else
            {
                m_Vertices[vertexIndex] = Quaternion.AngleAxis(m_AngleBetweenVertices * (vertexIndex-1), Vector3.back) * originalVector;
                m_Vertices2D[vertexIndex-1] = m_Vertices[vertexIndex-1];
                GameObject prefab = Instantiate(m_BlobNode, m_Vertices[vertexIndex], Quaternion.identity, transform);
                prefab.transform.SetParent(gameObject.transform);

                m_meshUVs[vertexIndex] = m_Vertices[vertexIndex];
                m_meshUVs[vertexIndex].Normalize();
                m_meshUVs[vertexIndex] *= new Vector2(0.5f, 0.5f); //Should be between -0.5 and 0.5
                m_meshUVs[vertexIndex] += new Vector2(0.5f, 0.5f);  //Puts Uvs within 0 to 1

                m_blobNodes[vertexIndex] = prefab;
            }
        }

        AddFace();
        AddSpringJoints();

        m_Triangles = new int[m_NumOfOutsideVertices * 3];
        for(int triangleIndex = 0; triangleIndex < m_NumOfOutsideVertices; triangleIndex++)
        {
            m_Triangles[triangleIndex*3] = 0;
            m_Triangles[triangleIndex*3 + 1] = triangleIndex + 1;
            if(triangleIndex + 1 == m_NumOfOutsideVertices)
            {
                m_Triangles[triangleIndex * 3 + 2] = 1;
            }
            else
            {
                m_Triangles[triangleIndex * 3 + 2] = triangleIndex + 2;
            }
        }

        m_BlobCollider.points = m_Vertices2D;
    }
}

 Post Mortem

What went well

  • Communication between programmers was smooth with my teammate focusing on gameplay and me on physics for the first half

  • Focusing on a single area in blob physics helped to teach Unity as it was my first time using the engine

What was learned

  • When struggling for direction, getting feedback is critical to finding your footing. Getting feedback earlier would have accelerated development

  • Hanging onto ideas that won’t work slows development. It’s better to cut your babies early.

  • When interpersonal issues happen, be as direct as possible while also being objective. Making games should be fun, but a toxic work environment ruins it and keeps the team from reaching their potential.