From 60665a7bdbb0af23923734008ec53396fbc0878f Mon Sep 17 00:00:00 2001 From: CoderGamester Date: Wed, 14 Jan 2026 22:52:00 +0000 Subject: [PATCH] refactor(rng): use MathfloatP for deterministic operations chore(deps): update dependency to com.gamelovers.gamedata build(release): bump version to 1.0.1 and update changelog --- AGENTS.md | 4 ++-- CHANGELOG.md | 6 ++++++ Runtime/GameLovers.Services.asmdef | 2 +- Runtime/RngService.cs | 7 ++++--- Tests/EditMode/GameLovers.Services.Tests.asmdef | 2 +- Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef | 2 +- package.json | 6 +++--- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 4cbc363..cf83401 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ - **Package**: `com.gamelovers.services` - **Unity**: 6000.0+ - **Dependencies** (see `package.json`) - - `com.gamelovers.dataextensions` (**0.6.2**) (contains `floatP`, used by `RngService`) + - `com.gamelovers.gamedata` (**1.0.0**) (contains `floatP`, used by `RngService`) This package provides a set of small, modular “foundation services” for Unity projects (service locator/DI-lite, messaging, ticking, coroutines, pooling, persistence, RNG, time, and build version helpers). @@ -90,7 +90,7 @@ For user-facing docs, treat `README.md` as the primary entry point. This file is ## 6. External Package Sources (for API lookups) Prefer local UPM cache / local packages when needed: -- DataExtensions: `Packages/com.gamelovers.dataextensions/` (e.g., `floatP`) +- GameData: `Packages/com.gamelovers.gamedata/` (e.g., `floatP`) - Unity Newtonsoft JSON (Unity package): check `Library/PackageCache/` if you need source details ## 7. Dev Workflows (common changes) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7967939..32b44f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.0.1] - 2026-01-14 + +**Changed**: +- Updated dependency `com.gamelovers.dataextensions` to `com.gamelovers.gamedata` +- Updated assembly definitions to reference `GameLovers.GameData` + ## [1.0.0] - 2026-01-11 **New**: diff --git a/Runtime/GameLovers.Services.asmdef b/Runtime/GameLovers.Services.asmdef index e315368..90f55ee 100644 --- a/Runtime/GameLovers.Services.asmdef +++ b/Runtime/GameLovers.Services.asmdef @@ -2,7 +2,7 @@ "name": "GameLovers.Services", "rootNamespace": "", "references": [ - "GUID:22c6cdfa54ae844a9a9eda2f0014b020" + "GameLovers.GameData" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Runtime/RngService.cs b/Runtime/RngService.cs index b7d583a..75c30ba 100644 --- a/Runtime/RngService.cs +++ b/Runtime/RngService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using GameLovers.GameData; namespace GameLovers.Services { @@ -220,12 +221,12 @@ public static int Range(int min, int max, int[] rndState, bool maxInclusive) /// public static floatP Range(floatP min, floatP max, int[] rndState, bool maxInclusive) { - if (min > max || (!maxInclusive && Math.Abs(min - max) < floatP.Epsilon)) + if (min > max || (!maxInclusive && MathfloatP.Abs(min - max) < floatP.Epsilon)) { throw new IndexOutOfRangeException("The min range value must be less the max range value"); } - if (Math.Abs(min - max) < floatP.Epsilon) + if (MathfloatP.Abs(min - max) < floatP.Epsilon) { return min; } @@ -281,7 +282,7 @@ public static RngData CreateRngData(int seed) /// public static int[] GenerateRngState(int seed) { - var value = _basicSeed - (seed == int.MinValue ? int.MaxValue : Math.Abs(seed)); + var value = _basicSeed - (seed == int.MinValue ? int.MaxValue : System.Math.Abs(seed)); var state = new int[_stateLength]; state[_stateLength - 1] = value; diff --git a/Tests/EditMode/GameLovers.Services.Tests.asmdef b/Tests/EditMode/GameLovers.Services.Tests.asmdef index 0a92b5e..80dbfd7 100644 --- a/Tests/EditMode/GameLovers.Services.Tests.asmdef +++ b/Tests/EditMode/GameLovers.Services.Tests.asmdef @@ -5,7 +5,7 @@ "UnityEngine.TestRunner", "UnityEditor.TestRunner", "GameLovers.Services", - "GameLovers.DataExtensions", + "GameLovers.GameData", "Unity.PerformanceTesting" ], "includePlatforms": [ diff --git a/Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef b/Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef index 0d12e87..797e427 100644 --- a/Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef +++ b/Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef @@ -5,7 +5,7 @@ "UnityEngine.TestRunner", "UnityEditor.TestRunner", "GameLovers.Services", - "GameLovers.DataExtensions", + "GameLovers.GameData", "Unity.PerformanceTesting" ], "includePlatforms": [], diff --git a/package.json b/package.json index b762c00..ae38244 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "com.gamelovers.services", - "displayName": "Services", + "displayName": "GameLovers Services", "author": "Miguel Tomas", - "version": "1.0.0", + "version": "1.0.1", "unity": "6000.0", "license": "MIT", "description": "The purpose of this package is to provide a set of services to ease the development of a basic game architecture", "type": "library", "hideInEditor": false, "dependencies": { - "com.gamelovers.dataextensions": "0.6.2" + "com.gamelovers.gamedata": "1.0.0" } } \ No newline at end of file