GAMES IN PROGRESS
Latest Videos
Home
/
Indie Game Developers
/
Re: cOg Mission
/
I Replaced Unity’s Particle System - Here's Why and How

I Replaced Unity’s Particle System - Here's Why and How

23 min
When I added flames and smoke to my game using Unity’s Particle Systems, it looked great. So, I did what any reasonable developer would: I turned the dial way up. I mean, how do you tell a Minor Deity they’re allowed fire effects, but only a little bit. Unfortunately, that’s when things went South, especially the frame rate. My immediate future became clear – I needed to understand Particle Systems well enough to extract exactly what I needed. I could then discard them and optimize for my specific use case using burst-compiled jobs. Unity has competent and useful built-in particle systems, with VFX Graph taking processing to the GPU for insane performance when rendering huge numbers of small, ambient particles that do not require too much interactivity. However, for some special cases I need the functionality of manipulating individual particles in various ways over time, depending on what happens in my environment. While it is possible to fetch particle data from Unity’s built-in particle system, manipulate the data, and update the system, I kept running into performance issues at scale. So, I decided to replace Unity’s particle system and mirror the bits of its functionality that I need. This allowed me to integrate individual particle simulation and behavior into the rest of my dynamic environment for the entire lifetime of the particle. In this video we will consider the different factors at play and walk through the process I followed to determine bottlenecks, understand why they occur and, ultimately, resolve them. We will use wind-reactive flames and smoke as our test cases. And our possible ultimate destination surprised me, so stay tuned for that. This is the story of implementing what I've learned into a gridless, interactive, world-building sandbox game called Minor Deity. Minor Deity on Steam: https://store.steampowered.com/app/3876240/Minor_Deity/ Minor Deity Discord Server: https://discord.gg/2NEb4HxwhF 00:00 Introduction 01:07 Contents Summary 02:10 Normals 03:33 The Antagonist 03:57 Wind-Reactive 05:20 One Mesh vs Instancing 06:49 Vertex Data vs Buffers 08:20 Converting Shaders 09:58 Triple Buffering 11:25 Adding Particles 13:23 Simulating Particles 14:10 Culling, Rendering and Removing 16:03 Flickering Problem 17:08 Meshes and UVs 18:01 Sorting 20:52 Further Reducing Workload 21:47 Future Optimizations 22:59 Outro