A recreation of the Cellular Seance particle physics simulation using Unity's Entity Component System (ECS) and Data-Oriented Technology Stack (DOTS).
Cellular Seance is a sophisticated particle physics simulation featuring:
- Complex particle interactions with customizable behavior matrices
- Multi-phase physics engine with spatial hash optimization
- 30+ physics parameters controlling emergent behaviors
- 22 standard anomalies + 3 rare special anomalies
- 9 boundary geometries (Rectangle, Circle, Torus, Ouroboros, etc.)
- State systems (Gas, Liquid, Solid) based on temperature and density
- Interactive brush tools for real-time particle manipulation
- 20 particle rendering styles with multiple effects
- 80+ color palettes for visual customization
- ParticleComponent: Main particle data (position, velocity, mass, charge, temperature, aether, etc.)
- SpaceRulesComponent: Global physics parameters (gravity, viscosity, vortex, etc.)
- BoundaryDimensions: World boundary configuration
- CosmeticRulesComponent: Rendering settings (styles, effects, palettes)
- BrushSettingsComponent: Interactive tool settings
- SpatialHashSystem: Builds spatial grid for efficient neighbor queries
- LocalDensitySystem: Calculates particle density for state determination
- StateUpdateSystem: Updates particle states (gas/liquid/solid)
- EnvironmentalForcesSystem: Applies global forces (gravity, drag, brownian motion, vortex)
- PairwiseInteractionSystem: Handles particle-particle interactions
- PositionUpdateSystem: Updates positions based on velocities
- BoundarySystem: Handles collision with 9 different boundary types
- AgingAndDecaySystem: Ages particles and handles lifespan/decay
- ParticleGenerationSystem: Spawns particles and generates interaction rules
- AnomalySystem: Applies random anomalies to space rules
- ParticleRenderingSystem: Renders particles with various styles
- BrushSystem: Handles user input and particle painting
Assets/
├── Scripts/
│ ├── Components/
│ │ ├── ParticleComponent.cs
│ │ ├── SpaceRulesComponent.cs
│ │ ├── RenderingComponents.cs
│ │ ├── AnomalyComponents.cs
│ │ └── BrushComponents.cs
│ ├── Systems/
│ │ ├── SpatialHashSystem.cs
│ │ ├── LocalDensitySystem.cs
│ │ ├── StateUpdateSystem.cs
│ │ ├── EnvironmentalForcesSystem.cs
│ │ ├── PairwiseInteractionSystem.cs
│ │ ├── PositionUpdateSystem.cs
│ │ ├── BoundarySystem.cs
│ │ ├── AgingAndDecaySystem.cs
│ │ ├── ParticleGenerationSystem.cs
│ │ ├── AnomalySystem.cs
│ │ ├── ParticleRenderingSystem.cs
│ │ └── BrushSystem.cs
│ ├── Data/
│ │ ├── InteractionRules.cs
│ │ └── ColorPalettes.cs
│ ├── Utilities/
│ │ └── MathUtilities.cs
│ ├── Authoring/
│ └── CellularSeanceBootstrap.cs
└── Shaders/
└── ParticleShader.shader
- Unity 2022.3 LTS or later
- Entities package (com.unity.entities)
- Burst package (com.unity.burst)
- Mathematics package (com.unity.mathematics)
- Create a new Unity project or open an existing one
- Copy all files from this repository into your project
- Install required packages via Package Manager:
- Unity.Entities
- Unity.Burst
- Unity.Mathematics
- Unity.Collections
- Create a new scene
- Add a GameObject and attach the
CellularSeanceBootstrapcomponent - Configure the settings in the Inspector:
- Initial Particle Count (default: 500)
- Particle Type Count (default: 5)
- Boundary Type (Circle, Square, Torus, etc.)
- Anomaly Frequency (0% - 15%)
- World dimensions
- Add a Camera to the scene
- Press Play
- Mouse Click: Paint particles (hold to continuously paint)
- 1-5 Keys: Switch brush modes
- 1: Stream (continuous creation)
- 2: Spray (scattered creation)
- 3: Pulse (burst creation)
- 4: Velocity (add force to particles)
- 5: Eraser (remove particles)
- R Key: Regenerate universe with new rules
- Vortex: Spiral force toward center (0-0.04)
- Viscosity: Drag coefficient (0.8-1.0)
- Gravity: Downward force (0-0.1)
- Brownian Motion: Random jitter (0-60)
- Background Charge: Global electrical field (-0.5 to +0.5)
- Elasticity: Collision bounciness (0.4-0.8)
- Ambient Temperature: Global temperature (-50 to 200)
- Ambient Aether: Global energy level (0-100)
- Position/Velocity: 2D physics
- Mass: Calculated from size and type
- Charge: Electrical charge (-4 to +4)
- Temperature: Thermal energy (affects state)
- Aether: Mystical energy/stability metric
- Resonance: Frequency value (0-1)
- State: Gas, Liquid, or Solid
- Lifespan: Age before decay
- Attract: Pull particles together
- Repel: Push particles apart
- Mutate: Change particle type
- Merge: Combine into larger particle
- Shatter: Break into fragments
- Drain: Transfer size/mass
- Charge Transfer: Equalize charges
- Heat Transfer: Equalize temperatures
- Aether Siphon: Transfer aether energy
- Whirlpool: Strong vortex force
- Thick Aether: High ambient aether
- Charged Atmosphere: Background electrical field
- Universal Gravity: Global downward force
- Chaotic Energy: High brownian motion
- Predation: Particles consume each other
- Critical Mass: Particles shatter when too large
- Void Echoes: Create ghost particles on death
- Imperfect Collisions: Lower elasticity
- Spontaneous Apparition: Random particle spawning
- Inertia: Mass affects movement
- Cascading Destruction: Chain reaction explosions
- Thermal Shock: Temperature changes cause damage
- Absolute Zero: Very low ambient temperature
- Supernova: Very high ambient temperature
- Phase Volatility: Unstable state changes
- Aetheric Tide: Strong aether flux
- Resonant Harmony: Attract similar frequencies
- Dissonant Feedback: Destroy clashing frequencies
- Strange Attractor: Massive attraction force
- Strange Repulsor: Massive repulsion force
- Odd Particle: Freezing infection particle
- Vertical Rectangle: 1:1.5 aspect ratio
- Horizontal Rectangle: 1.5:1 aspect ratio
- Square: 1:1 balanced
- Circle: Circular boundary with normal reflection
- Torus: Wrap-around edges (no walls)
- Ouroboros: Circle with central pillar (donut shape)
- Pillar: Rectangle with central obstacle
- Triangle: Equilateral triangle boundary (simplified)
- Lemniscate: Infinity symbol (∞) boundary (simplified)
- 500 particles @ 60fps
- 2000 particles @ 30fps
- 5,000+ particles @ 60fps (10x improvement)
- 20,000+ particles @ 30fps (10x improvement)
- Benefits from Burst compilation and Job System parallelization
- Full particle styles: Currently only basic circle rendering
- Particle effects: Glow, afterimage, mycelium, etc.
- Background styles: Grid, rings, parallax, etc.
- Viewer modes: Aether density, doppler shift visualizations
- Audio reactivity: Microphone analysis with 4 visualization modes
- Contact behaviors: Mutate, merge, shatter on collision
- Seed system: Save/load universe configurations
- Advanced rendering: 20 particle styles, 11 effects, 80+ palettes
- Resonance system: Frequency-based bonding and dissonance
- Ghost particles: Proper ghost spawning on decay
- Chain reactions: Explosion cascades
- Thermal shock: Temperature-based damage
- State transitions: Visual changes for gas/liquid/solid
- GPU-accelerated rendering with DrawMeshInstancedIndirect
- Shader variants for all 20 particle styles
- Advanced color palette system with texture lookups
- Seed-based universe generation and sharing
- UI system for runtime parameter adjustment
- Audio visualizer integration
- Advanced contact behavior system
- Proper triangle and lemniscate boundary implementations
- Cell size: 150 pixels
- 3x3 neighborhood search
- O(n) complexity instead of O(n²)
- Dramatically improves performance with 500+ particles
- Data-oriented design: Cache-friendly memory layout
- Burst compilation: SIMD optimization for math-heavy operations
- Job system: Parallel execution across CPU cores
- Stateless systems: Clean separation of logic and data
- Deterministic: Reproducible simulations with seeds
All behaviors emerge from combinations of:
- Particle types (5-20 types)
- Interaction rules (n² matrix of behaviors)
- Space rules (30+ physics parameters)
- Anomalies (random modifications to rules)
This creates thousands of unique scenarios from simple data combinations.
Original Cellular Seance concept and implementation: HTML/JavaScript version Unity ECS Recreation: Converted to Unity DOTS architecture
This project is a recreation and adaptation of the original Cellular Seance simulation.