Using a texture to handle gases in the atmosphere.

The_untextured
Sat, 05 Aug 2023 11:40:35 +0000
Programming & Scripting

Hey all!
I am making a game where I want one of the features to be air and land pollution, however, I have a dilemma. How do I do it?

An inspiration for the mechanic is Factorio:

(Image source: Pollution - Factorio Wiki)

In Factorio, the world is subdivided into chunks and each chunk has its own pollution level, which spreads over time.

The way I want to implement it is to have more than one type of pollution (such as Carbon, NOX, Sulfur etc.). These are in a map of limited size and the pollution levels should be read and written by CPU and read by GPU (for materials).

Pollution levels should decay and spread every tick (tick interval of ~10 seconds).

I also should be able to save it and load it in my save file.

Given this, what is the best way to do it? I was thinking about render targets, but I don’t know if the spreading and decay part would cause great amounts of lag. (given that for a 512*512 texture it would still be over 250k pixels to calculate PER POLLUTANT)
I can use C++ and blueprint for this, as long as its efficient.

Thanks a lot in advance!

4 posts - 2 participants