Has Bullet Time Been Implemented in a (G)ZDooM Mod?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
ReX
Posts: 1561
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace

Has Bullet Time Been Implemented in a (G)ZDooM Mod?

Post by ReX »

I'm curious to know if Bullet Time has been implemented in any (G)ZDooM game. I did a search and saw here's a mod named Mr. Anderson - Weapon Mod based on Max Payne, but the author clearly stated there will be no implementation of Bullet Time. I did a search on "Slow Motion" and came across a mod named, appropriately enough, Slow Motion. However, this mod appears to slow down the entire game, rather than selected elements that can be controlled by a script.

I intend to use it in a very limited context. The current scenario is as follows:

1. The player gets thrust towards an exit portal.
2. Currently, because of the distance the player needs to be thrust, the force of the thrust is quite great.
3. What happens, almost instantly after the thrust, is that the player exits the level. It is rather anti-climactic.

What I hope to achieve is as follows:

1. The player gets thrust towards an exit portal.
2. The player actually appears to move towards the exit portal in slow motion.
3. During the player's transit to the exit portal the player is able to look around, but is unable to control her/his trajectory or speed.

Any pointers?
User avatar
Caligari87
User Accounts Assistant
Posts: 5994
Joined: Thu Feb 26, 2004 3:02 pm
Discord: Caligari87#3089
Github ID: caligari87

Re: Has Bullet Time Been Implemented in a (G)ZDooM Mod?

Post by Caligari87 »

There's three ways to achieve slow motion effects.
  1. i_timescale — Essentially changes the tic rate of the whole game, including menus. Really only supposed to be used for debugging, not accessible to mod scripting by design, though it can be bound to keys.
  2. TimeFreeze powerup — The "classic" method, giving it to an actor will freeze everyone except that actor. Toggling the effect on and off rapidly can achieve somewhat janky "slow-motion" effects.
  3. Custom implementation — Doing it "manually". This requires overriding most or all actors to be "aware" of some mod-controlled time factor variable. Wasn't really a functional option before zscript, but not an easy undertaking regardless. You'll need to exercise manual control over nearly every aspect of each actor's behavior timing and physics for this to work.
Your use case seems suited to a limited implementation of the 3rd option, especially if you can ensure it'll be limited to the player and not need to affect other actors. My first pass naïve implementation would probably look something like:

Code: Select all

class PlayerSlowMoThing : Inventory {
  //"other" in this case is the player
 // In your other script, launch the player at 10% of the speed they'd normally launch at
  override void AttachToOwner(Actor other)
    super.AttachToOwner(); // run the built-in code first if needed
    let o = PlayerPawn(other); // cast the player pointer
    if (!o) return; // sanity nullcheck
    o.gravity = 0.1; // Set 10% gravity
    o.cheats |= CF_FROZEN; // direct way of setting PROP_FROZEN to block movement input
  }

  override void DetachFromOwner() {
    let o = PlayerPawn(owner); // cast the player pointer
    if (!o) return; // sanity nullcheck
    o.gravity = 1.0; // reset to normal
    o.cheats &= CF_FROZEN; // remove frozen property
    super.DetachFromOwner(); // run the built-in code
  }
}
Note this probably wont run out-of-the-box, but hopefully should illustrate proof-of-concept. This will ONLY make the player "fly" through the air in apparent slow motion. If needed you could give the timefreeze powerup to simply freeze present monsters and other items in place while the player is launched, which won't be 100% accurate but enough to get a matrix-type effect and avoids needing to write slowdown effects for everything.

8-)
User avatar
ReX
Posts: 1561
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace

Re: Has Bullet Time Been Implemented in a (G)ZDooM Mod?

Post by ReX »

Caligari87 wrote:[*]Custom implementation — Doing it "manually". This requires overriding most or all actors to be "aware" of some mod-controlled time factor variable. Wasn't really a functional option before zscript, but not an easy undertaking regardless. You'll need to exercise manual control over nearly every aspect of each actor's behavior timing and physics for this to work.

This will ONLY make the player "fly" through the air in apparent slow motion. If needed you could give the timefreeze powerup to simply freeze present monsters and other items in place while the player is launched, which won't be 100% accurate but enough to get a matrix-type effect and avoids needing to write slowdown effects for everything.
Many thanks, Caligari 87. One way for me to simplify the application that you proposed is to make sure all enemies in the vicinity of the exit are killed off (via a script) before the player reaches the force-thrust to the exit. (Perhaps even requiring the player to kill off all enemies before being able to reach the force-thrust point.)

I need to examine your script, which, admittedly, is beyond my nominal scripting abilities. However, with your extensive comments, I ought to be able to figure stuff out and tweak to suit my situation.

Again, many thanks.

Return to “Scripting”