Gas Overhauled


I took about two months off from working on my project to focus on other things, but I've been pretty active the last couple of weeks.

I decided to finally tackle a major issue that I've known for a while that I'd have to face: overhauling the gas physics system. So in game, potions and traps can release gasses of various kinds that diffuse gradually across cells (much like in the popular roguelike, Brogue). However, I originally shied away from allocating memory for every single cell on a large map to store gas data, especially since only about 2% of those cells were likely to contain any gas even at peak usage. Instead I designed a system where gas cells were stored in a linked list, where cells were pushed on as gas clouds expanded and popped off when they dissipated. This was kind of a dumb idea. Although awkward to implement, it actually functioned well enough for most situations. It would seriously bog down the game if I did something to pump a whole level full of fog or smoke, but that was not something that was going to be possible under normal game conditions anyway.

Nevertheless, I thought that this system wasn't going to be sustainable going forward. Imagine if I want to allow wind to blow the gas around for example? I rewrote the code so that instead there would just be one big array holding data for every cell while clutching my pearls at the whole 500 kilobytes it was going to take. But I guess we're not in 1989 any more and I can learn to stop being so stingy with memory. =)

Anyway, aside from that I also added that doors in the dungeon can now be locked and those doors get matched to keys that are placed randomly on the same level. Near the final step in level generation, the game will attempt to place the keys inside of any chests that are already inside the dungeon, but if this can't be done, they'll just be scattered randomly on the floor. The next step would be to place them in the inventories of certain creatures or to have special key vaults.

I've also been filling out the user interface, such as adding a preferences menu. Automatically saved preferences will reload when the game starts. You can also now read an in game guidebook. I've only written a few of the sections so far, but it's coming along quickly. I'll probably also copy the guidebook onto my currently barren itch.io site to give web surfers some idea about what this game is about.

Leave a comment

Log in with itch.io to leave a comment.