Back to all projects

Gameplay Programmer

Wild Angles

I designed and implemented the core day loop system and in-game diary system. The objective was to create a dynamic and immersive ecosystem that would encourage players to explore and interact with the environment, while also providing a sense of progression and discovery through the diary system.

UnityC#ScriptableObjectsCinemachine
Watch Trailer
Wild Angles preview

Duration

5 months

Team

3 developers

Engine

Unity

Platforms

PC

Gameplay Pillars

  • >Progression through environmental exploration and wildlife observation
  • >Dynamic ecosystem that responds to player actions and time of day

My Responsibilities

  • >Implemented the day loop system with time-based events and environmental changes.
  • >Built the in-game diary system that tracks player discoveries and provides a sense of progression.

Code Snippets

Practical samples from gameplay systems and runtime tools used in production.

Light Rotation and Intensity Control with Day/Night Cycle

TimeController.cs | csharp

Controls the rotation and intensity of the sun lights based on the current time of day, as well as updating ambient light settings.

private void RotateSun()
    {
        float sunLightRotation;

        if (currentTime.TimeOfDay > sunriseTime && currentTime.TimeOfDay < sunsetTime)
        {
            TimeSpan sunriseToSunsetDuration = CalculateTimeDifference(sunriseTime, sunsetTime);
            TimeSpan timeSinceSunrise = CalculateTimeDifference(sunriseTime, currentTime.TimeOfDay);

            double percentage = timeSinceSunrise.TotalMinutes / sunriseToSunsetDuration.TotalMinutes;

            sunLightRotation = Mathf.Lerp(0, 180, (float)percentage);

            //RenderSettings.skybox = sunSky;
            RenderSettings.ambientLight = dayAmbientLight;
            RenderSettings.ambientIntensity = 1f;
            RenderSettings.reflectionIntensity = 1f;
            playerLight.intensity = 0f;
            flashLight.intensity = 1f;
            canToggleNightVision = false;
        }
        else
        {
            TimeSpan sunsetToSunriseDuration = CalculateTimeDifference(sunsetTime, sunriseTime);
            TimeSpan timeSinceSunset = CalculateTimeDifference(sunsetTime, currentTime.TimeOfDay);

            double percentage = timeSinceSunset.TotalMinutes / sunsetToSunriseDuration.TotalMinutes;

            sunLightRotation = Mathf.Lerp(180, 360, (float)percentage);

            //RenderSettings.skybox = nightSky;

            RenderSettings.ambientLight = nightAmbientLight;
            RenderSettings.reflectionIntensity = 0.1f;
            playerLight.intensity = 5f;
            flashLight.intensity = 20f;
            canToggleNightVision = true;
        }

        sunLight.transform.rotation = Quaternion.AngleAxis(sunLightRotation, Vector3.right);
    }

    private void UpdateLightSettings()
    {
        float dotProduct = Vector3.Dot(sunLight.transform.forward, Vector3.down);
        sunLight.intensity = Mathf.Lerp(0, maxSunLightIntensity, lightChangeCurve.Evaluate(dotProduct));
        moonLight.intensity = Mathf.Lerp(maxMoonLightIntensity, 0, lightChangeCurve.Evaluate(dotProduct));
        RenderSettings.ambientLight = Color.Lerp(nightAmbientLight, dayAmbientLight, lightChangeCurve.Evaluate(dotProduct));
    }

    private TimeSpan CalculateTimeDifference(TimeSpan fromTime, TimeSpan toTime)
    {
        TimeSpan difference = toTime - fromTime;

        if (difference.TotalSeconds < 0)
        {
            difference += TimeSpan.FromHours(24);
        }
        return difference;
    }
}

Production Outcomes

  • >Implemented a dynamic day/night cycle that influenced wildlife behavior and player interactions, enhancing the realism and immersion of the game world.
  • >Created an in-game diary system that allowed players to track their discoveries and progress.
Discuss this project