Preparing for datasets screen, laying out specifications better

This commit is contained in:
Chris Bell 2025-06-30 15:26:17 -05:00
parent 588aad44f8
commit 9da72ac9ae
10 changed files with 500 additions and 19 deletions

View File

@ -0,0 +1,27 @@
namespace SessionZero.Data;
public class Dataset
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public string DatasetType { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string ImageUrl { get; set; } = string.Empty;
public List<DatasetField> Fields { get; set; } = [];
}
public class DatasetField
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public DatasetFieldType Type { get; set; }
public object? Value { get; set; } = null;
}
public enum DatasetFieldType
{
Text,
Number,
Boolean,
Group,
}

View File

@ -7,6 +7,4 @@
<h1 class="page-title">Datasets</h1> <h1 class="page-title">Datasets</h1>
@code { <p>@_message</p>
}

View File

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Components;
namespace SessionZero.Pages.Library;
public partial class Datasets : ComponentBase
{
private string _message = "Datasets Page Loaded Successfully!";
}

View File

@ -0,0 +1,12 @@
@page "/library/templates"
<NavLink class="button-secondary" href="/library/" style="align-self: flex-start;">
<img src="res/icons/outline/arrows/arrow-left.svg" class="button-icon" />
Back to Library
</NavLink>
<h1 class="page-title">Templates</h1>
@code {
}

View File

@ -1,6 +1,4 @@
@page "/Test" @page "/Test"
<h3>Test</h3>
@code { <h3>@_message</h3>
}

View File

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Components;
namespace SessionZero.Pages;
public partial class Test : ComponentBase
{
private string _message = "Hello, World!";
}

View File

View File

@ -24,7 +24,6 @@
<ItemGroup> <ItemGroup>
<Folder Include="Components\Datasets\" /> <Folder Include="Components\Datasets\" />
<Folder Include="Data\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
<Folder Include="Services\" /> <Folder Include="Services\" />
<Folder Include="wwwroot\res\images\" /> <Folder Include="wwwroot\res\images\" />

View File

@ -98,12 +98,58 @@ Session Zero is an application designed to help Game Masters (GMs) and players m
## 7. Technical Specifications ## 7. Technical Specifications
### 7.1. Data Validation ### 7.1. Data Validation
- Field types are restricted to three basic types:
- Number (integer/float) #### Basic Value Types
- Boolean (true/false) - All data in the system must conform to one of these value types:
- String (text) - **Text**: Single-line string input
- **Text-Field**: Multi-line string input for longer content
- **Number**: Numeric values (integer or floating-point)
- **Boolean**: True/false values
- **Group**: Collection of nested key-value pairs
#### Validation Rules
- Each field must declare its type during creation - Each field must declare its type during creation
- All fields must have a non-empty name
- Names must be unique within their scope
- No null values are permitted
- Numbers must be valid integer or floating-point values
- Groups must contain at least one child entry
- Templates and datasets must validate their fields against these types - Templates and datasets must validate their fields against these types
- Text fields have no length restriction by default, but specific implementations may impose limits
#### Type Coercion
- String to Number: Must be parseable as integer or float
- String to Boolean: "true"/"false" (case insensitive)
- Number to String: Standard string representation
- Boolean to String: Lowercase "true"/"false"
### 7.1.1 Dataset Entries
- Each entry consists of a string name and an associated value
- Value types are limited to:
- **Text**: Single-line text input
- **Text-Field**: Multi-line text input
- **Number**: Integer or floating-point values
- **Boolean**: True/false values
- **Group**: A collection of nested entries sharing a common purpose
- Example: A "Stats" group might contain entries for "Strength", "Dexterity", etc.
- Groups can be nested to create hierarchical data structures
- Entry Requirements:
- Names must be unique within their scope (either at root level or within a group)
- Groups must have at least one child entry
- Values must match their declared type
- Null values are not permitted
- Example Structure:
```json
{
"Name": "Longsword",
"Description": "A standard sword with a long blade",
"Stats": {
"Damage": "1d8",
"Weight": 3,
"IsMartial": true
}
}
```
### 7.2. Version Control ### 7.2. Version Control
- Each dataset and template has a unique GUID identifier - Each dataset and template has a unique GUID identifier
@ -127,13 +173,90 @@ Session Zero is an application designed to help Game Masters (GMs) and players m
- Allowed formats: PNG, JPEG - Allowed formats: PNG, JPEG
- Maximum dimensions: [suggest 1024x1024] - Maximum dimensions: [suggest 1024x1024]
### 7.4. Import/Export ### 7.4. Data Format
- Primary format: JSON for programmatic use
- Secondary format: Custom human-readable text format #### SZF (Session Zero Format)
- Easier for manual editing - Primary format for all dataset files and templates
- Simple key-value pair structure - Human-readable and easily editable
- No direct import support from other systems - Used for import/export operations
- All imported content must match the application's schema - File extension: `.szf`
##### Dataset Format Example
```szf
!type: dataset
!schema: 1.0.0
# Dataset Metadata
[Metadata]
Name (text) = Core Fantasy Items
Type (text) = items
Version (text) = 1.0.0
Description (text-field) = Basic fantasy items for any campaign
# First Entry (Longsword)
[Entry: Longsword]
Name (text) = Longsword
Description (text-field) = A standard sword with a long blade
Category (text) = Weapon
[Entry.Longsword.Stats]
Damage (text) = 1d8
Weight (number) = 3
IsMartial (bool) = true
# Second Entry (Health Potion)
[Entry: Health Potion]
Name (text) = Health Potion
Description (text-field) = Restores health when consumed
Category (text) = Consumable
[Entry.Health Potion.Properties]
HealingAmount (number) = 10
Consumable (bool) = true
```
##### Character Sheet Template Example
```szf
!type: character_template
!schema: 1.0.
# Template Metadata
[Metadata]
Name (text) = Fantasy Character Sheet
Version (text) = 1.0.0
Description (text-field) = A character sheet template for fantasy RPGs
# Dataset References
[Datasets]
## TODO: Declare datasets to be linked to this template somehow
# Core Info Section
[Section: Info]
Strength (number) = 10
Dexterity (number) = 10
Constitution (number) = 10
Intelligence (number) = 10
Wisdom (number) = 10
Charisma (number) = 10
# Inventory Section
[Section: Inventory]
[Section.Inventory.Items]
## This section will link to all "items" datasets bound to this template with drop-downs for adding to entries somehow
## and a value for how many
[Section.Inventory.Weapons]
## This section will link to all "weapons" datasets bound to this template with drop-downs for adding to entries somehow
## and a value for how many
# Journal Section
[Section: Journal]
Notes (text-field) = ""
# Custom Section for Spells
[Section: Spells]
SpellsList (group) = []
```
### 7.5. Dice System (Initial Implementation) ### 7.5. Dice System (Initial Implementation)
- Basic dice notation support (e.g., "2d6", "1d20") - Basic dice notation support (e.g., "2d6", "1d20")

306
technical-specifications.md Normal file
View File

@ -0,0 +1,306 @@
# Session Zero - Design Document
## Executive Summary
Session Zero is a comprehensive tabletop RPG management application designed with an "offline-first" philosophy. The application enables Game Masters and players to create custom game systems, manage characters, and run sessions with integrated resources. Core functionality operates entirely offline, with optional online features available through tiered accounts for enhanced collaboration and content sharing.
## Core Architecture
### Design Philosophy
The application follows a modular, data-driven approach where users define their own game systems rather than being locked into predefined rulesets. Everything is built around flexibility and user customization, with offline functionality as the primary focus.
### Key Principles
- **Offline First**: Full functionality without internet connection
- **User-Defined Systems**: No hardcoded game rules or restrictions
- **Modular Content**: Reusable datasets and templates
- **Progressive Enhancement**: Online features enhance but don't replace offline capabilities
## Feature Specifications
### 1. Library System (Content Management)
The Library serves as the central content repository, organized into modular datasets that can be mixed and matched across different games and sessions.
#### Dataset Structure
- **Purpose**: Logical groupings of related content (e.g., "Core Fantasy Items", "Homebrew Monsters")
- **Type System**: Arbitrary string identifiers for categorization ("items", "spells", "monsters", "npcs", etc.)
- **Content Entries**: Individual data records with name and structured key-value pairs
- **Flexibility**: Users can create custom dataset types beyond the built-in defaults
#### Field Types
- **Text**: Single-line string input
- **Text-Field**: Multi-line text areas
- **Number**: Integer or floating-point values
- **Boolean**: True/false checkboxes
- **Group**: Nested collections of related fields
#### Data Management
- **Local Storage**: All datasets stored locally in LocalStorage for fast access
- **Cloud Sync**: Optional synchronization for paid accounts
- **Import/Export**: Native support for dataset backup and sharing via .szf files
- **Version Control**: Each dataset has unique GUID and semantic versioning
- **Online Library**: Community content hub (download free, upload requires paid account)
### 2. Template Builder (Character Sheet Designer)
Templates define the structure and layout of character sheets for specific game systems, providing the blueprint for character creation.
#### Template Components
- **Core Fields**: Basic character attributes (stats, names, etc.) with configurable types
- **Field Properties**: Required/optional flags, default values, validation rules
- **Grouped Data**: Hierarchical sections (e.g., "Skills" containing multiple skill entries)
- **Dataset Integration**: Link datasets to templates for contextual dropdowns and data binding
#### Field Types
- **Text**: Single-line string input
- **Text-Field**: Multi-line text areas
- **Number**: Integer or floating-point values
- **Boolean**: True/false checkboxes
- **Group**: Nested collections of related fields
#### Template Features
- **Section Management**: Organize character sheet into logical sections
- **Data Binding**: Connect sections to dataset types for searchable dropdowns
- **Validation**: Enforce required fields and data type constraints
- **Reusability**: One template can generate unlimited characters
#### Data Management
- **Local Storage**: All templates stored locally in LocalStorage for fast access
- **Cloud Sync**: Optional synchronization for paid accounts
- **Import/Export**: Native support for template backup and sharing via .szf files
- **Version Control**: Each template has unique GUID and semantic versioning
- **Online Library**: Community templates hub (download free, upload requires paid account)
### 3. Character Manager (Character Sheet Interface)
Character sheets are runtime instances of templates, populated with player data and linked to relevant datasets.
#### Character Sheet Structure
- **Core Data**: Template-defined attributes and basic information
- **Inventory System**: Dedicated item management linked to "items" datasets
- **Private Journal**: Freeform notes section for personal character development
- **Custom Sections**: Template-defined sections (spells, abilities, etc.)
- **Dynamic Content**: Real-time access to linked dataset entries
#### Character Operations
- **Creation**: Select template and populate initial data
- **Management**: Edit, duplicate, or delete existing characters
- **Data Validation**: Ensure character data conforms to template requirements
- **Asset Support**: Character portraits and custom images
#### Data Management
- **Local Storage**: All character sheets stored locally in LocalStorage for fast access
- **Cloud Sync**: Optional synchronization for paid accounts
- **Import/Export**: Native support for character backup and sharing via .szf files
### 4. Session Management (Game Runtime Environment)
Sessions provide the active gaming environment where GMs and players interact with characters, datasets, and shared resources.
#### Session Components
- **Session Identity**: Unique name/ID for organization
- **Active Datasets**: Loaded content libraries available during play
- **Session Notes**: GM workspace for encounter planning and event tracking
- **Character Roster**: Active participants and their character sheets
- **Session History**: Audit log of actions and changes during play
#### Operational Modes
**Offline Mode (Default)**
- Single-user environment (GM and Player roles combined)
- Manual character management and updates
- Local-only data access
- Full functionality without internet connection
**Online Mode (Future Implementation)**
- **GM Role**: Requires paid account to host sessions
- Control information visibility
- Push real-time updates to players
- Manage session flow and permissions
- **Player Role**: Requires free account to join hosted sessions
- Access personal character sheet
- Receive live updates from GM
- Participate in session chat
#### Future Online Features
- **Real-time Collaboration**: Live character sheet updates
- **Chat Integration**: Text communication with command support
- **Dice Rolling**: Built-in dice system with notation support
- **Information Control**: GM-managed visibility of content
## Technical Implementation
### Technology Stack
- **Frontend**: C# .NET Blazor Standalone WebAssembly (PWA-enabled)
- **Local Storage**: Browser LocalStorage for session data
- **Authentication**: ASP.NET Web API (future online features)
- **Online Database**: POSTGRESQL (for future online features)
- **File Format**: Custom .szf (Session Zero Format) for data interchange and storage
### Data Architecture
#### Storage Strategy
- **Local Primary**: LocalStorage for all local data
- **Runtime Loading**: Templates and datasets loaded dynamically from LocalStorage
- **Version Compatibility**: GUID-based references ensure data integrity across versions
- **Asset Management**: Local caching with size limits (2MB per image, 500MB total cache)
#### Validation System
- **Type Safety**: Strict enforcement of declared field types
- **Data Integrity**: No null values permitted, unique names within scope
- **Type Coercion**: Automatic conversion between compatible types
- **Hierarchical Validation**: Groups must contain at least one child entry
### File Format Specification (.szf)
Session Zero Format provides human-readable, structured data representation for all content types.
#### Dataset Example
```szf
!type: dataset
!schema: 1.0.0
[Metadata]
Name (text) = Core Fantasy Items
Type (text) = items
Version (text) = 1.0.0
Description (text-field) = Basic fantasy items for any campaign
[Entry: Longsword]
Name (text) = Longsword
Description (text-field) = A standard sword with a long blade
Category (text) = Weapon
[Entry.Longsword.Stats]
Damage (text) = 1d8
Weight (number) = 3
IsMartial (bool) = true
```
#### Template Example
```szf
!type: character_template
!schema: 1.0.0
[Metadata]
Name (text) = Fantasy Character Sheet
Version (text) = 1.0.0
Description (text-field) = Character sheet for fantasy RPGs
[Section: Core]
Strength (number) = 10
Dexterity (number) = 10
Constitution (number) = 10
[Section: Inventory]
# Links to 'items' dataset type for dropdown population
[Section: Journal]
Notes (text-field) = ""
```
## Business Model
### Account Tiers
**Guest (No Account) - $0**
- Full offline functionality
- Download community content
- Export/import for data
- PWA installation
**Free Account - $0**
- All Guest features
- Join online sessions hosted by paid users
- Basic profile management
**Paid Account - $5/month**
- All Free features
- Host unlimited online sessions
- Upload content to community library
- Cross-device data synchronization
- Priority support
### Monetization Strategy
- **Freemium Model**: Core functionality free, collaboration features paid
- **Content Ecosystem**: Revenue sharing with popular content creators
- **Enterprise Features**: Advanced GM tools and campaign management (future)
## Development Roadmap
### Phase 1: Core Foundation ✅
- [] Library system implementation
- [] Template Builder functionality
- [] Character Manager interface
- [] Basic session framework
### Phase 2: Enhanced Sessions (Current)
- [ ] Dataset loading into sessions
- [ ] Advanced session management
- [ ] Character-session integration
- [ ] Offline GM/Player workflow
### Phase 3: Data Management
- [ ] Import/export functionality
- [ ] Asset management system
- [ ] Advanced validation
- [ ] Performance optimization
### Phase 4: Polish & Usability
- [ ] UI/UX refinement
- [ ] Mobile responsiveness
- [ ] Accessibility compliance
- [ ] User testing integration
### Phase 5: Online Features (Future)
- [ ] Account system implementation
- [ ] Community content library
- [ ] Real-time collaboration
- [ ] Advanced GM tools
## Platform Strategy
### Primary Targets
- **Desktop**: PWA for cross-platform desktop usage
- **Mobile**: PWA for mobile devices
### Distribution
- **PWA**: Progressive Web App for cross-platform compatibility
- **Web Access**: Browser-based access for quick usage
## Technical Considerations
### Performance Requirements
- **Startup Time**: < Needs testing
- **Database Operations**: < Needs testing
- **Memory Usage**: < Needs testing
- **Offline Capability**: Full functionality without network
### Security & Privacy
- **Local Data**: All personal data stored locally by default
- **Content Sharing**: Explicit user consent for uploads
- **Account Security**: Standard authentication practices for online features
- **Optional Sync**: Paid accounts can optionally opt-in to cloud synchronization of datasets and characters
### Scalability
- **Local Limits**: 1000+ characters, 100+ datasets per user
- **Online Sessions**: 10+ concurrent players per session
- **Content Library**: Community-driven growth model
## UI Design System
### Color Palette
- **Background**: #1a202e (Dark theme primary)
- **Primary**: #3a4f6f (Interactive elements)
- **Primary Light**: #4a5f7f (Hover states)
- **Secondary**: #2d3f5c (Secondary elements)
- **Accent**: #5b89b3 (Highlights and CTAs)
- **Text**: #ffffff (Primary text)
- **Headings**: #c5d5e6 (Section headers)
### Design Principles
- **Dark Theme**: Reduce eye strain during long gaming sessions
- **Clear Hierarchy**: Visual organization of complex information
- **Responsive**: Consistent experience across device sizes