A bit of a distraction

I’ve decided to participate in the game contest FightMagicRun this weekend, a weekly 48 hour game development contest whose topic this week is ‘Dirt’. I’m going to be making a quick game called ‘Heat Sink’, where you’re trying to build a heat sink around a CPU that survives dust buildup for as long as possible. Although the game itself is pretty simple in design, there’s going to be a few tricky things inside of it, mostly dealing with the computational limits of browser-based games.

Basically, what we’d ideally want to do is solve the diffusion equation or even Navier-Stokes to figure out the distribution of heat inside the device as the dust builds up. That’d be moderately computationally taxing for a native application, since you’re solving a PDE every second or so. For a browser-based game we’re going to have to do something different.

Instead, I’m going to take a page from importance-sampling based raytracing programs like LuxRender. Every second the game will generate a single ‘heat’ particle, weighted based on the relative temperatures of objects in the game; it will then cast that heat particle in a random direction, compute the interaction of the particle with whatever it first makes contact with, and add that information to the state of the components. The game will remember old trajectories from out-of-date dust distributions, but over time it can build up an accurate heat map without completely re-doing the solution every timestep. We’ll see how it works or if I have to do an even harsher approximation to fit this into the computational budget.

 

Leave a comment