I'm going to double post.
A treatise on using unsigned integers in vectors and numerical gradients to simulate gas dissipation, submitted by T. Fondler, B.Sc in Theoretical Retardology.
- Introduction
- Assumptions
- Mechanics
- Vectors
- Demonstration 1: 3 tile breach
- 1 tile breach
- Demonstration 3: re-pressurizing
- Timers
- Gameplay Balance Issues
- Conclusion
Introduction:
I think I have a simple, neat and scaleable solution to implementing improved gas physics and simulating kinetic energy within gases by using unsigned integers. I am a professional retard and have little experience with the BYOND engine but from my observations it should be possible to implement this system over top of the existing gas physics in game. This solution will keep the spirit of already implemented phenomena and conveniently not require any knowledge of fluid dynamics or physics, which is great because those things are bullshit.
Assumptions:
- I will treat each in-game square as a container. I understand the squares may already be used as gas containers, but those (and their subsequent parameters) can be imagined as contained within this new container.
- Gas pressure gradient values may transfer to vectors, but not vice-versa.
- Vectors will contain a direction and a kinetic energy amount. Both will be on an unsigned integer scale.
- Each container will be able to confer gradient data to the gas contained within
- Existing pressure and temperature values will impact vector values.
- Gases will move towards lower pressure gradients, always.
For the purpose of this explanation and to demonstrate my model I will be signing my integers because it’s easier to visualize the pressure gradient that way.
Mechanics:
- Gases will start with a gradient value of 1 and a predetermined vector value.
- The tile/container accumulates gradient values
- Gradient values will impact vector values. All gases within a tile will have their vector value impacted by the tile’s gradient value.
- Gases will always move to a lower gradient value
- Upon encountering an impenetrable tile, gases will adjust their vector by 90 degrees
- A tile can contain all types of gases
- Gases are assumed to move through one another, if their vector value is below 2
- At high enough gradient values gases will begin to act upon other gases
- When a gas with a gradient value of 1 encounters a tile containing a gas with a gradient value of 1, the gradient will not be added.
- Space tiles will have hard-coded and immutable negative gradient value. For the purpose of this model, we will use -2.
- Space tiles will have increasing negative gradient as the distance from the station increases, until the gradient limit is reached. In this model the limit is -5.
- Space tiles will accumulate vectors as regular tiles do, but with a negative modifier. The modifier increases as distance into space increases.
- Maximum gradient space tiles destroy gas and reset vector
Vectors
Each gas will have a Vector, containing direction and force. Since each tile can be adjacent with 8 other tiles, it’s only necessary to have 8 vector values. Gases are assumed to be “spawned” at a canister or a vent/pump, their vector can be randomly determined when they are spawned in an area. Force of a gas (the kinetic energy it imparts) will be determined by the pressure and amount of gas, which are already decided in-game. The kinetic energy scale will consist of unsigned integers but the creation of the scale is outside the scope of this retardocument.
- Demonstration 1: 3 tile breach
- This demonstration will show how a 3-tile breach causes realistic gas interactions using the above rules. The model consists of a room 3 tiles by 7 tiles, surrounded by a 1-tile wall and with an airlock marked in orange. The room starts off full of airmix with a gradient value of 1.
- Granted, I’m a little drunk and my numbers are off but I think the model is pretty clear.
An intact room
A breach of 3 tiles
02 exits via breach, gradient values accumulate near exit and decrease as gases leave tiles
As you can see, the gradient values which impart vector values increase near the exit point. It's assumed in the next image the gases in furthest space tiles will have been destroyed.
1 Tile breach
I’m not going to bother modeling it, but with the above graphics in mind, a 1 tile breach would necessarily produce much higher vectors at the exit point as all gases must transfer their vector value to a lesser amount of tiles adjacent to space tiles.
Repressurizing
- For the sake of simplicity, I’m not delving into gas diffusion timing. I’m assuming gas diffuses at 1 tick, whether that be tied to real time clock values or existing in game tick values is irrelevant.
- It’s assumed the room being repressurized has its walls intact and the gases within have reached equilibrium at 0 gradient value.
- It’s assumed that the tile containing the pump will always contain the gas being pumped.
- Gas enters the room with a gradient value of 1 with a predetermined vector. RNG could be used to give the gas a direction with a minimum value of kinetic energy.
- In this model, the room has been repressurized via pump for a number of ticks. We are focusing on one gas. It can be assumed each tile is a discrete container for individual gases, ie. nitrogen entering a tile containing oxygen but no nitrogen encounters a gradient value of 1, but a 0% of nitrogen.
- If a gas encounters a tile containing any value of its own type, it will enter an adjacent tile of 0% value of its own type. Once all possible tiles are populated with gas, the % of gas within a tile will increase but the vector values will not, given consistent predictable entry via pump.
Timers
- To prevent inheritance issues which would cause increasing gas vectors in sealed rooms, I propose each tile have a timer with regards to gradient. If a tile does not obtain new values in 2 real time seconds, the gradient resets to 1 if gases present or 0 if gases absent
Gameplay balance Issues
New gas phenomena would impact the way hull breaches affect players. Currently there is little incentive to expediently repair hull breaches, as internals are plentiful and breaches do not significantly impact gameplay. The new gas mechanics would render breaches more serious, but at the benefit of creating “fun”, a little understood phenomena in current TG code. As a counter, I propose that the following mechanics be added if this gas model is implemented:
- Smart Metal Foam Grenades contain a “smart” component. If a grenade encounters a gradient exceeding 2, it detonates regardless of timer. It would allow the user to seal breaches that would otherwise suck the grenade into space. The Smart Metal Foam is unaffected by gas gradient and kinetic energy.
- Members of Security, Command and Engineering be given standard issue boots containing a single-use battery powering a magnetic element. Boots would turn into magboots for 15 seconds of real time, at the expense of player movement.
- The “pull” mechanic working on immovable objects. If a player selects “pull” on a secured table, chair or other object, they will resist the kinetic gas forces until a certain threshold is passed, wherein they release.
Conclusion:
I have autism please laugh at me.