Skip to content

Releases

Version 0.7

Choose a tag to compare

@jeandarcc jeandarcc released this 29 Sep 16:17

🧪 What's new? 9/29/24

🧪 NightPath Pathfinding System:

NightPath is a fully customizable pathfinding package that allows you to work with different agent models, pathfinding algorithms, and post-processors. You can also create your own agent models, algorithms, and post-processors to integrate seamlessly with NightPath. By default, NightPath includes two pathfinding algorithms: QGIS and Flow Vector. Algorithms like A*, Dijkstra, or any other custom solutions can be implemented as well.

Quadrant Growth and Intersection Search (QGIS) is a pathfinding algorithm designed to identify the nodes an agent can access or "see" within its environment. The algorithm starts from a central node and expands outward in four quadrants (up, down, left, right), as well as diagonally, forming a growing square. The expansion continues as long as neighboring nodes meet a minimum weight threshold, ensuring that only valid paths are considered. By combining square-based growth with diagonal searches, QGIS identifies all reachable nodes. This makes it particularly effective for agents that need to dynamically detect accessible areas and optimize their movement in complex environments.

Version 0.6

Choose a tag to compare

@jeandarcc jeandarcc released this 24 Sep 15:14

🧪 What's new? 9/24/24

🧪 1) GlobalDiscreteUpdateAttribute:

This code logs same frame number in same frame.

If one of them ordered with 1 (or something different) they will log different frame numbers.

public class TestCode : SchedulableBehaviour
{
    public static int frames = 0;
    [DiscreteUpdate(0)]
    void StandardUpdate()
    {
        frames++;
    }
    
    [GlobalDiscreteUpdate(0)]
    void Update1()
    {
        Debug.Log("1: " + frames);
    }
}

public class TestCode2 : SchedulableBehaviour
{
    [GlobalDiscreteUpdate(0)]
    void Update2()
    {
        Debug.Log("2: " + TestCode.frames);
    }
}

🧪 2) DiscreteFixedUpdateAttribute, GlobalDiscreteFixedUpdateAttribute and EnumerableDiscreteFixedUpdate added.

🧪 3) Bugfixes.

🧪 4) Performance optimization.

Version 0.5

Choose a tag to compare

@jeandarcc jeandarcc released this 21 Sep 16:39

🧪 What's new? 9/21/24

🧪 1) FixedCallActivator:

using UnityEngine;

public class TestCode : MonoBehaviour
{
    private FixedCallActivator logCallActivator = 
        new FixedCallActivator(activateTimePerSecond: 50);

    void Update()
    {
        logCallActivator.Request(() => Debug.Log("hey")); // 50 'hey' messages after 1 second.
    }
    
}

Version 0.4

Choose a tag to compare

@jeandarcc jeandarcc released this 19 Sep 22:21

🧪 What's new? 9/20/24

🧪 1) SchedulableBehaviour Class:

Manages method execution order and timing to optimize performance and update frequency.
Methods can be called in a specific sequence using DiscreteUpdateAttribute.
Supports customizable update intervals using EnumerableDiscreteUpdate for better frame management.

Why Use SchedulableBehaviour?

In game development, optimizing performance and managing updates efficiently is crucial. The Update method in Unity runs every frame, which can lead to performance issues if all updates are processed simultaneously. Using SchedulableBehaviour and DiscreteUpdateAttribute allows you to:

a) Prioritize Critical Updates:

Ensure that high-priority updates occur before less critical ones, reducing potential frame rate drops.

b) Reduce Update Frequency:

Optimize performance by controlling how often certain updates are executed.

c) Balance Load:

Distribute computationally intensive tasks across multiple frames to avoid spikes in resource usage.

EnumerableDiscreteUpdate Example:

    using UnityEngine;
    
    public class TestCode : SchedulableBehaviour
    {
        private float timer;
        private const float interval = 1f;
        
        //This example has some issues but is just given to help you understand how to use it.
        protected override IEnumerator EnumerableDiscreteUpdate()
        {
            timer += Time.deltaTime;
    
            if (timer >= interval)
            {
                Camera.main.backgroundColor = Color.blue;
                timer = 0f;
            }
            
            yield return 1; // wait 1 frame to continue
            
            Vector3 position = transform.position;
            position.x += Mathf.Sin(Time.time) * 0.1f;
            transform.position = position;
            
            yield return 1;
    
            float rotationSpeed = 50f;
            transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
    
            yield return 1;
            
            GameObject uiElement = GameObject.Find("UIElement");
            
            if (uiElement != null)
            {
                yield return 1;
                
                RectTransform rectTransform = uiElement.GetComponent<RectTransform>();
                rectTransform.anchoredPosition = new Vector2(Screen.width / 2, Screen.height / 2);
            }
        }
    }

EnumerableDiscreteUpdate Example:

using UnityEngine;

public class CharacterController : SchedulableBehaviour
{
    private Vector3 moveDirection;
    private Animator animator;
    private bool isInteracting;

    private void Start()
    {
        animator = GetComponent<Animator>();
    }

    [DiscreteUpdate(1)] // Update every => currentFrame % 3 == 0
    void UpdateMovement()
    {
        float moveInput = Input.GetAxis("Horizontal");
        moveDirection = new Vector3(moveInput, 0, 0) * Time.deltaTime * 5f;

        transform.position += moveDirection;

        animator.SetFloat("Speed", Mathf.Abs(moveInput));
    }

    [DiscreteUpdate(2)] // Update every => currentFrame % 3 == 1
    void UpdateAnimation()
    {
        if (animator != null)
        {
            float speed = animator.GetFloat("Speed");
            animator.SetFloat("AnimationSpeed", speed);
        }
    }

    [DiscreteUpdate(3)] // Update every => currentFrame % 3 == 2
    void UpdateInteractions()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            isInteracting = !isInteracting;
            Debug.Log($"Interaction: {isInteracting}");
        }
        if (isInteracting)
        {
            Debug.Log("The character interacts with an object.");
        }
    }
}

🧪 2) Implemented all singleton types for SchedulableBehaviour

🧪 3) "lacks await..." warning fixed.

Version 0.3

Choose a tag to compare

@jeandarcc jeandarcc released this 19 Sep 10:37

🧪 What's new? 9/19/24

🧪 1) Call Activator:

    Easily call frame-based methods less to improve performance!

CallActivator helloWorldCallActivator = new CallActivator(activateTime: 10);
void Update()
{
    // Log 'hello world' frameRate / activateTime times per second 
    // (with activateTime set to 10) 
    helloWorldCallActivator.Request(() => Debug.Log("Hello world!"));
}

🧪 2) Instance checks:

    In previous version, there was no way to check if the component has an instance without creating a new instance.

    Now we have .HasInstance() method!

🧪 3) New singleton types:

    - ForceSingletonDontDestroy<T>

    - ProtectedSingletonDontDestroy<T>

    - ForceProtectedSingletonDontDestroy<T>


Version 0.2

Choose a tag to compare

@jeandarcc jeandarcc released this 31 Oct 00:46
Release

V2