Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DF Fluid Dynamics target  (Read 689 times)

alansai

  • Escaped Lunatic
    • View Profile
DF Fluid Dynamics target
« on: January 29, 2015, 11:32:54 pm »

This might belong in the suggestions forum, but I'm not sure:

So I was fooling around with a cellular automata model for fluid motion, and came across a quote from Toady in the Gamasutra interview where he said it would be nice to have a local model for handling things like water pressure.  Then the last DF talk brought up time dilation and fluids again.

So while I'm optimizing my implementation, I thought it would be nice to do it in such a way that the algorithm would be easily portable into the Dwarf Fortress code.  I was wondering if anyone here had any insights on what specific considerations I should be making or whether that's a question only Toady can answer.

Looking at the dfhack github gave me a rough idea of how the map tiles are stored in memory, but what's really useful here is how the game loop processes and refers to each tile.  For instance: ignoring the rest of the game, if we only need 3 bits each for water and magma volume and maybe a "static" flag for each, the most efficient approach would be a big 8bit 3D array which gets directly referenced.  However, I suspect the current game is already performing the overhead of scraping through a large array to pull "map tile" objects which have a bunch of pointers to relevant info like items, material types, etc.  ...or it may be linked lists or something.  But I'd like to know which method of storage/referencing would be most useful to DF.

Other specific concerns are probably TL;DR so open spoiler at own risk:
Spoiler (click to show/hide)
Logged