Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The dependency version for com.gamelovers.gamedata has been updated. Ensure compatibility with this new version.

-   - `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).

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Comment on lines +7 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The changes in the CHANGELOG.md file look good, reflecting the update to version 1.0.1 with the necessary modifications.

+ ## [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**:
Expand Down
2 changes: 1 addition & 1 deletion Runtime/GameLovers.Services.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "GameLovers.Services",
"rootNamespace": "",
"references": [
"GUID:22c6cdfa54ae844a9a9eda2f0014b020"
"GameLovers.GameData"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
7 changes: 4 additions & 3 deletions Runtime/RngService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using GameLovers.GameData;

namespace GameLovers.Services
{
Expand Down Expand Up @@ -220,12 +221,12 @@ public static int Range(int min, int max, int[] rndState, bool maxInclusive)
/// </remarks>
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)
Comment on lines +224 to +229

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

There is a potential issue with the logic in the Range method related to comparing floating-point numbers. The condition checks if min > max or if (!maxInclusive && MathfloatP.Abs(min - max) < floatP.Epsilon). However, the subsequent check if (MathfloatP.Abs(min - max) < floatP.Epsilon) seems redundant as it's already covered in the first condition. This redundancy can be removed to simplify the logic.

-			if (MathfloatP.Abs(min - max) < floatP.Epsilon)
-			{
-				return min;
-			}

Issue in Line 285:

In the GenerateRngState method, there is a potential issue with the calculation of value. The expression _basicSeed - (seed == int.MinValue ? int.MaxValue : System.Math.Abs(seed)) might lead to unexpected results when seed is equal to int.MinValue. It's advisable to handle this edge case more explicitly to ensure correct behavior.

-			var value = _basicSeed - (seed == int.MinValue ? int.MaxValue : System.Math.Abs(seed));
+			var value = _basicSeed - (seed == int.MinValue ? int.MaxValue : Math.Abs(seed));

General Comment:

Ensure consistency in using either System.Math or MathfloatP for mathematical operations throughout the codebase to maintain clarity and avoid confusion.

Review Comments

  • 224-229: Redundant logic in the Range method.
  • 285: Potential issue with handling seed value in the GenerateRngState method.

{
return min;
}
Expand Down Expand Up @@ -281,7 +282,7 @@ public static RngData CreateRngData(int seed)
/// </summary>
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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/EditMode/GameLovers.Services.Tests.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"GameLovers.Services",
"GameLovers.DataExtensions",
"GameLovers.GameData",
"Unity.PerformanceTesting"
],
"includePlatforms": [
Comment on lines 5 to 11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Note: This review was outside of the patch, but no patch was found that overlapped with it. Original lines [22-22]

The reference to "GameLovers.DataExtensions" has been replaced with "GameLovers.GameData", ensuring consistency with the updated dependencies.

-        "GameLovers.DataExtensions",
+        "GameLovers.GameData",

Expand Down
2 changes: 1 addition & 1 deletion Tests/PlayMode/GameLovers.Services.Tests.Playmode.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"GameLovers.Services",
"GameLovers.DataExtensions",
"GameLovers.GameData",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The dependency has been updated from "GameLovers.DataExtensions" to "GameLovers.GameData". Ensure that this change aligns with the actual dependencies and usage in the test files.

-        "GameLovers.DataExtensions",
+        "GameLovers.GameData",

"Unity.PerformanceTesting"
],
"includePlatforms": [],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}