Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyable Helicopters #33829

Merged
merged 7 commits into from Apr 4, 2020
Merged

Flyable Helicopters #33829

merged 7 commits into from Apr 4, 2020

Conversation

ghost
Copy link

@ghost ghost commented Sep 5, 2019

Summary

SUMMARY: Features "Flyable Helicopters"

Purpose of change

Allows helicopters to fly, go up and down z-levels and fly about and inevitably crash and burn and die

Describe the solution

So I've added a rotor part
A vehicle with this rotor part, transfers its engine power to it, and can lift off with < key ( and descend with > key ) , assuming it has the required lift capacity based real-life( ish ) helicopter physics of rotor diameter and power and stuff.

this then transfers the vehicle to another z-level and keeps it there so it dosnt fall, in other words, flying.

Then ive added some wacky math to calculate speed/acceleration from rotor diameter and weight etc.

What I've not done yet is added any other types of helicopter spawns in the game, or even approached the idea of how difficult it should be to fly the helicopter, or how to restrict that to a profession maybe?

update - added new helicopter types and a helicopter pilot profession which ( for now ) restricts the piloting ability.

I will either a) leave the JSON content/mapgen/player balance up to other creative people who want to add on to this, or take direction / suggestions from them, as that kinda thing aint my forte.

Describe alternatives you've considered

N/A

Additional context

I got some data from various places.

http://www.heli-chair.com/aerodynamics_101.html

http://www.rcheliwiki.com/Disk_loading

The math is commented in vehicle.cpp lift_thrust_of_rotorcraft()

Taking the apache as an example : the in-game weight and power werent far off from real life values, and adding the correct rotor diameter, outputted a level of thrust that seemed ok.

Stuff still to do :

  • maximum hardcoded speed limit of helicopters is around 250 mph due to aero stuff
  • The aforementioned player profession trait to allow flying it at all
  • Handle what happens when you put wheels on helicopter
  • spawn low chance of helicopters in various places, the national guard camp maybe? ,/ airstrip
  • add more helicopter types
  • handle turning the engine off while flying, and making it plummet to its doom.
  • add aero drag for the rotors based on their dimensions
  • customization of driving messages displayed to player " Your %s descends" etc
  • decrease fuel efficiency when hovering
  • need heli to be laterally stationary when taking off.
  • landing when near trees / other obstacles = no bueno.

Have a gif of an apache zooming about.

https://gfycat.com/detailedcrazyiberianmidwifetoad

@Myobu1
Copy link

Myobu1 commented Sep 5, 2019

Dear God... flyable helicopters? Have you gone mad? If the game get's any better you might cause a resonance cascade and doom us all!

@ghost
Copy link
Author

ghost commented Sep 6, 2019

Have you considered a flying skill?

@Rod995
Copy link
Contributor

Rod995 commented Sep 6, 2019

What about other flying vehicles?

src/vehicle.cpp Outdated Show resolved Hide resolved
@Night-Pryanik
Copy link
Contributor

Didn't look at the code yet, and didn't find this info in OP. So, will helis auto-drop to the ground when out of fuel?
Will there be an auto-rotation?

@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions labels Sep 6, 2019
@Night-Pryanik
Copy link
Contributor

Handle what happens when you put wheels on helicopter, does that mess up how the speed and liftoff functions work?

Rotabuggy!
изображение

@ghost
Copy link
Author

ghost commented Sep 6, 2019

Didn't look at the code yet, and didn't find this info in OP. So, will helis auto-drop to the ground when out of fuel?
Will there be an auto-rotation?

No autorotation on first pass probably.
vehicle check for is_falling will return true if engines are not working, so yes, it will drop to the ground.

IT dosnt currently, when you turn the engine off, ill fix that.

@ghost
Copy link
Author

ghost commented Sep 6, 2019

What about other flying vehicles?

In time, helicopters are easier, in a way, hot air balloons will be easy now too.
Planes will be more difficult.

@ghost
Copy link
Author

ghost commented Sep 6, 2019

Have you considered a flying skill?

It'll probably be handled by a profession trait to begin with. Then when we have a proficiency system itll use that, no need to bloat the skills list more , we eventually wanna have it - skills= general, proficiencies = specific

@ghost
Copy link
Author

ghost commented Sep 6, 2019

Well I musta messed up those conversions between feet, meters, kg, lbs, and newtons all over the place, cos now the heli can go 500 mph.

Time to implement that speed limit.
EDIT : yeah adding the proper air drag stuff, limits it to below 250mph effectively, it wont accelerate any more, even though the top speed is listed as 495 by sheer force of the engines/rotor, which lines up with real life naturally anyway. neat.

data/json/vehicleparts/combustion.json Outdated Show resolved Hide resolved
src/vehicle.cpp Outdated Show resolved Hide resolved
src/vehicle.cpp Outdated Show resolved Hide resolved
src/vehicle.cpp Outdated Show resolved Hide resolved
@mlangsdorf
Copy link
Contributor

A few quibbles aside, this is excellent work.

@SirPiecemaker
Copy link
Contributor

What a mad lad. In awe of this lad.

@kevingranade
Copy link
Member

The absolutely critical pieces of this are that fuel consumption, skill requirements and takeoff/landing be representative.

For fuel consumption, you're looking at one, avgas or kerosene instead of regular gasoline or diesel, at least for most aircraft, and two, fuel efficiency in the single-digit MPG range assuming cruising at altitude, with a helicopter in particular, low-altitude hovering will absolutely destroy your fuel reserves, according to this sketch of the situation: https://aviation.stackexchange.com/questions/45631/do-helicopters-use-more-fuel-when-hovering you're looking at something like 2x the instantaneous fuel consumption when hovering or in very slow flight vs cruising speed, and with low-altitude flight also costing an order of magnitude more power/fuel than cruising altitude flight.

The takeaway from this is that while an airport should definitely have a lot of avgas and kerosene on hand, you're pretty much going to be range limited by being tethered to your origin airport until you find other landing sites, especially if you're flying around looking for things instead of doing point-to-point flight.

For skills, driving doesn't even enter into it, I don't imaging doing anything other than having a fixed trait that governs flight ability, at least in the short term. If you want to be able to fly, you need to start as a helicopter pilot, period.

Takeoff and landing need to respect clearance issues, I'm not sure what we can do UI-wise to help out with this, but a tree within rotor radius of your landing site is a death sentence, or at least a guaranteed crash.

@jeremyshannon
Copy link
Contributor

Helicopter piloting should be separate from aircraft flight skill, helicopters are different (and much easier) to fly. Their controls work on fairly different principles, and they have different training and piloting licenses from fixed wing aircraft. The planned proficiency system should handle it just fine, though.
I gotta say, this is amazing work.

@RabbitB
Copy link
Contributor

RabbitB commented Sep 6, 2019

It should be brought up that while helicopters may have much higher requirements, this will also allow for smaller aircraft, such as auto-gyros, which have vastly lower training, fuel (they're actually pretty efficient) and maintenance requirements.

Gyrocopters and other auto-gyros are incredibly easy to fly. Actually easy to build as well; there's a reason you can buy plans and kits. To put into perspective how easy they are, the FAA only requires 20 hours of trained flight to get your license.

A minimum of 20 hours flight time, including:
Fifteen hours of dual flight instruction (time spent in flight training with an instructor in the aircraft with you)
Five hours solo
Two hours dual cross-country
One solo cross-country flight
Three hours of test prep instruction

They got a reputation in the past for being death-traps, not because they're actually that dangerous, but because their flight characteristics during unpowered flight (such as engine failure) is literally the opposite of a plane, and many people involved in accidents already had regular fixed wing aircraft experience. That training of what to do in an emergency is hard to break, even though you're flying a different aircraft in which that training will kill you.

@kevingranade
Copy link
Member

I agree that an ultralight auto-gyro is the absolute best option for a survivor-built powered aircraft (if you just want to get into the air, hot air balloon is better), it has somewhat limited range, speed, and cargo capacity, but it's a heck of a lot easier to get off the ground and land safely.

@tenmillimaster
Copy link
Member

AUTOROTATES MENACINGLY

@VReaperV
Copy link

VReaperV commented Sep 7, 2019

For skills, driving doesn't even enter into it, I don't imaging doing anything other than having a fixed trait that governs flight ability, at least in the short term. If you want to be able to fly, you need to start as a helicopter pilot, period.

What about having NPCs that could have that trait too and can fly the helicopter for you? Maybe even be able to call them via the radio so that they could fly to, for example, a roof of a building to take you from a bad situation.

Also, perhaps some advanced AI module that could let you fly the helicopter if it isn't too unstable? There's also a report at lockheedmartin.com about a helicopter with fly-by-wire controls, as well as a fully autonomous flight planned.

@kevingranade
Copy link
Member

Having NPCs fly it for you is just down to getting it working, that's totally reasonable.

For it to be at all practical I'd expect it to need a team of 3+ NPCs to maintain a helicopter (not full time, just you need that many for the skills), and a few more to build one.

@Orange01gaming
Copy link

What about other flying vehicles?

In time, helicopters are easier, in a way, hot air balloons will be easy now too.
Planes will be more difficult.

Dude I would LOVE to see hot air balloons and just drift with the winds. Now that we have wind simulated in game that wouldn't be too difficult right?

@kevingranade
Copy link
Member

Hah, we absolutely have a wind simulation.

@ghost
Copy link
Author

ghost commented Sep 10, 2019

What about other flying vehicles?

In time, helicopters are easier, in a way, hot air balloons will be easy now too.
Planes will be more difficult.

Dude I would LOVE to see hot air balloons and just drift with the winds. Now that we have wind simulated in game that wouldn't be too difficult right?

Yup, and they'd be easier to maintain and use than a helicopter would be, and far easier to craft, perhaps.
Now I've got the fundementals of flying worked out, then hot air balloons would be relatively easy to add on top.

@capSAR273
Copy link
Contributor

Will this require a new location to find avgas and similar items related to aviation? Could be cool to add a helipad or even civilian/commercial sized airports with hangars and a runway. Of course most things at the location would be busted up due to the apocalypse but some things could be saved.

@Zireael07
Copy link
Contributor

We already have an airport location with a crashed airliner, avgas could be a fitting drop there.

@Goran42069
Copy link

This is pretty amazing, i only wish that you were actually able to tell whats below you.

@ZhilkinSerg ZhilkinSerg changed the base branch from dev to master April 2, 2020 14:23
I-am-Erk and others added 3 commits April 2, 2020 19:26
partial reconstruction

reconstruction finished but vehicle cache still misbehaving

finalized vehicle rotor physics/math

edited in error

Revert "edited in error"

This reverts commit b0db1e7.

astyle and removing erroneous edit

fix point.x error

fix conversion to newtons

astylin

add proper aero drag to rotor

fix consumption and acceleration

Update src/vehicle.cpp

Co-Authored-By: Mark Langsdorf <mark.langsdorf@gmail.com>

Update src/vehicle.cpp

Co-Authored-By: Mark Langsdorf <mark.langsdorf@gmail.com>

add fuel tanks to apache, and change name, and revert edit to turbine

add relevant parts to osprey and blackhawk

fuel types and pilot prof/trait and vertical move messages

json lint

added other helis

add civilian helicopters to vehicle list ( no spawn in world yet )

sanitized interaction with the ground and horizontal movement etc

allow helicopter to use autodrive

from review : line deletions and auto removal

Update src/vehicle.cpp

Co-Authored-By: Curtis Merrill <curtis.r.merrill@gmail.com>

Update src/vehicle.cpp

Co-Authored-By: Curtis Merrill <curtis.r.merrill@gmail.com>

astyle

add chance for civ helis to spawn at regional airport

vehicle group json fix

change to lvalue

mapgen json lint

fix vehicle group typo

add increased fuel usage for low / hover speeds

better fuel efficiency curve

tweaked fuel efficiency range

add NOINSTALL flag to rotor until a helicopter construction system is in place

Update data/json/items/fuel.json

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

Update data/json/vehicleparts/rotor.json

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

Update src/vehicle.cpp

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

Update src/vehicle.h

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

plural names

Update data/json/items/vehicle/rotor.json

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

Update data/json/items/vehicle/rotor.json

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

remove noinstall flag to stop errors

alternative to NOINSTALL - set install difficulty impossibly high

clang-tidy satisfaction - differing parameter names and integer division fix

simplify expression

add comment in the json for why difficulty is so high

fix serialization of is_flying and autodriving route

give more fuel tanks and more rotor noise

Update src/vehicle.cpp

Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>

zlevel check before early return

fix vehicle display to show air max speed

unvisited member leftover

astyle

Update traps.json
@ghost ghost requested a review from John-Candlebury as a code owner April 2, 2020 19:55
@ghost
Copy link
Author

ghost commented Apr 2, 2020

Rebased, retargeted, re-tested, working, slight edits to vehicle prototypes.

@ZhilkinSerg ZhilkinSerg merged commit 53657b5 into CleverRaven:master Apr 4, 2020
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/helicopters-how-to/23168/12

@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/tips-tricks-and-newb-questions-reborn/16870/2376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet