Air/Vacuum Simulation
The difference is not in how you store them but how you access them. In liquid simulation method you basically say the following:
I am level 5 air block , All the blocks near me in all directions but the one I come from get air, repeat for new air blocks.
I am level 4 air block, all the blocks near me in all directions but the one I come from get air, repeat for new air blocks.
.
.
.
I am level 0 air block, I am not air block, function end. / I am a wall, I am not air block, function end.
That is basically meaning that we have 5 code sections for each new air block: 5*5*5*5*5 ... n times (5^n) in worst case scenario (we didn’t run into any walls), it is true that in real environment we will run much less code as we meet walls and make the function much more clever, but even after all of that you will still get a really high runtime function which means your CPU commits suicide.
I am level 5 air block , All the blocks near me in all directions but the one I come from get air, repeat for new air blocks.
I am level 4 air block, all the blocks near me in all directions but the one I come from get air, repeat for new air blocks.
.
.
.
I am level 0 air block, I am not air block, function end. / I am a wall, I am not air block, function end.
That is basically meaning that we have 5 code sections for each new air block: 5*5*5*5*5 ... n times (5^n) in worst case scenario (we didn’t run into any walls), it is true that in real environment we will run much less code as we meet walls and make the function much more clever, but even after all of that you will still get a really high runtime function which means your CPU commits suicide.
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
-
- Moderator
- Posts:4205
- Joined:Thu Dec 06, 2012 11:49 am
- Affiliation:CNI
- IGN:FC_Rangefinder
- Location:Sol IIIa, School of Hard Knocks
Re: Air/Vacuum Simulation
So, Iv, you mean that we figure out how much air is in a ship/metaworld, and every time a change occurs to the metaworld, recalculate the air volume, and from the air volume, determine the effects on players?
Call me derp, but I'm not codesavvy enough to see how this is more CPU efficient than the liquid method.
Call me derp, but I'm not codesavvy enough to see how this is more CPU efficient than the liquid method.
Re: Air/Vacuum Simulation
No, recalculation is what you do, I do PRE-Calculation, just to let you know the algorithm I wrote there is similar to what you will end up if you calculate air like flowing water. Also it seems like in one way or another RE-calculation of the air volume will be required to determine if an area is sealed or not which is why I try to figure out the best way to do it.
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
Re: Air/Vacuum Simulation
Instead of making stuff actually flow, can we just make it so any air block touching a vacuum block is destroyed and replaced by vacuum after, say, a tenth of a second? That'll mean that if there's a hole in the hull, the air in that room will be destroyed very quickly, but it'll stop at airlocks or whatever.
;.'.;'::.;:".":;",,;':",;
(Kzinti script, as best as can be displayed in Human characters, translated roughly as "For the Patriarchy!")
(Kzinti script, as best as can be displayed in Human characters, translated roughly as "For the Patriarchy!")
Re: Air/Vacuum Simulation
The problem is not with draining the air but actually filling it back as I said, to check if an area is sealed.
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
-
- Moderator
- Posts:4205
- Joined:Thu Dec 06, 2012 11:49 am
- Affiliation:CNI
- IGN:FC_Rangefinder
- Location:Sol IIIa, School of Hard Knocks
Re: Air/Vacuum Simulation
That actually sounds good. Like how MC lava sets fire to flammables, which vanish after x time?Kdapt-Preacher wrote:Instead of making stuff actually flow, can we just make it so any air block touching a vacuum block is destroyed and replaced by vacuum after, say, a tenth of a second? That'll mean that if there's a hole in the hull, the air in that room will be destroyed very quickly, but it'll stop at airlocks or whatever.
So any player in a zone with no air starts taking damage? Or do we have the underwater style air bubbles thing?
Re: Air/Vacuum Simulation
If they're in hard vacuum, give them maybe a second before they start dying, and another two or three to actually die. If you end up in vacuum without a pressure suit you should be pretty screwed.Commander Error wrote:That actually sounds good. Like how MC lava sets fire to flammables, which vanish after x time?Kdapt-Preacher wrote:Instead of making stuff actually flow, can we just make it so any air block touching a vacuum block is destroyed and replaced by vacuum after, say, a tenth of a second? That'll mean that if there's a hole in the hull, the air in that room will be destroyed very quickly, but it'll stop at airlocks or whatever.
So any player in a zone with no air starts taking damage? Or do we have the underwater style air bubbles thing?
;.'.;'::.;:".":;",,;':",;
(Kzinti script, as best as can be displayed in Human characters, translated roughly as "For the Patriarchy!")
(Kzinti script, as best as can be displayed in Human characters, translated roughly as "For the Patriarchy!")
Re: Air/Vacuum Simulation
I think I have a solution. I'll test it in 2d later today.
- I can be reached as ducky215 on minecraft forums -
Re: Air/Vacuum Simulation
Oh someone is actually going to bring something new to the table here !
BTW as for air draining all you need to do is to detect once a block is removed that on one side of it there is vacuum and on the other side there is air, then set the direction of all entities in the enclosure from the direction of the air cube to the direction of the vacuum cube, draining a set amount of air from the enclosure as whole.
BTW as for air draining all you need to do is to detect once a block is removed that on one side of it there is vacuum and on the other side there is air, then set the direction of all entities in the enclosure from the direction of the air cube to the direction of the vacuum cube, draining a set amount of air from the enclosure as whole.
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
-
- Moderator
- Posts:4205
- Joined:Thu Dec 06, 2012 11:49 am
- Affiliation:CNI
- IGN:FC_Rangefinder
- Location:Sol IIIa, School of Hard Knocks
Re: Air/Vacuum Simulation
I feel Kdapt's solution is PROBABLY best, but I don't know sufficient java to say so for sure.
Re: Air/Vacuum Simulation
Its a solution, but not for the problem at hand. We talk about defining enclosure and if an area is sealed, not if it is depressurised.
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
Re: Air/Vacuum Simulation
Can we have pressure levels? Can that be a thing?
"Any sufficiently advanced technology is indistinguishable from a completely ad-hoc plot device"
— David Langford
— David Langford
Spoiler:
Re: Air/Vacuum Simulation
What do you mean by that, and more importantly why do you want that ?
They're watching ...
"I am forbidden tag" -CvN
"I am forbidden tag" -CvN
Re: Air/Vacuum Simulation
If we do it on a block-by-block basis I'd prefer air-vacuum but if we precalculate it, it could work.
- I can be reached as ducky215 on minecraft forums -
-
- Fleet Admiral
- Posts:3021
- Joined:Fri Dec 07, 2012 12:10 pm
- Affiliation:[redacted]
- IGN:Ivan2006
- Location:In a universe.
- Contact:
Re: Air/Vacuum Simulation
He means that the system could differentiate between different air pressures.Iv121 wrote:What do you mean by that, and more importantly why do you want that ?
May not only be important for spaceships, but also for upper atmosphere stuff.
Quotes:
Spoiler: