Game Development Community

Flying Vehicle Class

by Tim Heldna · in Torque Game Engine · 04/22/2005 (12:08 am) · 45 replies

Don't know how successful i'm going to be but here's what i plan to do...

We need helicopters in our game, and the stock vehicle classes in torque don't meet our requirements for this.
We do not want ultra realistic helicopter flight control like in battlefield 1942. What we want is something like ut2004 onslaught mode. If you haven't played this basically it works like this. You mount a flying vehicle, if you want to move up you press 'space'. If you want to move down you press 'shift'. If you want to move forward you press 'w', left 'a', right 'd', backwards 's'. All the mouse does is let you shoot and rotate 360 degrees on the spot.

To get a better understanding of the control we're trying to achieve play beaver patrol and get the jetpack. The only difference being in our control you will be able to hover in the air wihout dropping.

Once this is finished we plan to release a resource that will add a basic helicopter flying class to Torque. We will include a fully working helicopter model with all textures, sounds and particle effects for you to test in your game.

Before we do this we just wanna know if this would be something people are intersted in. If so expect to see the resource by mid next week.
Page «Previous 1 2 3 Last »
#1
04/22/2005 (12:15 am)
Sounds pretty rad. I'm interested in all new resources. Good luck with this.
#2
04/22/2005 (3:02 am)
I'm also interested in porting the flying vehicle class to a new "chopper" class.

After some digging in the forums I have found two main lines of thought :

The first is to tweak (i guess) the update::forces section of the class;

I know that Brett Fattori did an awesome work in this direction and you can find some useful tip in this post
www.garagegames.com/mg/forums/result.thread.php?qt=18434

Another way I guessed is to transform the generic vehicle class transforming the msteering member from F32 to Point3f.

Here is a post from James Lupiani that shows how to perform that

www.garagegames.com/mg/forums/result.thread.php?qt=8282

If you will manage to create a new class I hope you will let the community look into your code :)

Hope it helps.
#3
04/22/2005 (6:12 am)
Thanks for the support, i'm devoting my whole weekend to getting this working. Progress so far is slow but steady, i'll post exactly what i've done in a couple of days.
Rest assured if i'm successful this will definately be shared amongst the Garage Games community.
Back to it now...
#4
04/22/2005 (8:46 am)
Have you tried using the HoverVehicle Class instead ?
#5
04/22/2005 (9:14 am)
With such constrained movement, why use the vehicle class at all? It seems that what you're doing is making an object that can also move in the Z axis instead of just X and Y. Vehicle has a lot of overhead, what with the physics that have to be calculated.

The HeliVehicleClass that I wrote was a simple implementation, but was very true to the flight model of a chopper. Simplifying it really meant turning a lot of the physics off. A helicopter isn't really a helicopter unless it has drag and lift, torque induced onto the tail from the main rotor.

Just my 2 cents. Good luck with it.
- Brett
#6
04/22/2005 (10:21 am)
@Brett

I'm only interested in the vehicle class for one thing and i probably won't even end up doing this but this is what a friend and i had planned.

Use the information from the wheeled vehicle class and use it to spin the rotors as an alternative to using animated bitmaps.
You are completely correct in your statement regarding the z axis, and like i mentioned in my first post (for our game) we're not interested in realistic physics. We just need a helicopter that is easy to fly and fun to use but with the ability to go vertically up and down and to be able to hover with ease.

Any chance you could share some secrets from your heliVehicleClass, even just some basics to get myself and others started in the right direction?
#7
04/22/2005 (10:36 am)
Add another person to the interested list.

@ Brett, did you base your new class off of any of the existing vehicles classes? or was it built from the ground up? Thanks for any tips.
#8
04/23/2005 (11:26 am)
Hello all,

If you're still following this thread here's what i've managed to do thus far...(I should mention i'm very new to programming so for me this task has proved extremely difficult)

Well i used the standard flyingVehicle class as my basis and reworked it to suit my newly created HeliVehicleClass. The results have been pretty positive.

I now have a vehicle that can:

-Move vertically up and down at the press of a button (I have assigned one button to increase throttle which raises the vehicle vertically in the air and one button that decreases throttle which brings you back down again. Once in the air you can release all buttons and you will continue to hover on the spot, no further input required from player to maintain hover. Oh yeah and with incremental throttle control)

-Move forward or backward (When you move in either direction the pitch of the vehicle lowers or raises accordingly)

-Rotate 360 degrees on the spot by using the mouse

-Bank left or right

The overall controll is quite smooth and the vehicle is easy to fly. That's what i wanted. You can change most parameters via a *.cs script file in the same way you can for the standard Torque Vehicle Classes. I made my adjustments to give a predictable easy flying helicopter but you can mess with these settings to get a more challenging experience.

My next goal is getting all the sounds, particles, lights, animations etc etc working nicely. And most importantly the rotor animation.

As i mentioned above i'm not a skilled programmer but i think i've come up with something that's definately useful and useable. I will share my work in a few days time as promised earlier, im just waiting for everything to be finished and polished to my satisfaction. My hope is that others (more skilled in programming than myself, which isn't hard) will improve on this and turn it into a valuable resource.
It sucks there isn't a helicopter resource currently available and i hope this gets the ball rolling.

@Brett Fattori
I found a forum thread regarding rotor animation where you had included a video to demonstrate your mehod of this. When i watched the video i was damn impressed. That helicopter looked liked it would be real fun to fly and all the other effects like lights, sounds, particles etc were spot on. So why am i blowing sunshine up your arse? Well...just a question. If you're not willing to part with your HeliVehicleClass in the form of a free resource, which i fully understand, would you be willing to sell it?
What i've done will work fine for our game cos helicopters only play a small part, but for future projects i wouldn't mind getting my hands on your code. Let me know what you think.
#9
04/23/2005 (3:41 pm)
@Tim

I can't wait to see your code in action :) !
#10
04/23/2005 (3:56 pm)
It would be good to see a helicopter code resource or helicopter pack on GG... it's something I would buy (really need one for my next project)
#11
04/23/2005 (5:05 pm)
I'm having a go at this too.
#12
04/24/2005 (1:02 am)
Good to see other people are interested in this too :) Let me know how you go Adam, i'd be happy to share information with you. I've almost finished my heliVehicle class and it's really not that bad. It's got a good blend between being easy to control and at the same time requiring some skill to keep in control but without being frustrating or annoying. Hmmm, that last sentence could have been worded better but i'm sure you know what i mean.

The only problem i'm having, and it's only minor, is when you land and dismount the helicopter tends not to come to a complete stop. It doesn't go spastic or anything it just kind of very slowly moves forward until either it hits something or you give it a nudge with the player. This seems to be inherent in the flyingVehicle class though as i've noticed it before.

What i'm considering doing is assigning a button that will apply a brake that will bring the vehicle to a complete stop. It's a pretty dirty fix but it's all i can think of. If this works i'll just have a button used exclusively for the purpose of landing, when you land you must press this button to bring the helicopter to a complete stop. I'll make it so it's like an ignition key. IE you press this button to turn the engine of, which will stop all sounds, stop all animations and bring the helicopter to a stop. If i can i'll make it so this button will only work when close to the ground so you can't just turn the engine off in mid flight.

If anyone has any ideas or better suggestions don't be shy. Like i said i'll post what i've done as a resource and hopefully others will tweak my code and bring it into the realms of perfection. Who knows, as a community we might get something worthy of making the next head so everyone can enjoy helicopters as a standard Torque function :)
#13
04/24/2005 (12:30 pm)
Update:

Ok just finished the physics side of things. Made heaps of adjustments and it's turned out pretty well i think. As far as the problem of the vehicle still moving after landing i've improved it alot but it's still not 100%. Although now when you land, if you straighten everything up with the mouse before you dismount it wont go anywhere.

@Adam Surplice

Took a look at your plan and it brought a smile to my dial. I haven't even looked into the rotor animations yet and i can't wait to see what you achieve. Good luck with everything!

@Zach Gipson

Thanks for the good wishes

@Stefano Grippa

Let everyone know if you make any progress with your code

@Bruno Grieco

Didn't want to use the HoverVehicle Class, won't go into reasons why
#14
04/24/2005 (2:50 pm)
@Tim

I'm working quick and dirty :)
Hope to have something to test tomorrow afternoon or so (since I'm not a shaper I'm tryng to use only a flying box). I'll let you know if I'm succeding....
#15
04/24/2005 (4:59 pm)
@Tim
Yep, we're attacking the problem from different ends :) Drop me an email adamsurplice at gmail dot com.

I used wheeledvehicle as a base, so the rotors are animated in a similar way to wheels/tires. With my model, everything is driven by a throttle, which can set as a percentage. Over time the engine RPM will speed up/slow down to achieve that setting, and the rotors spin in proportion to the engine RPM according to their own gear ratios. For game purposes, you could set the throttle to 100% when a player enters the vehicle, and zero when they exit, which would give you the expected wind-up & wind-down effect (affecting audio/visuals as well as flight physics).

It's probably basic stuff for a programmer but it's been an excellent project to learn about Torque, modelling, and C++ all of which I'm new to. I do plan to release it as a resource.
#16
04/24/2005 (5:30 pm)
This thread advanced a lot since the last time I was in here.

@Tim: The helivehicle class I made is currently being evaluated as a resource to potentially be sold. We're looking at the ways to simplify the control scheme for people who don't get 6-axis flight. I fly R/C choppers, so it comes easily to me but other just cock their heads and go "wha?" It'll prolly be a bit since I'm also actively developing dRacer with Bravetree right now.

@Adam: You and Tim should work together on this. Even though you're both moving from different sides at the same problem, you could benefit from a generating a common, simple control scheme.

- Brett
#17
04/24/2005 (5:44 pm)
Hey Brett I've done a lot of R/C chopper flying myself (more with planes though). I love Battlefield 1942's mod -'Desert Combat' just because the helicopter flying physics are dead on! I really hope someone could offer a code pack that offers a bit more realism and not the elevator physics. But, I agree probably only a small audience that wants to take time to learn to fly? I'm also an advanced Hang Glider pilot and would seriously think about a Hang Sim game if the areo physic's stuff gets worked out.
#18
04/25/2005 (1:00 am)
@ Adam Surplice

Quote:
I used wheeledvehicle as a base, so the rotors are animated in a similar way to wheels/tires.

I had the exact same idea, i think i mentioned it above in a previous post. Although i haven't starting work on this yet, i got the idea from this resource here www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7405
This resource is basically a plane with wheels, that can turn, for the purpose of taking off and landing. I don't think it would be that hard to rig it so insead of wheels you have rotors.

I'll send you an email tomorrow with my physics code so you can test it and tell me what you think.

@Brett Fattori

Very pleased to hear you're planning on releasing your work as an item that may be purchased. Although you better hurry cos if Adam and i team up we're probably gonna come up with something just as good and we're giving it away for free! :) Only joking, i know i'd definately buy your helicopter code cos from looking at that video you released it was pretty impressive.

Off the topic, are you planning on releasing a 1.3 patch for your stencil shadow resource? I tried putting it in manually, got about 3/4 of the way through, and discovered that the file gl_func.h no longer exists in Torque 1.3.
#19
04/25/2005 (7:39 am)
@Tim: The stencil shadow implementation was hacked in when I had very little knowledge of the engine. Many changes have taken place since I first released it and it's a beast to work with. I've thought that in my spare time I might do an update, but don't hold your breath as I have very little "spare time".

- Brett
#20
04/25/2005 (2:45 pm)
Brett, I'm looking forward to your heli pack too... having discovered that I'm really only about 20% of the way there.
I'm starting to understand torque's collision mechanism, and why a a collision box won't cut it for ground interaction. Fortunately, there's no need to reinvent the wheel(edvehicle.cc) :)
Page «Previous 1 2 3 Last »