• [E2 Beta Release] Advanced Flight Controller
    28 replies, posted
[U][B]Welcome![/B][/U] This is the home thread of my Advanced Flight Simulation E2. Here you will find the up to date version of the code, as long as a changelog and a method of suggestion input. This thread contains some tips and tutorials for designing your aircraft around this E2's limitations. [B]Latest Version:[/B] [video=youtube;ukBdKAYsubI]http://www.youtube.com/watch?v=ukBdKAYsubI[/video] [B]Older Versions:[/B] [video=youtube;IhTqqTHjx9s]http://www.youtube.com/watch?v=IhTqqTHjx9s&feature=c4-overview&list=UUnjW1se5L5_es1MUvTcaufQ[/video] [U][B]Features[/B][/U] [I]*Full 3D Mouse Controlled Flight *Realistic Flight Model *Balance and limitations. All copies of the E2 should be balanced for fair fighting. [U]Better engineering leads to better planes.[/U] *Holo HUD for lag reduction. A decent server can run 6 running copies of this E2. *Damage model with collision detection and wing/elevator damage simulation. *Simulation of aircraft stalling and tailspins. *Realistic Landings and Take-offs [Now Supports landing on entities, such as an player built aircraft carrier] *Easy and fun to fly and dogfight your friends![/I] [U][B]Controls[/B][/U] [B]W/S -[/B] Throttle Control. Holding W at 100% Throttle activates WEP WEP is a temporary boost running the plane at 115% power. This has a use limitation and a cooldown Holding S at 0% Throttle brakes the plane when on the ground [B]A/D -[/B] Manual Roll adjustment. This is for fine tuning your turns [B]Alt -[/B] Mouse Freelook [B]Right Click[/B] - Aim Zoom [B][U]Installation and Setup[/U][/B] 1. Spawn the E2 on a baseplate. It will create holograms showing you the forward and up orientations of the plate 2. Apply the Ice physical material using the Physical Properties tool under Building. [I]Leave the gravity box [B]checked[/B][/I] 3. Spawn an Advanced Pod Controller, Camera Controller, and an EGP HUD entity (This is found under Wire - Display) [I]Make sure to select HUD from the Screen drop down box[/I]. 4. Using Entity Markers (or just one Advanced Entity Marker), link the props you want to use as your wings and elevator and wire them to the E2's inputs respectively. [B]VERY IMPORTANT NOTE:[/B][I] If these props are not parented, make sure that the prop's gravity is [B]disabled[/B]. You can do this using the Physical Properties tool, and [B]unchecking[/B] the gravity box. [/I] 5. If you're using ACF guns, make sure your ammo crates are [B]parented[/B] 6. Additional note: ANYTHING besides the base prop needs to have no gravity. This includes landing gears, wheels, your propellers. [B]EVERYTHING.[/B] [B]Here's some handy hints for engineering the best combat planes![/B] [img_thumb]http://i.imgur.com/6virbND.jpg?1[/img_thumb] [img_thumb]http://i.imgur.com/orLImfM.jpg?1[/img_thumb] [img_thumb]http://i.imgur.com/5fVKYDQ.jpg[/img_thumb] Convergence Pros: A very concentrated point of fire, will blow shit out of the sky if you can get someone in that range. Cons: Strafing is much harder, stuck to getting targets within that zone. [B]Network Impact[/B] The E2 with EGP which now updates every 40 ticks (~3 times a second), The E2 itself creates 100 ins of network traffic. The plane itself pulls about 400 just from physical entities. This E2 is server friendly. Expect v1.0.6 to be released very soon! [B]Changelog[/B] [U]Open Beta v1.0.5[/U] [I]Updated: Flight model. Planes now roll more realistically and handling is improved Updated: Crash model. Now ranger based. No more death from stall turning! Added: Gun Hit position. Helps with strafing Added: Landing on entities now supported![/I] [U]Closed Beta v1[/U] [I]Initial release [/I] [CODE]@name ACF - Plane v1.1 @inputs [Pod Cam EGP Gun]:wirelink [WingLeft WingRight WingElevator]:entity @outputs Alt KPH StallWarning AimPos:vector ERPM @persist [E Holo Seat Driver GE]:entity [Mod_T PV RV Yaw Speed Mass Throttle ERPM STime Alt W A S D VelLY IdealRPM] [Scale Origin]:vector2 Damage Engine @persist [EngineSound EngineStartSound]:string Alive Brake CamX CamY TTime Cooldown [Props]:array [AltR ForDisR]:ranger Timer [Agility]:vector TaxiStr CamMode @persist FCamX FCamY AdvancedMouse runOnTick(1) if(dupefinished()){ reset() } if(first()){ #Controls #W & S are throttle controls. Greater than 100% throttle is WEP (Wartime Emergency Power). Its a turbo that runs out and has a cooldown. #A & D are to manually adjust roll. This chip supports full 3D flight. While on ground A & D yaw the plane so you can taxi. #Mouse controls your Pitch & Roll/Yaw. Simply aim your mouse where you wish to fly towards. #The White Ring is your desired direction, the White Circle is your plane's current direction. #Your plane can stall if you do not heed the stall warnings, if damage is on, you will die if you crash into shit. #Installation: #Spawn this on your base prop. The hologram will point in the direction that is forward and will be on the top of the prop. #Spawn a pod controller, an EGP HUD entity, and a Cam controller. If you're using damage, spawn some entity markers. #If Damage = 1. Using an Entity Marker, select each of your wing "Base Props". THe E2 will automatically weight them for you. #These props can be parented #I recommend parenting the props of your wings to these new wing props so it looks like shit gets blown off #VERY IMPORTANT: IF YOU HAVE GUNS ON YOUR PLANE OR YOU HAVE THOSE WING PROPS I JUST TALKED ABOUT. NO GRAV THEM! SAME GOES FOR AMMO! #VERY IMPORTANT: SET THE PHYSICAL MAT (Friction setting) OF THE BASE PROP TO ICE! KEEP GRAVITY ON! #Ignore if damage = 0 #Continue to the setup portion of the E2 right below and adjust your values. Have fun flying! #Setup: Read the comments to know what eat thing does. AdvancedMouse = 0 Damage = 1 #Simulate Damage? If true then surface entity inputs required for flight. #Plane can be damaged by landing too hard and crashing into stuff. Agility = vec( 0.8 , 0.8 , 0.8) #The first component of this vector is pitch agility. It is clamped from 0.4 to 0.9 #The second component is roll agility. It is clamped from 0.5 to 1.2 #The last component is Yaw agility. This is clamped from 0.5 to 1.2 TaxiStr = 3 #This adjust the Yaw strength of your runway taxi. clamped from 0.5 to 1.5 Engine = 10 #Engine strength multiplier. Clamped from 7 to 11. # 7 for slow Biplanes. 8 for Bombers. 9/10 for Fighters. 11 for Jets. CamX = 360 #Where the camera should be length wise CamY = 150 #Height Wise as well FCamX = 10 #This is used for 1st person flight. This variable is forward/backwards FCamY = -5 #First person up/down EngineSound = "acf_extra/airfx/Spitfire.wav" EngineStartSound = "acf_extra/airfx/spitfire (2).wav" EngineInternalSound = "acf_extra/airfx/FW1902.wav" #If you're making a jet, change this to just your Engine Sound #End of Setup Seat = Pod["Entity",entity] Driver = Seat:driver() E = entity():isWeldedTo() Alive = 1 Mass = 4000 E:setMass(Mass) WingLeft:setMass(Mass/100) WingRight:setMass(Mass/100) WingElevator:setMass(Mass/100) holoCreate(1,E:massCenter()+E:forward()*E:boxSize():x()*0.5+E:up()*E:boxSize():z()*0.6,vec(1,1,1),E:toWorld(ang(90,0,0)),vec(1,1,1)*250,"hqcone") holoParent(1,E) holoCreate(2,Driver:shootPos() + E:forward()*10 - E:up() * 4) holoParent(2,E) Props = entity():getConstraints() Holo = holoEntity(2) ERPM = 800 Throttle = 0 soundPurge() holoEntity(1):soundPlay(1,0,EngineSound)
I think you got the wrong section, buddy. [editline]when[/editline] Wait, maybe not. Sorry!
It would be wise to disable the EGP hud updates if you have any more than 4 or so of these E2's in use. The usermessages created by EGP can be hell for some servers; SV fps drops, locking up etc. Just my opinion.
[QUOTE=gtanoofa;41658850]That's actually really good. Only of source maps weren't so small.[/QUOTE] None of the planes go fast enough to hit the walls. You can bank before you hit it.
nope
Currently the E2 only updates the EGP every 20 ticks. Before when it updated every tick, servers could handle 6 copies of it out before shit hit the fan, I have no clue how it performs now. It should be much much much better
If you are worried about performance you should write your chips with performance in mind; 2000 ops is just ridiculous.
Ops isn't a very good measurement metric of performance and time used, they are basically arbitrary. Take a look at the e2 definition files.
I am well aware of that, but you can still use it to gauge efficiency relative to another chip. Just by persisting and re-arranging things, and using timers (nothing in this chip requires runOnTick), I brought the 'arbitrary' ops of this chip down below 400. You can't deny 2000 is a lot for something this simple.
Unrezt, if youre willing to tell he how you optimized it down to 400 (Specifically what you did) I'd be willing to include them in the next update and credit you greatly. I've persisted everything and put everything into variables, and to be honest I don't know how to optimize it any more than it already is.
Yes information like that will be very useful. I too have codes that I don't know how to optimize more. Any new methods will be greatly appreciated. About the plane: Very nice post Tibbles. Informative and well presented. I think the diagrams are a very nice touch, being informative and nicely drawn. From the video it seems like the E2 makes planes fly and control very smoothly. The camera is very good too. I could see no jerk in the video. Rolls did looks a little weird but otherwise, I have no criticism. I would like to see the spin simulation and stall simulation though. I didn't see any in the video and I think those features that are very important to demonstrate. Thanks for posting the E2 code too. Much appreciated.
Very cool indeed. Are you ever planning to release the plane in the video?
[QUOTE=ROFLBURGER;41743071]Very cool indeed. Are you ever planning to release the plane in the video?[/QUOTE] lol
Great work with this Tibbles. However I can't seem to get it working, it's causing a lot of ( sv ) console errors the second the Cam controller is wired to the E2. I can also see some faults and some room for optimization, I'll do my best to optimize this as much as I can over the next few days. If I get anywhere I'll send it back to you with my results. ^=^ Errors: ( These x1,000,000 every second ) Wire error (Entity [341][gmod_wire_cameracontroller]): lua/entities/gmod_wire_cameracontroller.lua:153: bad argument #1 to 'SetPos' (Vector expected, got table) stack traceback: [C]: in function 'SetPos' lua/entities/gmod_wire_cameracontroller.lua:153: in function <lua/entities/gmod_wire_cameracontroller.lua:119> [C]: in function 'xpcall' lua/wire/server/wirelib.lua:62: in function 'TriggerInput' entities/gmod_wire_expression2/core/wirelink.lua:14: in function <entities/gmod_wire_expression2/core/wirelink.lua:12> [C]: in function 'pcall' lua/entities/gmod_wire_expression2/core/init.lua:117: in function <lua/entities/gmod_wire_expression2/core/init.lua:111> [C]: in function 'pcall' lua/entities/gmod_wire_expression2/init.lua:171: in function 'PCallHook' lua/entities/gmod_wire_expression2/init.lua:111: in function 'Execute' lua/entities/gmod_wire_expression2/init.lua:389: in function 'Setup' lua/entities/gmod_wire_expression2/init.lua:401: in function <lua/entities/gmod_wire_expression2/init.lua:401>
Sounds like a wiremod issue, try updating. Should fix all that for you. Also, sorry guys I've been busy, but here's v1.1. Same as 1.0.6 just more optimized.
[QUOTE=Tibbles!;41975639]...here's v1.1.[/QUOTE] Where? [editline]edit[/editline] Also, a few things I've noticed since using your chip that you might want to look into in future versions: -Engine RPM should not fluctuate in reaction to aircraft speed in the way your chip simulates. Aircraft don't work that way last I checked. -Nowhere in the documentation do you mention the keypress to change from 1st to 3rd person flight, despite that being an advertised feature. -It would seem that, while on the ground, The craft refuses to yaw during taxi. I don't know if this is a coding issue or something with my landing gear that I should change. -It might be a good idea to use E2's camera system instead of relying on an external cam controller (which has proven to be buggy and unreliable in the past).* -You can parent vehicles to other things so you aren't relying on welds to hold your seat in your plane, fyi :v: *I can't remember, was the E2 Camera extension ever committed to UWSVN?
Good suggestions, but to address a few points: -Engine RPM does fluctuate, in a dive a pilot must adjust the propeller blade pitch to avoid overworking the engine. Steep dives in combat aircraft lead to increase in propeller RPM, but I must admit it should be toned down a bit. -Will add documentation, for now "R" or "Reload" changes view -In the latest code, there is a Taxi yaw strength multiplier. Use that to adjust for your plane. -E2 Cameras are currently only in UWSVN iirc, and TBH I've never used them before. I'll look into that
Yeah, its only in the UWSVN, but its still laggy just like the camera controller. If anyone who knows how to create wire entities has some time, I'd really like to get my clientside camera script converted into one (basically the eyecam from nodex, if you remember that).
[QUOTE=Tibbles!;41976815]Good suggestions, but to address a few points: -Engine RPM does fluctuate, in a dive a pilot must adjust the propeller blade pitch to avoid overworking the engine. Steep dives in combat aircraft lead to increase in propeller RPM, but I must admit it should be toned down a bit. -Will add documentation, for now "R" or "Reload" changes view -In the latest code, there is a Taxi yaw strength multiplier. Use that to adjust for your plane. -E2 Cameras are currently only in UWSVN iirc, and TBH I've never used them before. I'll look into that[/QUOTE] Ahh, gotcha. As far as the engine RPM fluctuations I was mentioning, I've never seen/experienced engines stalling due to low craft speed. That was mostly what I was talking about, is that the engine has enough torque to spin the propeller up to maximum speed even at a standstill. It has to do with the way aircraft propellers work in that they don't create a lot of air pressure, even though they displace a lot of air. I was just surprised that, when on the ground and stationary, full throttle wouldn't make the engine sound pitch up.
Just wanted to report that the code in OP doesn't work at all.
Not sure if this thread is still active and if sir tibbles still reads posts on this thread. the chip works fine but theres something wrong with the cam controller part. lol Whenever i go in the seat, the controls work, but my view is just like the view of crap looking through the hole. if you know what i mean. Straight down
Hi Tibbles! Ive been a fan of your work for a while now. Theyre so intricate and amazing. I have a problem. When i Copy-Pasted this code into Notepad , saved the Doc, and put it in my E2 folder for gmod (this method of course because you cant copy paste all the text into E2). I came onto a build server and ran into Two Problems. One was at line 172, I beleive, and the other farther down (i forget which line). This rendered the code USELESS until you delete those two lines. It worked after they were deleted. Now very well though. The plane's control are extensively hard to use, and the acceleration and overall, everything else, has just gone with those two lines. Plx Halp. Thanks again, Pixel.
DOn't Mind my last post, fixed that in 10 mins with a friend. Just wondering (I'm probably no looking hard enought, but then again im not good with E2 so...) where would i rid of this "130 MPH Top speed" BS. Im trying to make the SR71 and im pretty sure 131 mph was just a [I]teeny tiny[/I] less than it's cruising speed
Except anything beyond that speed is pointless because you'll just crash into the edges of the map in two seconds.
Camera movement is very very choppy in multiplayer, any idea why? [highlight](User was banned for this post ("Maybe because it hasn't been updated in four years/contentless bump" - Sgt Doom))[/highlight]
i have problems with the cam controller, its so laggy.
This is a four year old thread.
I know this is an old thread and I might not get a reply, but I am having trouble with getting the e2 to work. If there are any video tutorials on how to get the e2 to work, that would be very helpful to me.
Sorry, you need to Log In to post a reply to this thread.