Author Topic: DogfightState development  (Read 53765 times)

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #30 on: October 12, 2012, 10:42:36 am »
Sorry for double posting but I need some info regarding craft damage animation. What's the interval between color changes from light red to dark red and the opposite?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: DogfightState development
« Reply #31 on: October 12, 2012, 03:08:25 pm »
2. Done.
4. Done.
6. You asked for it ;-).
7. Done. Actually I haven't noticed that until your screen shot. Hehe ;-).
8. Done.

I should start coding "minimizing" the interception window and doing synchronous interceptions. Don't think I'll finish today, though.

I'll send another PR with the current changes so everyone can check if they are good or not.

Edit: Actually I should create Interceptor damage visible. This is what I'll do!
Make sure to send me a PR just with the fixes since I wanna put them in 0.4.5. Stuff like minimizing can come after.

And visible damage is specially important since you made UFOs fight back! :P

Sorry for double posting but I need some info regarding craft damage animation. What's the interval between color changes from light red to dark red and the opposite?
From obversation (hard to tell since game speed varies with CPU), the red damage flashes at regular intervals of around 1/4 second (250ms), just try whatever looks good.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: DogfightState development
« Reply #32 on: October 12, 2012, 03:21:28 pm »
btw, I'm not sure if I remember correctly, but I think I had a dogfight in which my interceptor got shot several times, and when it was back at the base, it did not have any damage. can anybody confirm this? I have had several interceptors destroyed, so the basic damage system with "dogfight ended because interceptor is destroyed -> interceptor is removed from game" appears to be working, but maybe partial damage isn't transferred to the global setting correctly?

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #33 on: October 13, 2012, 01:45:09 am »
Make sure to send me a PR just with the fixes since I wanna put them in 0.4.5. Stuff like minimizing can come after.

And visible damage is specially important since you made UFOs fight back! :P
From obversation (hard to tell since game speed varies with CPU), the red damage flashes at regular intervals of around 1/4 second (250ms), just try whatever looks good.
Yeah, I've sent a PR which you already pulled ;-). I hope everything's gonna be alright with that one.

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #34 on: October 14, 2012, 10:34:49 pm »
btw, I'm not sure if I remember correctly, but I think I had a dogfight in which my interceptor got shot several times, and when it was back at the base, it did not have any damage. can anybody confirm this? I have had several interceptors destroyed, so the basic damage system with "dogfight ended because interceptor is destroyed -> interceptor is removed from game" appears to be working, but maybe partial damage isn't transferred to the global setting correctly?
I'll check that. Dunno what happens after the dogfight ends - didn't look at it yet ;-).
« Last Edit: October 15, 2012, 01:57:00 pm by d2uriel »

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #35 on: October 15, 2012, 01:58:02 pm »
BTW: when you minimize the interception window there's an icon being show over the Geoscape. Do you know where's this one taken from?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: DogfightState development
« Reply #36 on: October 15, 2012, 03:02:44 pm »
BTW: when you minimize the interception window there's an icon being show over the Geoscape. Do you know where's this one taken from?
It's in INTICON.PCK.

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #37 on: October 15, 2012, 06:21:13 pm »
Aaah, perfect. Thank you SupSuper.

I was looking for some details regarding multi-interceptions but I haven't found anything relevant. Therefore they may not work the exact same way as in the original. As soon as I'll finish those (should be tonight) I'd like everyone to look for bugs and issues as well as behaviors different than in the original.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: DogfightState development
« Reply #38 on: October 15, 2012, 06:26:32 pm »
Can you add a evasive button that says "Do a barrel roll"?  :D

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: DogfightState development
« Reply #39 on: October 15, 2012, 10:12:51 pm »
Aaah, perfect. Thank you SupSuper.

I was looking for some details regarding multi-interceptions but I haven't found anything relevant. Therefore they may not work the exact same way as in the original. As soon as I'll finish those (should be tonight) I'd like everyone to look for bugs and issues as well as behaviors different than in the original.
Multi-interceptions are extremely simple (in fact I'm pretty sure they were an afterthought by the developers :P). As far as interaction goes, they just work as multiple "parallel" interceptions referring to the same UFO with absolutely no interaction between one another, so you could just create a "parent state" that can run up to 4 DogfightStates inside it and rearrange the windows appropriately.

The minimizing is probably the trickier part, as you will need to change more behavior and keep track of more stuff in the saved game:
- You can only minimize interceptions at "standoff range", so you don't have to worry about running combat logic in the background.
- The Geoscape time is "paused" as long as at least one interception is up. If all interceptions are minimized, the game resumes.
- While an interception is minimized, the craft will continue chasing the UFO around the globe without engaging.
- A UFO can still outrun a craft while the interception is minimized (eg. changes speed during flight), in which case the interception is automatically removed.
- This all has to be preserved in case the game is saved with minimized interceptions.

You might find more details here: https://www.ufopaedia.org/index.php?title=UFO_Interception
« Last Edit: October 15, 2012, 10:17:23 pm by SupSuper »

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #40 on: October 15, 2012, 10:57:27 pm »
Multi-interceptions are extremely simple (in fact I'm pretty sure they were an afterthought by the developers :P). As far as interaction goes, they just work as multiple "parallel" interceptions referring to the same UFO with absolutely no interaction between one another, so you could just create a "parent state" that can run up to 4 DogfightStates inside it and rearrange the windows appropriately.

The minimizing is probably the trickier part, as you will need to change more behavior and keep track of more stuff in the saved game:
- You can only minimize interceptions at "standoff range", so you don't have to worry about running combat logic in the background.
- The Geoscape time is "paused" as long as at least one interception is up. If all interceptions are minimized, the game resumes.
- While an interception is minimized, the craft will continue chasing the UFO around the globe without engaging.
- A UFO can still outrun a craft while the interception is minimized (eg. changes speed during flight), in which case the interception is automatically removed.
- This all has to be preserved in case the game is saved with minimized interceptions.

You might find more details here: https://www.ufopaedia.org/index.php?title=UFO_Interception

What I've done until now is I transferred dogfights into GeoscapeState class. Meaning it's not being pushed to _states stack of Game class but to a vector inside Geoscape. During every think() of Geoscape all dogfights are thinking as well. Depending on their state (minimized/maximized) different things happen. Can I leave it this way?

Regarding your points:
- done,
- done,
- done (nothing had to be done as it actually worked without any modifications ;-) ),
- gotta test that,
- this is gonna be done at the very end ;-).

I have some questions though:
  • If I have one interception minimized and an interceptor will catch up with a different UFO I'll get two separate interceptions, right? They both can be visible at the same time?
  • What will happen if I have 4 interception windows already opened and minimized and another craft will catch a UFO?
  • Let's suppose I have 1 interception window and I'm gonna minimize it. I'll get an icon with #1. Then another craft is gonna catch a UFO, dogfight is gonna be opened, I minimize it and get a second icon with #2. If I now maximize #1, will #2 change to #1? This is kind of important ;-).
I could really use a saved game for the original game where 4 crafts are chasing a UFO ;-).
« Last Edit: October 16, 2012, 09:47:11 am by d2uriel »

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: DogfightState development
« Reply #41 on: October 16, 2012, 09:21:25 am »
1. Yes- You can have two interception windows open at the same time (at least on the original). I'm not sure about what Sup saying they are independent, I thought the UFO would only shoot one of the craft's attacking it. I could be wrong though, I can't find any information on that.

2. Don't let them minimise? or maybe this is where OpenXCOM expands on the original and let's you have more?

3. I'm pretty sure they remain in their "slot" when minimised. I think it works like this:

Window A is minimised - called #1
Window B is minimised - called #2
Window A is restored - B is still #2
Window B is restored - No minimised windows
Window B is minimise - called #1
Window A is minimised - called #2


Edit:
Do you think it might be possible to "drag" the window when clicking on the border? I'm not sure if this might get complicated with Z-ordering, and maybe you'd need an "Alt+Tab" to cycle through.
« Last Edit: October 16, 2012, 09:24:51 am by pmprog »

Offline d2uriel

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: DogfightState development
« Reply #42 on: October 16, 2012, 09:53:13 am »
Can you add a evasive button that says "Do a barrel roll"?  :D
LOL! Yes, that can be done but it won't be visualized in any way ;-).

Regarding them points:
  • I know you can. You can even have 4 of them opened. But can they be interceptions of different UFO's?
  • First we need the original behavior. So we need to forbid entering a dogfight when 4 are already running? Should the craft follow the UFO until there's a chance to enter the dogfight/it runs out of fuel?
  • Does the minimized icon of window B moves to the slot where minimized icon of window A was?

Yes, it would be possible to drag the windows (everything's possible to be exact :P).

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: DogfightState development
« Reply #43 on: October 16, 2012, 12:33:49 pm »
1. I didn't even know you were allowed 4 (I thought it was limited to 2), but yes, I'm pretty sure you can intercept multiple UFOs
2. I've never had more than 2 in battle (I don't think, can't remember now), so I don't really know the original behaviour, I would expect crafts to follow until able to intercept. Set it up as a Ruleset option as Max Interceptions or something
3. Yes, it should go in the first "available" slot, numerically ordered. Take this example:
# You send 5 craft to attack a UFO
# You minimise 1, 2, and 3 until the 4th arrives, the 5th just follows without engaging
# Craft 2 takes heavy damage, so you minimise return that to base
# You'll want Craft 5 to enter "Slot 2", so you can continue with a 4 craft assault

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: DogfightState development
« Reply #44 on: October 19, 2012, 08:31:37 pm »
I could really use a saved game for the original game where 4 crafts are chasing a UFO ;-).
You could try the saves from xcomufo.com, they have a ton of stuff set up and everything unlocked so they're very handy for testing stuff out.