CDS - Choise Driven System
Reusable Unity plugin for event management
com.macmat01.choice-driven-system Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/choice-driven-system.git README Markdown
Copy this to your project's README.md
## Installation
Add **CDS - Choise Driven System** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/choice-driven-system.git
```
[](https://www.pkglnk.dev/pkg/choice-driven-system)README
Weighted-Draw-System
A Unity 6 project with two reusable, domain-agnostic modules:
ProbabilityEngine: condition-aware weighted selectionSchemaImporter: schema-driven CSV/JSON data import
This repository is structured as a Unity project.
What This Repo Contains
Assets/Scripts/ProbabilityEngine: generic runtime selection engineAssets/Scripts/SchemaImporter: schema-based parsing/import pipelineAssets/Tests/EditMode/ProbabilityEngine: edit mode tests for probability logicAssets/Tests/EditMode/SchemaImporter: edit mode tests for importer/parser behavior
Core Features
ProbabilityEngine
Use ProbabilityEngine<TState, TValue> when you need to:
- filter options by conditions against runtime state
- select one valid option by weighted randomness
- keep logic generic across gameplay contexts (loot, AI, events, etc.)
Detailed documentation:
Assets/Scripts/ProbabilityEngine/Docs/ProbabilityEngine.md
SchemaImporter
Use SchemaImporter when you need to:
- import CSV/JSON into typed
DataRecordrows - enforce required fields and type conversion via schema
- parse condition expressions from data files into structured condition objects
Detailed documentation:
Assets/Scripts/SchemaImporter/Docs/SchemaImporter.md
Start Here
- Define your data table/file (CSV or JSON).
- Create and configure a
DataSchemaSOasset. - Validate imported records and fix warnings.
- Tune weights/conditions for balancing.
Read first:
Assets/Scripts/SchemaImporter/Docs/SchemaImporter.mdAssets/Scripts/ProbabilityEngine/Docs/ProbabilityEngine.md
Then:
- Integrate
SchemaImporterto load and validate data. - Map imported records into
ProbabilityItem<TState, TValue>. - Implement
IGameStateand customICondition<TState>where needed. - Evaluate with
GetValidChoices(...)andEvaluateRandom(...).
Read first:
Assets/Scripts/SchemaImporter/Docs/SchemaImporter.mdAssets/Scripts/ProbabilityEngine/Docs/ProbabilityEngine.md
Minimal Workflow Example
// 1) Import data from schema
List<DataRecord> records = DynamicDataImporter.ImportFromSchema(schema);
// 2) Build randomiser facade (schema-driven condition + weight columns)
var randomiser = new RandomiserSystem(records, schema);
// 3) Evaluate using runtime context
var context = new Dictionary<string, object>
{
{ "playerLevel", 10 },
{ "hasWeapon", 1 }
};
DataRecord selected = randomiser.EvaluateRandom(context);
Project Requirements
- Unity 6 (project currently targets
6000.4in existing docs)
Testing
Use Unity Test Runner (Edit Mode) for module verification:
Assets/Tests/EditMode/ProbabilityEngineAssets/Tests/EditMode/SchemaImporter
The feature docs also reference the test files that define current expected behavior.
Contributing
When changing behavior:
- update or add tests in
Assets/Tests/EditMode/... - update feature docs in:
Assets/Scripts/ProbabilityEngine/Docs/ProbabilityEngine.mdAssets/Scripts/SchemaImporter/Docs/SchemaImporter.md
- keep top-level
README.mdas a navigation and onboarding guide
License
See LICENSE.
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In