project-navigation
Personal tools

Author Topic: Firing from behind cover  (Read 8136 times)

Marsu

  • Guest
Firing from behind cover
« on: May 01, 2008, 08:42:18 pm »
While playing it happened a few times that my soldier could see an alien over the wall he was standing behind (it was about chest-height) but he couldn't fire at it. Seems he was to weak to lift his rifle to his shoulder ;)

I propose that it should be possible to stay behind certain cover and still fire over it(maybe only while standing). It would also make sense that the hit probability should be as high as it would be while crouching, because the rifle can be stabilized on top of the cover while firing.
I never fired a gun in my life, so correct me if I am wrong  ::)

Addendum:
It should be possible to fire over crouched companions, too. But without the aiming-bonus of course, most people dislike being used as a tripod ;)
« Last Edit: May 01, 2008, 08:59:08 pm by Marsu »

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Firing from behind cover
« Reply #1 on: May 01, 2008, 09:27:07 pm »
As always, patches are welcome.

Marsu

  • Guest
Re: Firing from behind cover
« Reply #2 on: May 01, 2008, 09:40:49 pm »
I thought this was the "Bugs&Feature Request" section, not the "Volunteer for work"-section ;)

As my coding skills are rather limited and I am soon starting my internship, I don't think I will be of any help there, sorry.

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Re: Firing from behind cover
« Reply #3 on: May 01, 2008, 09:55:35 pm »
this has been suggested before. i agree it would be an improvement.

we need help, though.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Firing from behind cover
« Reply #4 on: May 01, 2008, 10:10:56 pm »
As I've said in another thread, I don't think anything like this is possible without overcomplicating the controls and radically changing the game mechanics and/or map format. How would you determine how exactly to move the weapon so it could hit the enemy? How would you incorporate it into the GUI? Who would add the necessary model animations?

It's tangible issues like these that really matter from the development point of view. That's why you get reactions like the one in my earlier post - it's easy to request a feature, but it's not so easy to implement one. If you really want to see something happen, you're going to have to make an effort.

Marsu

  • Guest
Re: Firing from behind cover
« Reply #5 on: May 02, 2008, 12:36:38 am »
Well, the basic implementation would be simply: If I can see over it, I can fire over it. No special bonus or anything. Because seeing an enemy over a wall but not being able to shoot at him is frustrating and also puts a big dent into the illusion of realism.

I know that all these things are probably not easy to implement and these requests can get annoying. I am a comp-sci student at the moment and have dabbled in coding for years (still not any good at it though :( ).
But if you don't want Feature Requests, you shouldn't open a forum for it...

Maybe I will try coding something myself at some point, but I never coded something this complex. (also, those idiots in the university decided that we should learn java instead of something useful...)

courier

  • Guest
Re: Firing from behind cover
« Reply #6 on: May 02, 2008, 01:07:11 am »
Marsu --

I'm new here, but here's my understanding from the code.  The difficulty here is that the firing is done within the 3d engine -- while this may look like a board game, the game internals are a full 3D game (a modification of Quake2).  That means that bullets and lines of sight connect specific 3space points to one another.

So "shooting over" something actually means raising the origin point of the shot -- but only if there's a shoot-overable object in front.  That in turn means a new model animation (to raise the gun high enough to get over the object in front), new map properties (to contain the "is X shoot-overable" information), and so forth.  Worse, in order to calculate cover and visibility the game performs some basic ray-traces from the gun to various points on the target.  So to add shoot-over trajectories would require doing calculations from both the lower and higher firing positions.  That means not merely double the calculations on every move of the mouse during aiming, but also double the calculations for, eg, aliens trying to determine if they're safely covered, reaction-fire checks, and so forth.  Add in crouching, and there's just a whole lot of trouble here.

It's a sensible and in some ways desirable feature, but may be (like the ever-popular destructible terrain) simply be beyond what's practical with the code we have.  Still, definitely one to keep in mind going forward -- I think most of us at one point or another have tried to fire a rocket from behind cover and blown ourselves up.

If you do decide to look into the problem (or just poke around in the code for fun), the place to start is in src/game/g_combat.c -- the argument "at" to various functions is the location of the gun muzzle -- and the G_ActorVis function in src/game/g_client.c.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Firing from behind cover
« Reply #7 on: May 02, 2008, 02:54:16 am »
Well, making the line of fire (mostly) the same as the line of sight is something that's certainly possible, and also desirable. I daresay that's going to happen at some point. But when you talk about actually putting the gun on top of ledges, through holes or around corners, that's a whole different story. That would mean the character has to somehow "know" things about his environment, and at present they simply don't. They just blindly follow orders, and it's up to the player to make sense out of the terrain. Making use of the environment and putting weapons on windowsills sounds great, but it's far from trivial from the perspective of the game code.

knightsubzero

  • Guest
Re: Firing from behind cover
« Reply #8 on: May 02, 2008, 05:16:27 am »
basically that is the way that i see would be best, if you can see it essentially you can shoot it, resting or deploying or shooting thru holes would be nice, but not nessesary.

any terrain would potentially get in the way of the shot, particularly if the terrain is close to the target, but something directly infront of you should not get in the way of the shot (something that you can see over that is).

at it is now, it seems the aliens can shoot you no matter what the terrain, but you get stopped by having a rail infront of you or a rock.


Offline Doctor J

  • Squad Leader
  • ****
  • Posts: 265
    • View Profile
Re: Firing from behind cover
« Reply #9 on: May 10, 2008, 10:09:47 am »
As I've said in another thread, I don't think anything like this is possible without overcomplicating the controls and radically changing the game mechanics and/or map format.

Huh?  You already have the mechanics for line of sight - just use it for line of fire.  Shooting from the hip should only be used for Snap Shots.

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Re: Firing from behind cover
« Reply #10 on: May 10, 2008, 11:59:32 am »
I do not think the minigun\chaingun wouls be raised to eye height to fire. We would need extra animations (as BTAxis said).

It is not a trivial change.

Offline Doctor J

  • Squad Leader
  • ****
  • Posts: 265
    • View Profile
Re: Firing from behind cover
« Reply #11 on: May 16, 2008, 05:27:12 pm »
I do not think the minigun\chaingun wouls be raised to eye height to fire.

It is totally cartoonish for such a thing to even be carried by an individual, don't go getting all realistic on us now!  Check out the weight stats for the only version built that didn't require a vehicle/craft to carry it: http://en.wikipedia.org/wiki/XM214_Microgun.  P.S. Even though it was man-portable [a team of men], it was still required to be placed on the tripod before firing.  So yes, you're right: it couldn't be raised to eye height, as the gunner would normally be in the prone position to fire.  Or just leave it out of the game.

As to the extra animations, that's prettiness as opposed to a won't-work-without-it type thing.  IMHO, an unanimated aimed shot is better than having the back of a chair block all shots...  And adding animations is still less work than completely rewriting the firing code to try to detect where the muzzle is!

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Firing from behind cover
« Reply #12 on: May 16, 2008, 05:31:47 pm »
Note that the minigun is not actually in the singleplayer game.

Jagger

  • Guest
Re: Firing from behind cover
« Reply #13 on: May 17, 2008, 08:49:18 am »
Onle reasonable way to do this (That I see) is to ignore the fact of where the gun is shown, and modify the code to have bullets mysteriously shoot from your eyes instead. It wouldn't look as nice, and some people would complain, which way do people think majorit would prefer (Poll tiem?)

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Firing from behind cover
« Reply #14 on: May 17, 2008, 11:30:58 am »
I feel called upon to once again point out that UFO:AI is not developed democratically. What the majority thinks is irrelevant to a large degree.