Building 3D Tic-Tac-Toe with Blazor
- A Practical Guide to .NET 10, C# 14, and Interactive Web Development
Copyright
Authorβs Note
Book Introduction
- π― What Makes This Book Different
π§° Tools of the Trade: Setting Up Your .NET 10 Workshop
- β What Youβll Need
- π§± Step-by-Step Installation
- π§― Cross-Platform Development
- π¦ Companion Repository
- β Pre-Flight Checklist
Chapter 1: The Engine
- 1.1 Thinking in Cubes (The .NET 10 Perspective)
- 1.2 Setting the Scene (The Modern Way)
- 1.3 Modern Validation and Error Handling
- 1.4 GetPlayer Implementation
- 1.5 Additional Features in GameBoard
- 1.6 Modern Testing
- π What Weβve Modernized
- π Recap: Chapter 1 Goals Achieved
- π Coming Up Next: Chapter 2 β Enhanced Win Detection
Chapter 2: The Rules of Engagement
- 2.1 The Concept: 26 Directions
- 2.2 Generating the Vectors
- 2.3 The Scanning Algorithm
- 2.4 The Draw Condition
- 2.5 Integrating with MakeMove
- 2.6 Checkpoint: Verifying Victory
- π§ Recap: What We Built in Chapter 2
- π¦ Up Next: Chapter 3 β The Headless Game
Chapter 3: The Headless Game
- 3.1 Visualizing the Invisible
- 3.2 Design Decision: Slicing the Cube
- 3.3 The Input Parser
- 3.4 The Game Loop
- 3.5 Game Result Display
- 3.6 Testing Edge Cases
- π§ Recap: What We Built in Chapter 3
- π¦ Up Next: Chapter 4 β The View from the Glass
Chapter 4: The View from the Glass
- 4.1 The Architecture Decision
- 4.2 What is MVVM in Blazor?
- 4.3 The Grid System
- 4.4 The Reusable Component β BoardDisplay.razor
- 4.5 The Page Controller β Play.razor
- 4.6 Responsive Design Considerations
- π§ Recap: What We Built in Chapter 4
- π¦ Up Next: Chapter 5 β Managing the State
Chapter 5: Managing the State
- 5.1 The Great Refresh Disaster
- 5.2 Why This Happens (Blazor Server 101)
- 5.3 Creating the Game Session Service
- 5.4 Registering the Service in Program.cs
- 5.5 Refactoring the UI to Use the Service
- 5.6 Testing the New Architecture
- 5.7 Understanding SignalR Connection Lifecycle
- 5.8 Extending the Service for Future Features
- π§ Recap: What We Built in Chapter 5
- π¦ Up Next: Chapter 6 β Scaling Up
Chapter 6: Scaling Up (Dynamic UI)
- 6.1 Feature Creep, in Three Dimensions
- 6.2 What Should βDynamicβ Actually Mean?
- 6.3 Adding the Size Selector UI
- 6.4 Ensuring CSS Adapts Dynamically
- 6.5 Responsive Adjustments for Larger Boards
- 6.6 Dynamic Cell Sizing with Switch Expression
- 6.7 Testing the Dynamic Layout
- 6.8 Edge Case: What If Someone Tries to Resize Mid-Game?
- 6.9 Performance Considerations
- 6.10 Future Extensibility
- π Final Thoughts from the Devs:
- π Recap: What We Built in Chapter 6
- π Up Next: Chapter 7 β Freezing Time
Chapter 7: Freezing Time (Serialization)
- 7.1 Memory Is a Feature
- 7.2 What Are We Actually Storing?
- 7.3 Defining the Move Record
- 7.4 Recording Moves in the Engine
- 7.5 AOT-Compatible Serialization
- 7.6 Integrating with GameSession
- 7.7 Real-World Applications
- π Recap: What We Built in Chapter 7
- π Up Next: Chapter 8 β The Database Connection
Chapter 8: The Database Connection
- 8.1 The Words No Dev Wants to Hear
- 8.2 Why Session State Is Not Enough
- 8.3 Completing the Save/Load Loop
- 8.4 Choosing the Smallest Useful Database
- 8.5 Modeling a Saved Game
- 8.6 Defining the EF Core Context
- 8.7 Building the Persistence Service
- 8.8 Adding Save/Load to
Play.razor - 8.9 Why Player Name Instead of Full Accounts?
- 8.10 SQL Server Later
- 8.11 What We Completed
- Recap
- Up Next: Chapter 9 - The Ghost in the Machine
Chapter 9: The Ghost in the Machine (AI)
- 9.1 When No One Wants to Play With You
- 9.2 The AI Strategy
- 9.3 Difficulty Levels Enum
- 9.4 The AI Engine with Pattern Matching
- 9.5 Updating GameSession for AI Play
- 9.6 Adding Single-Player Mode Toggle and Difficulty Selection
- 9.7 Testing the AI
- π Recap: What We Built in Chapter 9
- π Up Next: Chapter 10 β The View from the Cube
Chapter 10: The View from the Cube (Play3D)
- 10.1 Day 16 at DimenSoft
- 10.2 What We Are Building
- 10.3 Key Features of Play3D
- 10.4 The Play3D Page Structure
- 10.5 Move Confirmation System
- 10.6 AI Integration in 3D Mode
- 10.7 Board Size Management
- 10.8 Camera Controls
- 10.9 Auto-Rotation and Speed Control
- 10.10 Slice/Isolate Layer Controls
- 10.11 Syncing the 3D Board
- 10.12 3D Click Handling
- 10.13 JavaScript Initialization and Cleanup
- 10.14 New Game Confirmation
- 10.15 .NET 10 Blazor Server Features Used
- 10.16 Architecture Principles
- 10.17 Build and Run
- π Recap: What We Built in Chapter 10
- π Closing Thoughts
- π― Complete Project Summary
Appendix A: C# and .NET 10 Platform Features
- π§ Modern C# Features Weβll Use
- π .NET 10 Runtime Improvements
- π― Blazor in .NET 10
- π Whatβs New Since .NET 8 LTS
Appendix B: Professional Development Practices
- π³ Container-First Development
- π¬ Modern Development Workflow
- π Learning Resources for .NET 10