aliens

Author Topic: Sound of hidden movement  (Read 11881 times)

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Sound of hidden movement
« on: December 10, 2017, 06:33:20 pm »
How does it work? Currently doors and gunshots are heard, but footsteps are not. I noticed that I can't hear enemy tanks in "The X-COM Files" mod, tried to experiment and concluded that tank engines are only heard if the tank starts moving where an operative can see it.

Is there any way to make loud units always audible? Or maybe this should apply to all units?

P.S. Same for vanilla nightly and OXCE+.
« Last Edit: December 10, 2017, 06:35:10 pm by tkzv »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Sound of hidden movement
« Reply #1 on: December 10, 2017, 08:44:12 pm »
How does it work? Currently doors and gunshots are heard, but footsteps are not. I noticed that I can't hear enemy tanks in "The X-COM Files" mod, tried to experiment and concluded that tank engines are only heard if the tank starts moving where an operative can see it.

If you hear the footsteps before you see the unit then on the first turn you'll be able to recognize which types of aliens are present on the mission, without even seeing them. Which increases the drama and suspense.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: Sound of hidden movement
« Reply #2 on: December 10, 2017, 10:27:18 pm »
If you hear the footsteps before you see the unit then on the first turn you'll be able to recognize which types of aliens are present on the mission, without even seeing them. Which increases the drama and suspense.
Yes, that's how it should work. But it doesn't.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Sound of hidden movement
« Reply #3 on: December 11, 2017, 02:08:59 am »
not really, we don't animate what you can't see. those aliens are moving at supersonic speeds when not in view. sounds would overlap each other, and it would be a terrifying cacophony.

Offline 7Saturn

  • Colonel
  • ****
  • Posts: 457
    • View Profile
Re: Sound of hidden movement
« Reply #4 on: December 11, 2017, 10:54:31 am »
Except of course certain attack sounds, that slip through the fog of war.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: Sound of hidden movement
« Reply #5 on: December 11, 2017, 10:56:37 am »
not really, we don't animate what you can't see. those aliens are moving at supersonic speeds when not in view. sounds would overlap each other, and it would be a terrifying cacophony.
Then why does hidden movement take so long?

I liked how the sound was done in Apocalypse, by the way.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Sound of hidden movement
« Reply #6 on: December 11, 2017, 12:22:30 pm »
sounds would overlap each other, and it would be a terrifying cacophony.
I wish I could toggle this on, just to see what it sounds like.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Sound of hidden movement
« Reply #7 on: December 11, 2017, 12:26:59 pm »
Then why does hidden movement take so long?

I liked how the sound was done in Apocalypse, by the way.

the majority of the time taken during the alien turn is used calculating courses of action

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Sound of hidden movement
« Reply #8 on: December 11, 2017, 02:15:05 pm »
the majority of the time taken during the alien turn is used calculating courses of action

I'd imagine most of it is updating/recalculating vision as AI units move?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Sound of hidden movement
« Reply #9 on: December 12, 2017, 01:23:00 am »
I'd imagine most of it is updating/recalculating vision as AI units move?
that too, pathfinding happens between actions, FoV calculations take place during movement, there are a hell of a lot of CPU cycles used on the alien turn between the two.
when the AI calculates paths, it calculates ALL of the paths using Dijkstra's algorithm before using A* to define specific paths to various "points of interest".

i could go into a lot more detail, so i will:
every time the AI plans an action, it tries to create four possible scenarios: patrolling to a node, attacking an enemy, escaping from an enemy, or setting up an ambush, and then picks the one it prefers based on the situation.

The first option is fairly straightforward, if you have a defined node you want to go towards, simply find a path towards it, if you DON'T have a node defined, check through the list of nodes connected to the last node you visited and pick one based on preference, then check it can be pathed to, if not, pick again. if no options are valid, or if you're a scout, start picking nodes at random and pathing to them until you pick one you can reach. at this point, if all has gone well, patrol becomes a valid option.

the second option is less straightforward: first, take stock of the weapons you have available. if you have a melee weapon, pick the closest enemy you know about and try to path to any tile that's within melee range of them. if you have a firearm, we start to get into bat country: based on where your target is, we calculate a bunch of tiles from which a unit of your height could potentially get a shot off using a hypothetical unit to perform LoF calculations, checking to make sure you can actually path to said locations. at this point, if all has gone well, attacking is a viable option.

if you're escaping, you do something similar, only you're tracing the LoF from your enemy to a bunch of tiles that hypothetically contain a unit of your height, that you are capable of pathing to in order to find somewhere that you can move and they can't hit. if this works out escape is an option.

if you're setting up an ambush... both you and your enemy become hypothetical. you start by calculating a path from your enemy to your current position, and calculate LoF from a bunch of tiles from which a hypothetical unit of your height could shoot a hypothetical unit of your enemy's height hypothetically walking along said path, and then calculate paths to those positions that leave you enough TUs to make a reaction shot. if you find a match, ambush is on the table.

after calculating all this, you take your situation into consideration (desperation, morale, injury level, etc.) and choose a preferred option. do this all around 6 times per turn (sometimes more, sometimes less)

when you see an alien moving, the pathfinding is already done, and we can calculate the FoV between frame updates (i believe between frames 4 and 5) but when you don't see it, we simply update the unit's position and calculate the FoV every frame. you can observe this same effect by moving one of your own units that is offscreen, you'd expect him to take 10-15 seconds to appear on screen if he were walking at a normal pace, but instead they'll pop into frame after only 1 or 2.
« Last Edit: December 17, 2017, 06:18:49 am by Warboy1982 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Sound of hidden movement
« Reply #10 on: December 12, 2017, 04:50:17 pm »
It's an awesome explanation, Warboy. Should be put somewhere visible. :)

Offline 7Saturn

  • Colonel
  • ****
  • Posts: 457
    • View Profile
Re: Sound of hidden movement
« Reply #11 on: December 12, 2017, 04:57:28 pm »
How about the ufopedia wiki?

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Sound of hidden movement
« Reply #12 on: December 15, 2017, 12:09:30 am »
It should go in the UFOPaedia wiki under Enemy Unknown (1994) > Technical Information > Game Mechanics > AI Unit Scripting (or a better name)

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Sound of hidden movement
« Reply #13 on: December 15, 2017, 07:59:59 am »
hah, and to think i deliberately omitted a whole bunch of details i deemed "a bit too spoilery"

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Sound of hidden movement
« Reply #14 on: December 15, 2017, 11:26:17 am »
I don't see these details as spoilers at all. Anyone taking the time to read and actually understand this is way past the spoiler stage. It's not like you can post a detailed explanation of how aliens seek targets and have someone feel like their game is ruined because they can suddenly predict the aliens' movements. More likely they won't really truly understand it and the aliens will continue to surprise them about as much as before.

It's interesting for modders because it can help us understand what effects our changes will have. When we're denied information about the way the game works, it can make it hard to figure out what actual changes our mods make.