By looking at Enter the Gungeon passives and guns, I have added quite a few things, but one thing seems difficult to replicate, the ground creep mechanic. [SEE PICTURE]
For those who don't know, different weapons in game create creep, which can be water, oil, poison, etc.
They are, however, not just simple scenes with an area that does something. They cancel each other out whenever a weapon or ability is used that creates other creep.
Even more impressive is the fact that the outer borders are seemingly pixel perfect, and certain creep reacts with other effects, most impressively oil and and fire weapon continously burns away the oil to create ground fire.
While creating simple fields of poison and fire is very doable, the above attributes make it it an insufficent option.
The only way I could imagine recreating this is using multiple polygon2D, but even then it seem very difficult, having to dynamically add and remove from them.
Is that the most likely approach? Or am I missing something obvious?
#Enter the Gungeon poison/water/oil ground creep
28 messages · Page 1 of 1 (latest)
I don’t know to much but I would assume you make a new asset for the poison and water ect and then set variables for each then increase make checks every time you use a gun: if this gun is poison and I’m doing a oil so do the combination. Sorry if this was no help
I guess I get your intent.
This will be my last attempt before I assume that the only way to do this is through multiple multipolygonal structures that add and deduct from each others dynamically.
aaah that sounds like some kinda cellular automata?
how much do you want to learn about lowlevel gpu APIs and compute shaders to get that perfect? 😂
I'm sorry?
That sounds more complicated then the Polygon2D solution i'm forming.
a polygon2d (especially when automatically converted into a collisionpolygon) could approximate that, but sounds less accurate for stuff like "fire burning a hole in the oil"
it's definitely a million times easier tho than the cellular automaton idea
So you would agree that it would be the most likely solution to the problem?
If you do, we can end it here and I form a solution myself.
at least the most likely one you can easily implement to get stuff done and then tinker with and potentially refine into something more complicated later, yeah
Okay, thanks.
I will ask about things like "how to fill a Polygon2D with a texture" some other time.
Will mark as solved.
iirc you can literally just give the Polygon2D node a texture. might have to calculate custom UVs for the right look, but that sounds relatively simple compared to all the other math you're gonna do anyway
I see, thanks again.
I don't know how they implemented it but Instinctively I would create a big square on top of my rooms and I would have a grid (like a 2d voxel grid with a resolution as high as you want depending of the performances you want) and when an element hit a position, just set the corresponding grid cell to a value like fire = 1, oil = 2, poison = 3... then you could send this as a texture to the GPU (I implemented something like this it's not verry hard but it's not as simple as a texture with float it it) as an uniform to your big square. You could use value like -1 for wall / void and make it impossible to override.
Then you could sample from this grid on entity position to know what will affect them.
And to avoid it looking to pixelated, you could implement the marching square algorithm in your square shader
Also, for cells that need to be updated (like fire or steam or anything that dispear overtime or spread) you could do it on your GPU but you may have poor performance depending on your resolution. I would recommend you to at least implement it using C++ with the GDExension but a compute shader is the must suited for the job here but I don't know how they work on Godot
I was considering something similar using a Tilemap, but Polygon2D offers more flexibility.
That being said, if I don't want to go the full mile yet, your approach solution could be a good alternative.
I would strongly recommend you not to use Tilemap, their performance for this type of operations are really bad
I would not have used a tilemap for 1x1 tiles, if anything, something along the lines of 50x50 at best
but again, polygon2D is the most likely scenario at this point
Btw just found out the dev already answered to your question on reddit !
https://www.reddit.com/r/Unity2D/comments/4oula3/2d_top_down_liquid_on_floor/
It look like they do use a grid system but do not render it directly using a shader but generate a mesh on top of the grid
thats a nice find, thanks!
Sadly it can't be translated 1:1 into Godot, or at least the polygon approach i'm going with
since seemingly each cell would need to be its own "scene" that managed things like lifetime, or what the surounding "goop scenes" are doing
especially for the expanding fire, which is the really impressive part
I could still set oil on fire of course, but it would probably either be "all at once" or via an "fire setter" scene that roams around the fire polygon and turns oil polygons into fire
and that can wait for now, my goal was to have more refined ground effects then just overlapping areas, after all
I guess when he say each cell have its own state, he have an array of Cells, and update them in a "CreepManager" loop (which could be a node in Godot and update in physic process, even with a skip some frame logic to optimize more using the "Engine.get_physics_frames() % x" logic)