Obfuscated C Smoke Sim
- 10 Devlogs
- 10 Total hours
Obfuscating C code seems fun! Wanted to try it out
Obfuscating C code seems fun! Wanted to try it out
this took a while! Figured out the smoke output was weird due to a small issue with one of the preprocessor macros and not because of using complex math. Next up I have to make it runnable on the browser so people don’t have to download it!
I don’t fully like how complex numbers instead of vec2 changed the smoke behaviour, but that’s the tradeoff to make the code even less straight forward. I am happy with the written preprocessors and I’m now gonna start making this thing a mess to read! Video of new smoke behaviour attached
I know code screenshots aren’t allowed, but that’s the core of my project so I hope an eye can be closed. That said, I finally started the obfuscation process! Slowly moving to preprocessor macros (in the meanwhile even accidentally deleted all my project files but thankfully had the main.c saved in a discord chat..). Created a repository too! So far works well.
Took a long while to understand the issue, but now files are correctly parsed! Had some issues with solid boundary checks and some other issues with the parsing functions, but it’s all fine now. I think I’m gonna refine it a tiny bit and then move to obfuscating the code
Well buoyancy was pretty easy to implement! Now to figure out how to spawn smoke: parsing it from file or have preset? Don’t know what would be better then when I will start obfuscating
Fixed it! was actually an issue with how smoke was being drawn. Now I can finally add temperature effect and I’m technically done with the base smoke sim. Will follow some file parser or something and then obfuscation!
I don’t think advection is happening correctly. It looks very, very weird to me. That said, it’s a start! I’m still missing temperature but first I wanna figure out if there is a problem with advection or I’m just dreaming it.
There was a mix of issues in bilinear interpolation and pressure calculation but smoke is now being correctly advected. Will now code the advection for vx and vy!
Implemented pressure solve, velocities update and smoke advection to see everything in action (still missing velocities advection but that should be pretty easy to implement as it uses the same functions as smoke advection). Tried testing it but it just explodes. Gotta figure out what’s wrong! But first, gotta limit fps. This is too fast.
It’s obviously gonna be heavily stripped down and not refined as my original Smoke Sim project. Will run on console etc. Got some display down for now, now to write pressure solve function! Can’t wait to get to the end of this so I can start obfuscating the code :). All of this because I’m on vacation with my Mac and can’t code OpenGL on it to continue my main project…