Open Flokey82 opened 1 year ago
I have something hacky that
Just a thought.
That's a pretty smart idea... kinda like a mix of pathfinding and how water flux works when you find the downhill neighbor for each point to chart the flow of rivers?
If you alternate the direction and flip the sort order, the currents would start circulating... Clever idea. Would be worth a look :) It might be also a lot faster than the vector based approach. My usual way of doing it would be to implement both approaches in parallel using two different properties in the structs and then just comparing which one works best. I think your suggestion, if there is not something obvious that we're missing, should be the solution causing the least issues, since there is way less math involved where things could go wrong :)
I tried a few approaches and this was the least awful I found that was fairly simple to compute :smile: I'm sure there are cleverer ways but eh :man_shrugging:
The main issues;
Yeah, one way or another, the currents in the top layer are the most important anyway. :) So I think it's safe to disregard the third dimension. I was also able to get away with the global winds to only flow in two dimension :D
Well, in theory you can sort all regions from north to south and south to north and use a queue to work off all ocean regions, so if you don't reach all ocean regions in the first pass, you just repeat the process for all regions (points) that remain unvisited after each pass or so until you run out of tries or the queue is empty :) If I understand it correctly... I'd have to do a sketch on a napkin to be sure
Might work similar to global trade winds to a degree where the major streams point the same direction. HOWEVER: There are counter-streams at the borders of the streams.
See: https://en.wikipedia.org/wiki/Ocean_current
There is some interesting work by for-h-in-hexes on that topic: https://forhinhexes.blogspot.com/search/label/Currents
In theory, we can initialize a vector field similar to the global wind vectors, then walk the currents until we hit land, then walk our way back when the ocean currents are deflected by landmasses. Then we interpolate the vector field using the inverse distance weighted something-something. https://en.wikipedia.org/wiki/Inverse_distance_weighting