aliens

Author Topic: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*  (Read 10455 times)

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« on: March 27, 2016, 04:20:38 pm »
TFTD requires separate "underwater" strings for sprites and sounds, so my question is: how does one go about implementing this, exactly? Last night I was experimenting with extra/alternate explosion colors to visually differentiate between smoke/dye, HE and stun/freeze. They work on land just fine; however, the game keeps crashing underwater. I'm obviously missing something.

(I tried a much darker smoke/dye, but it just didn't look good. These aren't final, will continue experimenting.)






I believe I got sounds figured out, like so:

Code: [Select]
extraSounds:
  - type: BATTLE.CAT
    files:
      90: Resources/Sounds/GaussPistol.ogg
  - type: BATTLE2.CAT
    files:
      90: Resources/Sounds/GaussPistolUW.ogg

So I'm assuming something similar applies for sprites? Example:

Code: [Select]
extraSprites:
  - type: X1.PCK
    width: 1024
    height: 128
    subX: 128
    subY: 64
    files:
      80: Resources/Extra_Explosions/X1_Stun.png
      100: Resources/Extra_Explosions/X1_Smoke.png
      120: Resources/Extra_Explosions/X1_HE.png
items:
  - type: STR_DYE_GRENADE
    hitAnimation: 100
  - type: STR_GC_HE_AMMO
    hitAnimation: 120
  - type: STR_HALLUCINOID_STUN_WEAPON
    hitAnimation: 80

As always, help much appreciated :)


PS: Somewhat related also: shotgun-style weapon do not work underwater either (it won't crash the game, but shotgunPellets only work on land. It's nothing urgent as of now, but Warboy may wanna patch that up that later?
« Last Edit: March 31, 2016, 03:33:44 am by Orz »

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: TFTD's Underwater Sprites & Sounds?
« Reply #1 on: March 27, 2016, 04:36:24 pm »
Did you get the correct pallettes for underwater?  There are four if I remember correctly, that correspond to the various depths.

Offline chaosshade

  • Colonel
  • ****
  • Posts: 170
  • The Harpy
    • View Profile
Re: TFTD's Underwater Sprites & Sounds?
« Reply #2 on: March 27, 2016, 09:19:33 pm »
Palettes don't cause crashing, I've fought that battle before.  They just make the game annoying until you fix them, lol.  In TFTD you just use the palette for Depth 0 (surface) and the game corrects for depth.

Offline Xeno Wiper

  • Sergeant
  • **
  • Posts: 45
    • View Profile
Re: TFTD's Underwater Sprites & Sounds?
« Reply #3 on: March 30, 2016, 06:32:32 am »

I believe I got sounds figured out, like so:

Code: [Select]
extraSounds:
  - type: BATTLE.CAT
    files:
      90: Resources/Sounds/GaussPistol.ogg
  - type: BATTLE2.CAT
    files:
      90: Resources/Sounds/GaussPistolUW.ogg

So I'm assuming something similar applies for sprites? Example:
[/code]


This works for weapons as it does for aliens. But aliens need a bit more, IMHO.  :-\ 

Palettes don't cause crashing, I've fought that battle before.  They just make the game annoying until you fix them, lol.  In TFTD you just use the palette for Depth 0 (surface) and the game corrects for depth.

FIXED:

and the game screws up your colors in all depths.  :P

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
Re: TFTD's Underwater Sprites & Sounds?
« Reply #4 on: March 30, 2016, 09:53:20 pm »
Yes, palettes are not the problem here. They look fine (on land). They just crash the game underwater.

Anyone willing to take a look at this? I'm pretty sure I'm doing something stupid with the ruleset. Attached:
« Last Edit: March 30, 2016, 10:31:16 pm by Orz »

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: TFTD's Underwater Sprites & Sounds?
« Reply #5 on: March 30, 2016, 10:25:08 pm »
According to ufopaedia entry on hitAnimation:
Quote
NOTE: Explosive style weapons (Damage type: smoke, incendiary, stun, & High Explosive) use X1.PCK and should always be set to 0.

Your values are quite far of from 0, so that might be the problem here.

Another thing i noted is that the .rul file is in an unexpected place (under Resources, not in archive root or Ruleset). But i don't think that contributes to the error.

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
Re: TFTD's Underwater Sprites & Sounds?
« Reply #6 on: March 30, 2016, 10:33:49 pm »
According to ufopaedia entry on hitAnimation:
Your values are quite far of from 0, so that might be the problem here.

Another thing i noted is that the .rul file is in an unexpected place (under Resources, not in archive root or Ruleset). But i don't think that contributes to the error.

That was my bad, I put that together really quick (since I wasn't making a separate mod out of it, rather integrated on my TFTD Rework). Just re-uploaded with ruleset in correct folder. Still, though, that couldn't be the issue since I can define custom hitAnimation in UFO/EU as I like and it works fine. And here too, they work, just not underwater. And that's the issue.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites/Sounds Question)
« Reply #7 on: March 31, 2016, 01:40:01 am »
I might have found the somewhat hidden logic.
Does attached file work?

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites/Sounds Question)
« Reply #8 on: March 31, 2016, 03:33:17 am »
I might have found the somewhat hidden logic.
Does attached file work?

That did it, thanks! I just had to correct Dye Grenade's hitAnimation: 188 to 108, but your logic got across :) How did you figure it out anyway? Was it because of the double row of sprites? I wouldn't have guessed unless it was pointed out!
« Last Edit: March 31, 2016, 03:36:21 am by Orz »

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #9 on: March 31, 2016, 11:34:36 am »
I had to run it via a debugger.
Luckily it drew the first sprites of the explosion. Those were the above water sprites.
Combine that with an observed hitanimation variable that was below the sprite value, some careful looking at the code (and the ruleset for TFTD) and suddenly an idea forms. Of course it did help that you defined the smoke animation to be 20 points below the HE animation, otherwise i wouldn't have seen an explosion at all ;)

For reference. hitAnimation should always point to the first above water sprite. The game corrects for underwater explosions.
The cool thing about this is that you can use the same sprite sheets for both UFO and TFTD, only the ruleset files need to differ (ok .. theoretical, i haven't tested it).


Now the question remains .. what was your problem with the shotgun, are the paths not drawn, or the impacts?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #10 on: March 31, 2016, 01:46:17 pm »
The cool thing about this is that you can use the same sprite sheets for both UFO and TFTD, only the ruleset files need to differ (ok .. theoretical, i haven't tested it).

theoretically sound

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #11 on: March 31, 2016, 06:01:38 pm »
For reference. hitAnimation should always point to the first above water sprite. The game corrects for underwater explosions.

Gotcha.

Quote
Now the question remains .. what was your problem with the shotgun, are the paths not drawn, or the impacts?

"shotgunPellets" make it work like a shotgun alright, just not underwater. When we go swimmin' it simply operates like a regular weapon (i.e. one single AP shot, path drawn as normal). It's nothing urgent anyway.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #12 on: March 31, 2016, 08:53:57 pm »
Let me guess:
You defined:
Code: [Select]
vaporColor:
vaporDensity:
on the submersible shotgun?


Update:
 I have to stand corrected on this one. Those variables do NOT clash with underwater drawing of shutgun pellets. In fact it works completely fine by default when using
Code: [Select]
shotgunPellets
« Last Edit: April 01, 2016, 12:54:25 am by R1dO »

Offline Orz

  • Colonel
  • ****
  • Posts: 147
  • (aka Illamasqua)
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #13 on: April 01, 2016, 01:28:25 am »
Let me guess:
You defined:
Code: [Select]
vaporColor:
vaporDensity:
on the submersible shotgun?


Update:
 I have to stand corrected on this one. Those variables do NOT clash with underwater drawing of shutgun pellets. In fact it works completely fine by default when using
Code: [Select]
shotgunPellets

Really? I was just testing it on Hyrdojet Cannon (AP ammo, of course), just to get an idea how it'd look like. I didn't play with it again since. And no, I didn't touch vapors. I'll have to look at it again.

Thanks, though!

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: TFTD's Alt/Extra Explosions (Underwater Sprites) *Resolved*
« Reply #14 on: April 01, 2016, 01:37:37 am »
Perhaps the RNG gods played the same trick on you as they did on me.

Creating a super accurate shotgun sniper that can land all pellets in the same area, when all you want is rookie with default eye-hand coordination (e.g. none).