CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.63k stars 4.18k forks source link

Plane Design Document #39957

Closed kingcet closed 4 years ago

kingcet commented 4 years ago

now that we have helicopters i thought it wouldn't be a huge jump to make planes, i decided to make a design doc for it and a basic and changeable formula for it.

when or if possible i would like planes to be added to the game as an alternative to helicopters that, if built right would use less fuel or carry more stuff.

i understand that my idea and way of the planes functioning may not be chosen and a different way for them to work might be chosen, even if that happens i would just be glad that we got planes.

Mock up picture of planes and my design doc

cdda plane design doc.txt

design doc in text:A CDDA design document for how planes could work, i made this for any coders who have the time to make this stuff Disclaimer: this was started at 5 in the morning, if i fuck up with anything here please give a bit of slack, now onto the stuff.

How a plane in cdda could generally function: flight would work similarly to helicopters in a few ways but for the most part would be very different,they would have a minium speed required for take off and would need wings for flight, adding wings to a plane would produce more lift at the cost of adding drag and weight, a formula of how lift is prudced could go something like this lift in pounds = velocity in fps squared * sqaure meters(instead of feet) /30, having more lift would let players be able to save more on fuel, this being one of the benefits of planes

the model i have for cessna might take off at 132fps while the piper aerostar i made might take off at 164.042fps

Sources:https://en.wikipedia.org/wiki/Piper_Aerostar , https://www.grc.nasa.gov/WWW/K-12/WindTunnel/Activities/lift_formula.html (chopped down) , https://en.wikipedia.org/wiki/Cessna_172.

let me know if my math is fucky @kingcat on the discord. as for now, well thats all she wrote, i am gonna go take a break.

piper 1

piper 2

cdda cessna

cdda cessna 2

natsirt721 commented 4 years ago

I'm going to preface this with my personal take on aircraft:

Do you really need to travel that quickly or go that far? Given the current map generation algorithm, everything 'interesting' for a survivor to experience is going to be within a few tens of kilometres of where you spawn (obviously varying based on map gen settings and starting scenario) - a heli is a huge step up from a car or truck, but isn't much less advantageous than an airplane - in fact, in a disaster scenario a helicopter is significantly more useful that an airplane given the fact that it doesn't need a large prepared space for takeoff and landing. Additionally, the player should require special training (or heinously high driving skill) to operate an airplane - that might make a good NPC mission or starting class, and should not stand as a barrier to entry for aircraft - but the consideration should be made that most survivors cannot step into the cockpit and operate an airplane without prior training.

That out of the way, as an aerospace engineer by education I am entirely in favor of adding aircraft, however I think the vehicle mechanics require a little more work before implementation can begin. I got most of the way through an essay about aircraft design principals, but that's probably not what anyone wants to hear nor is it constructive, so I'll just cut to the chase:

Its going to be very very hard to implement a system that is balanced for both small and large aircraft, due to the number of terms with exponents the nuances of aerodynamic equations, the necessary granularity of vehicle construction, and the simplifying assumptions of the current vehicle dynamics system. Do you know how air drag is calculated for cars currently? Black magic (seriously, look at it). The vehicle dynamics refactor has been a long time coming IMO, but it is a pretty significant undertaking to even make aircraft a possibility, and a lot of the vehicle mechanics are balanced against it, meaning more modifications to disparate parts of the codebase to maintain some semblance of 'balance'. I'm sure that someone could invent a series of equations to make either small, or large aircraft work, but nobody can invent equations that make them all work, and be bolted directly onto the existing vehicle code.

That last part is the most important by the way, similarly in that a new scientific theory must explain previously observed phenomena in addition to new observations in order to be considered acceptable. More generally, it isn't that it is hard to simulate an aircraft, but it is hard to do that within the current context of the C:DDA codebase. I know it seems like helicopters are one step away from aircraft, but in reality, a helicopter is more like a car that can change Z-levels (read: hover) than a full-fledged aircraft, which explains why it was able to be shoe-horned into the existing vehicle system with relative ease.

If you want to put some more effort into an actionable design document, here are a few questions that need answering, preferably with attached pseudocode or detailed algorithms (e.g. it isn't sufficient to say "turrets should generate more drag because they're mounted on the outside", but something like "for turrets, drag is determined by the cube of velocity multiplied by 1/10 the mass of the turret to approximate cross-sectional area" is a good start).

If you need assistance with any of the lift/drag equations feel free to DM me.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

mlangsdorf commented 4 years ago

A vehicle's air drag coefficient is determined by raycasting lines along the vehicle's axis of motion, and then adding or subtracting increments based on the vehicle's features. The same process is also used to determine the height of each column. Final air drag coefficient - which is really CoD * cross sectional area - is the sum of each column's CoD times the height and width of each column.

That's hardly black magic.

Airplanes can use the same logic. Maximum air velocity would be calculated as the speed when acceleration due to jet or propeller thrust is equal to deceleration due to air drag. At all speeds, lift is going to be governed by the simplified lift equation `L = 1/2 air density air speed air speed wing area * coefficient of lift, and coefficient of lift and wing area are probably going to be calculated in the same way as the air drag coefficient, but each wing structure will probably have it's coefficient of lift factor designed in JSON.

Partial answers for some of the other questions:

All that said, getting airplanes to work is a very low priority project for me, but I will provide advice and guidance for some other developer who wants to take a swing at it.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

stale[bot] commented 4 years ago

This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it