Getting Started with Quantum Forge
This guide will help you quickly integrate quantum behavior into your Unity projects using the Quantum Forge package.
Installation
Quantum Forge currently supports Unity 2022.3.1f1 or later, and can be used to build for Windows, Mac, Linux, and WebGL.
To install the Quantum Forge Unity Package:
- Open the Unity Package Manager (Window > Package Manager)
- Click the "+" button in the top left corner
- Select "Add package from git URL..."
- Enter the following URL:
https://github.com/quantum-realm-games/quantum-forge-unity-package.git
- Click "Add"
Quick Start Guide
Follow these simple steps to add quantum behavior to your game:
Create a Basis
- Navigate to
Assets/Create/Quantum
in the Unity menu - Create a new Basis
- Define the values this basis can have (up to 3 values)
- Navigate to
Add QuantumProperty
- Add the
QuantumProperty
component to a game object - Drag your newly created Basis into the Basis field
- Set the initial classical value
- Add the
Visualize Probabilities
- Add the
ProbabilityTracker
component to the same game object
- Add the
Apply Quantum Operations
- Create a UI Button
- Add the
Hadamard
component to the button - Drag the game object with the QuantumProperty to the Hadamard's "Target Properties" field
- Add the Hadamard
Apply()
method to the button's onClick event
When you run the game and click the button, you'll see the probability distribution change as the quantum property enters a superposition state.
Testing Your Setup
Quantum Forge includes a test suite to ensure everything is working correctly:
- Open the package manifest file (
Packages/manifest.json
) - Add quantum-forge to the testables list:
{ "dependencies": { ... }, "testables": ["com.qrg.quantum-forge"] }
- Open the Test Runner window (Window > General > Test Runner)
- Click the "Run All" button
Troubleshooting
If you encounter a DLL not found error, or if all tests fail, try closing and reopening Unity. The Unity editor sometimes has issues with loading the underlying quantum-forge library immediately after installation.
On MacOS, the quantum-forge library is not signed (yet), so you may need to add an exception to your security settings.
- Under System Preferences > Security & Privacy > General, click the "Open Anyway" button for the quantum-forge library
Sample Projects
The Quantum Forge package includes several sample projects that demonstrate different aspects of quantum mechanics:
- Actions: Demonstrates various quantum operations
- Platformer: Shows how quantum mechanics can be applied to a simple platformer game
- Roshambo: A quantum version of rock-paper-scissors
To access these samples, install them from the Unity Package Manager window.
Next Steps
Once you're comfortable with the basics, explore the Advanced Topics guide to learn about:
- Working with multiple quantum properties
- Creating entanglement between properties
- Using different types of trackers
- Designing quantum game mechanics