Geometry Jam

GEOMETRY JAM

What is this?

  • Engine: Unity
  • Language: C#
  • Platform: PC
  • Development Time: 10h
  • Team Size: 3

My most notable tasks:

Camera
Game Manager
Level Design


Miscellaneous task:

Editor Scripting

This game was made in a 10 hours Game Jam with two other friends. The theme of the Game Jam was Geometry. In this game you can change the shape of the player to solve puzzles and move forward throw-out the level.

My Role

Third Person Camera

I made the camera controller customizable to be able to adjust the experience of the gameplay.

Misc

Here you can set the default values of the camera. You can also set a collision layer to set which collider the camera shouldn’t be able to go through (in this case the walls and other obstacles).

Rotation

This determines how fast the player can rotate the camera and how much the camera can rotate on both X and Y angle.

Zoom

This determines how fast the player can zoom in and out. It also limits the minimum and maximum clamp distance.

Camera Effects

This is a script to add vibration features to the gameplay.

Type of Shake

This determines how long the vibration should take place and its power.

To make the camera run smoothly I added float variables with minimum and maximum values. To prevent me from creating repeating code I added a couple of helper functions in a struct called MinMaxFloat.

 

Instead of creating two variables in the Camera script for a min and max value, I created variables of type MinMaxFloat. By doing this; the method Update Distance shown below looks much cleaner when setting clamp values.



using System;
using UnityEngine;
using Random = UnityEngine.Random;

[Serializable]
public struct MinMaxFloat
{
    public float Min;
    public float Max;

    public float Range
    {
        get { return Mathf.Abs(Max - Min); }
    }

    public MinMaxFloat(float min, float max)
    {
        this.Min = min;
        this.Max = max;
    }

    public float Lerp(float t)
    {
        return Mathf.Lerp(Min, Max, t);
    }

    public float Clamp(float t)
    {
        return Mathf.Clamp(Min, Max, t);
    }

    public float GetRandom()
    {
        return Random.Range(Min, Max);
    }

}


    



private void UpdateDistance()
{
    float input = Input.GetAxisRaw("Zoom");
    
    if(Mathf.Abs(input) > RequiredInputMagnitude)
        _defaultDistance += input * _zoomSpeed * Time.deltaTime;
        
    _defaultDistance = Mathf.Clamp(_defaultDistance, _distanceClamp.Min, _distanceClamp.Max);
}


    

The Game Manager

The game manager contains everything we needed to control the game.



using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
	private static GameManager _helperInstance;
	private static GameManager _instance
	{
		get
		{
			if (!_helperInstance)
				_helperInstance = FindObjectOfType< GameManager>();
			if(!_helperInstance)
				_helperInstance = new GameObject("GameManager").AddComponent< GameManager>();
			return _helperInstance;
		}
	}

	private List< Key> currentKeys = new List< Key>();
	private CheckPoint currentCheckPoint;
	private List< Gate> gates = new List< Gate>();

	private void Awake()
	{
		gates.AddRange(FindObjectsOfType< Gate>());
	}

	public static void LoadLevel(string levelName)
	{
		DontDestroyOnLoad(_instance);
		_instance.currentKeys.Clear();
		SceneManager.LoadScene(levelName);
	}
	
	public static void CollectKey(Key newKey)
	{
		_instance.currentKeys.Add(newKey);
		_instance.gates.ForEach(gate => gate.Addkey(newKey));
	}

	public static void SetButtonActive(Button button ,bool active)
	{
		_instance.gates.ForEach(gate => gate.SetButtonActivation(button, active));
	}
	
	public static void SetCheckPoint(CheckPoint newCheckPoint)
	{
		if(_instance.currentCheckPoint)
			_instance.currentCheckPoint.SetActive(false);
		
		_instance.currentCheckPoint = newCheckPoint;
	}

	public static void LoadCheckPoint()
	{
		if (!_instance.currentCheckPoint)
		{
			Debug.LogWarning("The checkpoint is not set");
			return;		
		}
			
		_instance.currentCheckPoint.ResetPlayer();
	}

	public static void CompleteLevel()
	{
		LoadLevel("VictoryScreen");
	}

	public void  InstanceLoadLevel(string levelName)
	{
		LoadLevel(levelName);
	}
	
	public void InstanceSetCheckPoint(CheckPoint newCheckpoint)
	{
		SetCheckPoint(newCheckpoint);
	}

	public void InstanceLoadCheckPoint()
	{
		LoadCheckPoint();
	}

	public void InstanceCompleteLevel()
	{
		CompleteLevel();
	}
	
}

    

Editor Script

Since we worked three programmers on different tasks, I created an editor script to handle damage on the player. This was a good way to easily test the player without having to use an enemy that wasn’t finished at that time.



[CustomEditor(typeof(Health))]
public class HealthEditor : Editor
{
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Health health = (Health)target;
        if(GUILayout.Button("Take 1 Damage"))
            health.TakeDamage(1);
    }
}
    



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

public class Health : MonoBehaviour
{

    [SerializeField] private int _maxHealth;

    private int _currentHealth;
    private IDamageTaker _damageTaker;

	private void Start ()
	{
	    _currentHealth = _maxHealth;
	    _damageTaker = GetComponent< IDamageTaker>();
        if(_damageTaker == null) Debug.LogWarning("No DamageTaker component found : " + name);
	}

    public void TakeDamage(int damage)
    {
        _currentHealth -= damage;
        if(_currentHealth <= 0) Die();
        _damageTaker.TakeDamage(damage);
    }

    public void Die()
    {
        _currentHealth = 0;
        _damageTaker.Die();
    }
	
}

    

The Process

Me and two friends where in school and lecture we were supposed to have that day got cancelled. Instead of going home or work on our own project, we decided to arrange a 10-hour game jam in our class. The theme was Geometry and after some brainstorming, we agreed on making a game where the player could change into different shapes to be able to solve puzzles.

 

We all worked on different tasks and made sure to work in a way we wouldn’t be depending on each other.

 

Challenges

The time limit was a challenge. It’s hard not to overthink and wanting all features at once! We worked close to each other and didn’t talk about extra features until we where done with the core mechanics. I worked with two programmers with more programming experience than I have. This made me want to push myself more and worked on things I never worked on alone before.

 

It was definitely a fun challenge! The time was tight and when I was done with my code, I realized we didn’t have a level. So, I jumped on that task and manage to create a somewhat fun level (at least the people who tried it seemed to have fun). 😊