project-navigation
Personal tools

Author Topic: [SUGGESTION] Reaction fire automatic weapons behavior  (Read 15927 times)

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #15 on: March 22, 2010, 01:14:41 pm »
Thanks to Duke, the crash is gone.
Im now working on correcting a TU bug, and tweaking a few things. A .diff should be made available in the next 10 hours.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #16 on: March 22, 2010, 09:02:37 pm »
Here's the .diff file.

But first, some reading :

Context notes :
- I started editing UFO AI source to test personnal gameplay ideas and tweaks a few things to my taste. So the modifications arent limited to a new Reaction Fire mode (see below).
- Im not familiar with the project structure and some modifications might be out of place.
- The modifications could break game balance (not sure if really sensible), and probably differs from UFO:AI creator's vision.
- The modifications most certainly arent compatible with multiplayer games (stuning does not apply to aliens, mobility for multiplayer weapons are not set, im pretty sure some network code is missing).
- I like well enclosed things. i will use { } for even the simplest "if", and over parenthesis maths things.
- Ive added "(yatta)" in most comments so if something breaks arrounds those comments, you know you can blame me.
- I used lots of "gi.BroadcastPrintf(PRINT_CONSOLE ..." for debugging, so you'll find quite a few, commented out.
- Novice coding errors or complexity is to be expected.
- No difference between the two RF modes.



WTF ?!
This might be your reaction in some situations, where soldiers start shooting altough you didnt give them the order.
What happens is the following : you have soldiers ON RF. One of them moves, trigerring an alien RF, but as the alien start aiming/shooting, one of your other soldier, who had the alien well spotted already, start shooting too. Follows a quick gun fight for the burst duration. Yes two burst can be fired at the same time.



What it does :
- Changed Reaction Fire behavior. RF now depends on character's mind (mainly) and speed. Other factors included : target's speed, position and activity, weapon mobility ...
- Point survey : When you right-click with the mouse to make your soldier face a direction, you now also register an "Aim Point" : if an enemy enters that point, your soldier has a bonus to trigger its reaction fire. Very good to guard doors & building corners.
- Changed burst fire system. Your soldier wont discharge the full burst at one point when RF shooting at a moving enemy, but rather will shoot while the enemy move.
- Added critical hits : depending on the type of weapons, you can inflict more damage, or do special effect sur has making fall (well, sit), lose weapon, stun (except aliens), panic, ...
- Stun on hard hits : your soldiers might faint when badly hit. Bad : you have one less active soldier on the field. Good : he can be healed at the hospital. A little chance to keep good soldiers alive, and makes accepting combat losses easier.
- Tried to tweak camera travels during shoots to gain time and lose sickness. Not so successful.
- Dazed (flashbang grenade) now makes the actor start with half the TU on next round
- Actors loses a few TU when hit.



Precise changes in the files :
Code: [Select]
weapons ufo files : added 'mobility' parameter
cl_actor : added message writing PA_POINT when orienting a soldier with mouse
e_time : barbaricly tried to reduce camera travels delay
e_event_actormove : ActorDoMove returns on actor death
e_event_actorstartshoot : changed cameraroute to reduce camera travels in ActorStartShoot
scripts : added the mobility parameter for weapon defs
g_actor : RF modes reserves no TU, dazed unit start round with half TU, barbaric return on ActorInvMove to handle (in case of weapon drop/destruction by RF), changed how TU are handled at some points, added func g_ActorUseTU needed for RF
g_client : when reseting time units, reset a param for RF, modified how TU are used, added message PA_POINT handling (for aiming point)
g_combat : added critical hits & effects (can be turned off by setting the COMBAT_CRITICAL_FACTOR to 0, critical effects table depending on weapons damage type, stun chance on hard hits (for humans only to avoid easy capture of live alien), TU loss on hit, modified ShootSingle to add inaccuracy on RF, removed obsolete RF functions, modified ClientShoot to handle new RF and new management of bursts
g_local : added / removed stuff for new RF
g_main : remove of prototype of obsolete RF functions
g_match : made uncouncious-yet-alive soldiers have low health after a mission (so they HAVE to be healed before next mission
g_move : added a default AimAt point when moving soldiers, flag IsMoving for ents to manage RF accuracy
g_reaction : well ... mostly rewritten / changed
g_round : removed a call to an obsolete RF function
game_h : added an array to manage awareness of actors
inv_shared : added 'mobility' parameter
q_shared : added 'PA_POINT' message for AimAts
« Last Edit: March 22, 2010, 09:06:18 pm by Yatta »

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #17 on: March 22, 2010, 09:13:19 pm »
Point survey is interesting. Me and my brother actually did something similar in our homebrew rules for the board game Space Crusade. You could choose to concentrate your overwatch on two adjacent squares in your LOF, giving you a bonus to the overwatch roll, or you could choose to overwatch everywhere in your LOF, but not both.

For proper incorporation in UFO:AI, it would need some visual representation.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #18 on: March 22, 2010, 09:57:32 pm »
Yes, it does need a visual clue that your soldier is watching a point. Adding visuals on the battlefield should be one of the next things ill explore.

Offline Duke

  • Administrator
  • PHALANX veteran
  • *****
  • Posts: 1037
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #19 on: March 22, 2010, 11:04:09 pm »
I scrolled through the patch once.

1. Not bad for a 'C-novice' :) It certainly needs quite some tweaking, but I bet you will easily accomplish that after a few hints and examples.
2. As the code is not just an add-on but instead replaces quite a lot of existing code, the main task will be to consider the sideeffects, ie. if it can break anything that you didn't even know exists.
3. The patch covers a bunch of features and is by far too big to be applied at once, so it must be split to one patch per feature or even more. Easy to do.

@BTAxis:
Before asking yatta to rework and split his patch, we need the game designer's decision which features to implement. I'm just a stupid coder (TM).

@Yatta:
I saw you even fixed typos in comments :) If you extract them from your big patch, I will certainly commit them.
If you don't know how to extract them, plz ask in advance.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #20 on: March 23, 2010, 01:27:29 am »
Aha, yes, the typos, sometimes the urge to correct them is too big  ::)

1. Thanks for the compliment !  ;D
2. Side effects is what I fear, I did had to use some thing I didnt understand fully, and while coding I was never really sure where was the line between server and client ...
3. Ill be waiting for instructions on what/if a part is to be kept, to clean it up and give the patch.

IME, here's my personnal tought of that experimentation so far :
- I like having my soldiers efficiently covers each other. Altough AI cant set AimAt points, they are also more efficient with reaction fire. I end up paying far more attention to covering, line of sight, and planning strategic moves, and I like it. But it might not please other players.:
- Soldiers sometimes fainting when hit hard : kinda like it - the "pheww, he's not dead" feeling. A chance to keep your precious ones.
- Critical : Im not sure. On one side, I dont think it changes anything on the combat, on the other side, it adds little unexpected things, that can slightly reduce monotony (especially the weapon loss and other special effects - plus I like the idea that once you buy/produce a weapon, its not 'immortal' anymore). Could be more focused on this 'unexpected' part than 'critical damage' maybe.
- RF on your own turn : some might say disturbing for some, id rather say surprising (once again, a little less monotonous). To me it feels like the soldiers have some initiative of their own, making you feel less 'alone' in the fight.
- bullet-per-bullet burst reaction fire system : I definitely prefer the song "Singing In the Rain" to "someone suddendly thrown a bucket of water at me".

I hope project game designers will be interested in this, as I have quite a few other tweaks in my mind.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #21 on: March 23, 2010, 08:12:35 am »
wow - big patch.. thanks.

but (sorry, there is always a but from my side ;) )... watch out the coding guidelines. you make our all life harder by applying your own style. see the wiki for the coding guidelines or just browse the code to see how the code is written.

i will have a look at this patch once i find the time.

but splitting it into smaller pieces would be nice. one for typos, one for reaction fire, one for the mobility and so on.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #22 on: March 23, 2010, 10:05:45 am »
Point survey is interesting.

Agreed.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #24 on: March 26, 2010, 07:44:48 am »
it would be cool if you could extract the point survey patch as a small "point-survey-only" patch.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #25 on: March 26, 2010, 08:03:44 am »
this is a quick start - but the relevant parts are still missing.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #26 on: March 26, 2010, 01:04:45 pm »
The point survey system is built on the new reaction fire system. Since ive mostly rewritten the whole thing, im not sure how to include point survey on the regular RF structure. However i suppose it would be rather easy to do, you just have to register the point at the time you make a soldier face, and then give a bonus for reaction fire when enemies are close to that point.

But there might be a problem : if i got it right, on the normal RF, when an enemy actor moves, and one of your soldier can see him and has RF on, he will get that enemy as his RF target (does not mean he'll fire), and wont change until next turn. Which means if another enemy moves, even on the survey point, he will be ignored as a target is already acquired.

To check for this search for something like ent->reactionTarget or such.

btw, anyone tried the patch ?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #27 on: March 26, 2010, 05:34:30 pm »
i tried it - but only a few minutes until it crashed. there was an error in some vec2_t and after that vec[0] = ..., vec[1] = ..., vec[2] = ... somewhere, i can't remember where exactly. but it was a change in your patch, so it should be easy to find for you. if you would clean that patch up, put some more stuff into the scripts, watch out the coding guidelines, this could maybe be integrated into our svn after 2.3.

Offline Yatta

  • Rookie
  • ***
  • Posts: 57
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #28 on: March 27, 2010, 01:31:16 am »
Quote
put some more stuff into the scripts
What do you have in mind ?

Ill check for that crash, and coding guidelines, and try to release a clean -or at least more stable- version.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: [SUGGESTION] Reaction fire automatic weapons behavior
« Reply #29 on: March 27, 2010, 02:13:53 am »
What do you have in mind ?

Aren't you connected yet? Make sure you get infected by XVI! :D

-geever