Author Topic: Hovertank Turret Control  (Read 2259 times)

0 Members and 1 Guest are viewing this topic.

Hovertank Turret Control
While modding using BP2, I noticed that the included Dakota Hovertank could be a pretty interesting ship/tank to control for a few specific mission types. Sadly, when testing I noticed that its biggest cannon was AI-controlled, so I couldn't have WW2-esque tank battles nor shoot down aircraft 'above' the Hovertank by my own hands.

I would like to be able to take control over this turret and aim it like one would in usual tank games, in a full 360 circle at the same Y plane and all the way upwards for anti-aircraft purposes. The more aiming freedom, the better.

To avoid having the tank go and fly up and move around like an aircraft while aiming and firing that turret, the player would likely give up any other control over the tank so that it's either standing still and vulnerable or the AI can take over if the Scripter/FREDer prefers so it fulfills a set path in the meantime. Then, with the press of a hotkey, the player would return to the original 'driver seat' being able to figure the other, forward weapons, with easy switching between 'gunner' and 'driver' seat.

It would be even more interesting if the player could still accelerate and decelerate/go backwards manually though that would be an added bonus, since I'm not sure if that's possible/easy to program.


Also, I made a little recording in a quickly made test map showing what it's like to pilot these without any modification (except increased speed): https://youtu.be/vC1zqSQTd6s
This was done to hopefully make what I mean more visually apparent.

Spoiler:
If this is easily accomplished in FRED2 already, my apologies, in that case the thread can be moved to there instead. I think it requires a bit of extra scripting though.
I'm all about getting the most out of games, so whenever I discover something very strange or push the limits, I upload them here:

http://www.youtube.com/user/JCDentonCZ

-----------------

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress to more pain."
- George Orwell

 
Re: Hovertank Turret Control
In actual tank games, there are independent controls for aiming the gun and driving the vehicle.

In World of Tanks and Armoured Warfare, that's WASD for driving (also R and F for cruise control), and mouselook for aiming.  You get to choose whether you're in a first-person "gunner view" or a third-person "external view", but the controls remain the same in both cases.  You can also "auto-aim" at a target (without lead) by right-clicking on it, and you can look around without moving the turret by holding the right mouse button.

Translating that into Freespace terms, the most obvious controls would be using the joystick to fly (as normal) and mouselook to aim.  Both, however, are devices that most players strongly prefer to use right-handed.  I think you're going to find it very difficult to make this seem natural, regardless of any programming difficulties.

More fundamentally, all terrestrial tanks I'm aware of are at least dual-manned, at minimum a driver and a gunner - the latter being a higher position, also acts as commander and radioman if there's nobody else to do it for him.  The original Renault FT, being the first turreted tank, established this pattern.  A Panzer IV had a typical "large tank" crew of driver, gunner, loader, radioman and commander; some tanks with really big guns had two loaders, one for the shell and one for the propellant.  Some modern tanks have eliminated the loader and/or radioman, due to modern technology simplifying or even automating these tasks.

The point is that driving and gunnery are independent tasks which are difficult to combine in one person.  Tank games manage this by simplifying both tasks considerably.
« Last Edit: October 04, 2016, 12:12:42 am by Chromatix »

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Hovertank Turret Control
Translating that into Freespace terms, the most obvious controls would be using the joystick to fly (as normal) and mouselook to aim.  Both, however, are devices that most players strongly prefer to use right-handed.  I think you're going to find it very difficult to make this seem natural, regardless of any programming difficulties.
And those programming difficulties are nothing to sneeze at; currently, the mouse and joystick assignments overlap (mouse X/Y axes and joystick X/Y axes are assigned together; IIRC left mouse = joystick button 1, right mouse = joystick button 2, etc.). So not only would you have to put in the effort of allowing independent movement and aiming, but then you'd have to decouple the mouse input from the joystick input (which, to be fair, is mostly a problem on the configuration side; the actual inputs are handled separately, they're just conflated by FSO's controls code).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline m!m

  • 211
Re: Hovertank Turret Control
I wrote a script that allows to control a turret. You could adapt the turret code for aiming the turret since that's a little involved since FSO isn't exactly built for this sort of things.

 
Re: Hovertank Turret Control
Thanks for the responses!

Chromatix, good points, if all else fails I can just make sure that in such missions the automatic turret represents a fellow pilot/gunner in the ship.

AdmiralRalwood, thanks for the additions, I suppose there's room to look for alternative solutions? I'm thinking of the example of old PC co op games where two players would use the same keyboard, such as WASD versus something like (i think) IJKL. NUMPAD already being used well for camera and alternate movement, of course.

m!m, thanks for linking and writing the script, didn't know it already existed. I'll start testing with it and see if it fits my requirements well enough for this purpose and adapt where I need (Though I'm not too experienced with coding).

I'll update findings later when I'm able to test it out as well. Meanwhile I'm open for any other suggestions, ideas and attempts at achieving this.
I'm all about getting the most out of games, so whenever I discover something very strange or push the limits, I upload them here:

http://www.youtube.com/user/JCDentonCZ

-----------------

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress to more pain."
- George Orwell