Author Topic: How underwater bullet trajectory works?  (Read 4615 times)

Offline greenscarf

  • Sergeant
  • **
  • Posts: 26
  • hello world
    • View Profile
    • reddit page
How underwater bullet trajectory works?
« on: September 10, 2019, 04:40:49 pm »
In TFTD, projectiles that are fired underwater leaves traces of bubble, or bullet trajectory (couldn't figure out the exact name to call it). I am wondering which part of the ruleset causes it. Also, I'd like to know if the 'trajectory' can be implemented on surface shooting/ xcom 1. I think it would be a great missile smoke trails.

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #1 on: September 10, 2019, 05:19:56 pm »
vaporColor    The color offset (0-15) to use for the vapor trail.    -1
vaporDensity    The vapor cloud density (number of particles) for the vapor trail.    0
vaporProbability    The vapor cloud probability (0-100%) for the vapor trail.

Offline greenscarf

  • Sergeant
  • **
  • Posts: 26
  • hello world
    • View Profile
    • reddit page
Re: How underwater bullet trajectory works?
« Reply #2 on: September 10, 2019, 06:57:27 pm »
Thanks for your information. Also, would there be a way to implement the vapor into xcom 1?

Offline The Martian

  • Commander
  • *****
  • Posts: 507
  • "It implores you to listen to its arguments..."
    • View Profile
Re: How underwater bullet trajectory works?
« Reply #3 on: September 10, 2019, 07:50:09 pm »
would there be a way to implement the vapor into xcom 1?
I've been wondering about that as well.

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #4 on: September 11, 2019, 09:09:20 pm »
I have been experimenting with this at the moment, the game keep crashing.

Okay, here is my research so far, after a few consultation.

The bubble trail will work and replace bulletsprite only at depth greater than zero, so in your terrain rul, you need to have depth greater than zero.

From the TFTD var file you need to copy over the transparencyLUTs to the xcom var file.

I have attempted to implement this on my Sonic weapons, with

vaporColor    
vaporDensity    
vaporProbability

Unfortunately, there is where the crash starts.  Still awaiting consultation from the others. I will post more.. later when I have more replies.

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #5 on: September 12, 2019, 08:57:44 am »
I have been told that’s its sound issues that’s the cause of the crash, yet my code for my sonic weapon works perfectly on the land. All the firing and hit sounds.

Question is, does the weapon uses a different firing sound underwater? If that is the case, is it in the Var. ruls from TFTD which handles all the sounds? Oh well, I will experiment this tonight.

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6996
  • OXCE developer
    • View Profile
    • My Wiki
Re: How underwater bullet trajectory works?
« Reply #6 on: September 12, 2019, 09:54:45 am »
Just look at the log file, if it says something about missing sounds, then it is missing sounds.

Most likely however it is missing transparencyLUTs, which are not moddable yet.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2338
  • Developer
    • View Profile
    • Email
Re: How underwater bullet trajectory works?
« Reply #7 on: September 12, 2019, 01:45:18 pm »
transparencyLUTs are moddable, the problem is he's setting the depth value greater than zero but doesn't have a battle2.cat to pull the audio from (that's my take on it anyway)

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #8 on: September 12, 2019, 03:45:27 pm »
Okay, here are the error logs.

[12-09-2019_22-43-29]   [FATAL]   A fatal error has occurred: Segmentation fault.
[12-09-2019_22-43-29]   [FATAL]   0x588e80 OpenXcom::CrossPlatform::stackTrace(void*)
[12-09-2019_22-43-29]   [FATAL]   0x589cf0 OpenXcom::CrossPlatform::crashDump(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[12-09-2019_22-43-29]   [FATAL]   0x41e830 signalLogger(int)
[12-09-2019_22-43-29]   [FATAL]   0x91aa70 OpenXcom::UfopaediaStartState::think()
[12-09-2019_22-43-29]   [FATAL]   0x7ffa42230ef0 _C_specific_handler
[12-09-2019_22-43-29]   [FATAL]   0x7ffa42244b50 _chkstk
[12-09-2019_22-43-29]   [FATAL]   0x7ffa421bbcc0 RtlWalkFrameChain
[12-09-2019_22-43-29]   [FATAL]   0x7ffa42243b70 KiUserExceptionDispatcher
[12-09-2019_22-43-29]   [FATAL]   0x538680 OpenXcom::Map::drawTerrain(OpenXcom::Surface*)
[12-09-2019_22-43-29]   [FATAL]   0x658d30 OpenXcom::Surface::blit(SDL_Surface*)
[12-09-2019_22-43-29]   [FATAL]   0x657100 OpenXcom::State::blit()
[12-09-2019_22-43-29]   [FATAL]   0x5a1770 OpenXcom::Game::run()
[12-09-2019_22-43-29]   [FATAL]   0x41e990 SDL_main
[12-09-2019_22-43-29]   [FATAL]   0x91c5a0 console_main
[12-09-2019_22-43-29]   [FATAL]   0x91c6c0 WinMain
[12-09-2019_22-43-29]   [FATAL]   ??
[12-09-2019_22-43-29]   [FATAL]   ??
[12-09-2019_22-43-29]   [FATAL]   0x7ffa411b1fd0 BaseThreadInitThunk
[12-09-2019_22-43-29]   [FATAL]   0x7ffa4220ef90 RtlUserThreadStart
[12-09-2019_22-43-37]   [FATAL]   OpenXcom has crashed: Segmentation fault.

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #9 on: September 12, 2019, 03:58:15 pm »
For the sake of testing. I have copy the Sample.cat from TFTD sound folder to UFO Sound folder of and renamed it as Sample4.cat

Here are my var.rul
startingTime:
  second: 0
  minute: 0
  hour: 12
  weekday: 6
  day: 1
  month: 1
  year: 1999
costEngineer: 25000
costScientist: 30000
timePersonnel: 72
initialFunding: 6000
disableUnderwaterSounds: true
alienFuel: [STR_ELERIUM_115, 50]
fontName: Font.dat
#soundDefs:
#  - type: BATTLE2.CAT
#    file: SAMPLE4.CAT
#    soundRanges:
#      - [0, 47]
#      - [99, 117]
#    sounds: [48]
#constants: #done
#  - doorSound: 47
#  - slidingDoorSound: 46
#  - slidingDoorClose: -1
#  - smallExplosion: 30
#  - largeExplosion: 29
#  - itemDrop: 44
#  - itemThrow: 42
#  - itemReload: 45
#  - walkOffset: 0
#  - flyingSound: 66
#  - buttonPress: 0
#  - windowPopup: [1, 1, 1]
#  - ufoFire: 5
#  - ufoHit: 4
#  - ufoExplode: 3
#  - ufoCrash: 2
#  - interceptorHit: 2
#  - interceptorExplode: 2
#  - explosionOffset: 8
#  - smokeOffset: 56
#  - underwaterSmokeOffset: 8
#  - basescapeCursor: 42
#  - graphsCursor: 144
#  - goodDebriefingMusic: GMDEBGOO
#  - badDebriefingMusic: GMDEBPOR
transparencyLUTs: #done
  - colors:
     - [  8,  8, 12, 2 ] # "white"
     - [ 16,  8,  0, 2 ] # orange
     - [  0, 12, 12, 2 ] # cyan
     - [  4, 16,  4, 2 ] # green

For my item.rul I have

  - type: STR_BLASTA_CANNON
    size: 0.3
    costBuy: 1
    costSell: 171600
    weight: 8
    bigSprite: 570
    floorSprite: 570
    handSprite: 381
    bulletSprite: 8
    hitAnimation: 150
    fireSound: 111
    hitSound: 112
    power: 130
    damageType: 0
    accuracySnap: 80
    accuracyAimed: 120
    tuAimed: 70
    tuSnap: 50
    clipSize: -1
    battleType: 1
    twoHanded: true
    invWidth: 2
    invHeight: 3
    recoveryPoints: 5
    armor: 50
    vaporColor: 3
    vaporDensity: 30
    vaporProbability: 100

extraSounds:
  - type: BATTLE.CAT
    files:
      111: Resources/Sounds/Fire.wav
      112: Resources/Sounds/sonichit.wav
  - type: BATTLE2.CAT
    files:
      111: Resources/Sounds/Fire.wav
      112: Resources/Sounds/sonichit.wav

It still crash. So, I must be missing something.
The game crash exactly when the bubble was about to be drawn. I can hear the hit sound, but not the fireSound in the underwater map.
« Last Edit: September 12, 2019, 04:03:45 pm by wcho035 »

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6996
  • OXCE developer
    • View Profile
    • My Wiki
Re: How underwater bullet trajectory works?
« Reply #10 on: September 12, 2019, 04:04:15 pm »
transparencyLUTs are moddable, the problem is he's setting the depth value greater than zero but doesn't have a battle2.cat to pull the audio from (that's my take on it anyway)

As discussed:
1. they are supposed to be moddable, but there's a bug which makes them not moddable... fixed today
2. currently only master mods can mod them... discussion in progress

Also:
3. currently only TFTD-based mods support them... because the LUTs are created only from the LBM palette files... so UFO-based hybrid mods won't have LUTs calculated even if defined
4. (OXCE only) even if point 3 is implemented, there can still be only one LUT per depth... i.e. can't have multiple LUTs for OXCE custom palettes

In other words... it's not working for UFO-based mods... it can be implemented (see screenshot), but it won't support all OXCE palette features.

@wcho035: is this a serious feature you're missing, or are you just playing around and don't really need it?

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #11 on: September 12, 2019, 04:21:29 pm »
Hi Meridian, this is a feature I love to (or must) have with my underwater weapons. Even Luke could not get it to work, if there is a way to get it working. I am sure he and not to mention to me, I would be very grateful.

"2. currently only master mods can mod them... discussion in progress"

"(OXCE only) even if point 3 is implemented, there can still be only one LUT per depth... i.e. can't have multiple LUTs for OXCE custom palettes"

Not 100% what they means, but I am happy to find away to make it happen. I am not picky, just one vaporcolor is good enough for me.

If possible, I would like to keep disableUnderwaterSounds: true and let the vapor trail sound work in the depth. AKA no need for Battlecat2, because if I disableUnderwaterSounds: false, this will bring up other headaches.. 
« Last Edit: September 12, 2019, 04:33:28 pm by wcho035 »

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6996
  • OXCE developer
    • View Profile
    • My Wiki
Re: How underwater bullet trajectory works?
« Reply #12 on: September 12, 2019, 06:30:52 pm »
Hi Meridian, this is a feature I love to (or must) have with my underwater weapons. Even Luke could not get it to work, if there is a way to get it working. I am sure he and not to mention to me, I would be very grateful.

Test mod attached as zip.

Test build: https://lxnt.wtf/oxem/builds//Extended/Extended-5.6.3-ecaa78032-2019-09-12-win64.7z
« Last Edit: May 01, 2020, 01:09:55 pm by Meridian »

wcho035

  • Guest
Re: How underwater bullet trajectory works?
« Reply #13 on: September 12, 2019, 07:33:13 pm »
Hi Meridian, I want to thank you very much for the new code, but this time, it did not work as plan. I have included the error logs. I have coded my ruls to the exact sample you send me. I tested only on underwater maps. The surface maps are okay but no vapor trails are drawn. The crash is the same, just when the vapor trail was about to be shown, it crashed,

[13-09-2019_02-30-37]   [FATAL]   A fatal error has occurred: Segmentation fault.
[13-09-2019_02-30-37]   [FATAL]   0x589080 OpenXcom::CrossPlatform::stackTrace(void*)
[13-09-2019_02-30-37]   [FATAL]   0x589ef0 OpenXcom::CrossPlatform::crashDump(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[13-09-2019_02-30-37]   [FATAL]   0x41e830 signalLogger(int)
[13-09-2019_02-30-37]   [FATAL]   0x925b90 OpenXcom::UfopaediaStartState::think()
[13-09-2019_02-30-37]   [FATAL]   0x7ffa42230ef0 _C_specific_handler
[13-09-2019_02-30-37]   [FATAL]   0x7ffa42244b50 _chkstk
[13-09-2019_02-30-37]   [FATAL]   0x7ffa421bbcc0 RtlWalkFrameChain
[13-09-2019_02-30-37]   [FATAL]   0x7ffa42243b70 KiUserExceptionDispatcher
[13-09-2019_02-30-37]   [FATAL]   0x538880 OpenXcom::Map::drawTerrain(OpenXcom::Surface*)
[13-09-2019_02-30-37]   [FATAL]   0x658f10 OpenXcom::Surface::blit(SDL_Surface*)
[13-09-2019_02-30-37]   [FATAL]   0x6572e0 OpenXcom::State::blit()
[13-09-2019_02-30-37]   [FATAL]   0x59fd10 OpenXcom::Game::run()
[13-09-2019_02-30-37]   [FATAL]   0x41e990 SDL_main
[13-09-2019_02-30-37]   [FATAL]   0x9276c0 console_main
[13-09-2019_02-30-37]   [FATAL]   0x9277e0 WinMain
[13-09-2019_02-30-37]   [FATAL]   ??
[13-09-2019_02-30-37]   [FATAL]   ??
[13-09-2019_02-30-37]   [FATAL]   0x7ffa411b1fd0 BaseThreadInitThunk
[13-09-2019_02-30-37]   [FATAL]   0x7ffa4220ef90 RtlUserThreadStart
[13-09-2019_02-30-41]   [FATAL]   OpenXcom has crashed: Segmentation fault.
Log file: C:/games/XCOM UFO/test build/user/openxcom.log

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6996
  • OXCE developer
    • View Profile
    • My Wiki
Re: How underwater bullet trajectory works?
« Reply #14 on: September 12, 2019, 07:52:31 pm »
Did you try my mod?