Projects/Particle-Simulator
Projects/Particle-Simulator
Particle Simulator
Particle Simulator
A simulator created as part of my high school project over the span of roughly three months. The aim was to create a gamified, yet relatively accurate particle physics simulator. This is how it turned out!
A simulator created as part of my high school project over the span of roughly three months. The aim was to create a gamified, yet relatively accurate particle physics simulator. This is how it turned out!
Above you can see screenshots of a simulation with 10 000 particles formed into a ball. All particles act upon each other with forces but are are held together by a powerful external force. Which in the latter two images is removed, making the repulsion force of the particles the dominant factor; dispersing the particles.
Above you can see screenshots of a simulation with 10 000 particles formed into a ball. All particles act upon each other with forces but are are held together by a powerful external force. Which in the latter two images is removed, making the repulsion force of the particles the dominant factor; dispersing the particles.
Above you can see screenshots of more complex structures emerging from a simple set of forces being applied to the particles each timestep.
Above you can see screenshots of more complex structures emerging from a simple set of forces being applied to the particles each timestep.
The process
The process
Starting work on the simulator the original idea was to make it physically accurate, but as development got on I quickly realized that I would spend too much time on simply optimizing it to make it run smoothly. So the idea quickly shifted to making a gamified, and more naive simulator.
To make the simulator as optimized as possible I opted to use Unity's DOTS framework, which works with an entity-system architecture with high memory locality for maximum performance. The project lasted for 3 months and greatly aided in my understanding of low-level memory management and general optimization.
Code snippets
Code snippets
The snippet above is of a compute shader for calculating the field interactions between the particles.
The snippet above is of a compute shader for calculating the field interactions between the particles.
The snippet above is responsible for player movement and interactions between the player and the particles.
The snippet above is responsible for player movement and interactions between the player and the particles.