Search Unity

Time sphere in multiplayer game that shortly surrounds players about to get hit with projectiles?

Discussion in 'Physics' started by CL1NTxB34STW00D, Aug 17, 2019.

  1. CL1NTxB34STW00D

    CL1NTxB34STW00D

    Joined:
    Aug 17, 2019
    Posts:
    1
    Wanted to know if it's possible to give players a very small window of time to deflect a projectile without affecting the rest of the players or overall time and movement of the game?
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,009
    That depends on how you're doing your shooting. In many games, shooting is instantaneous; Player 1 fires, and Player 2 is immediately hit by the shot, with no chance to actively deflect it. But if your bullets are kind of slow (more like throwing a baseball at a player) then you could warn Player 2 the moment a shot is fired, giving them time to react to it. (You'd just need to predict that the shot Player 1 just fired is on target to hit Player 2).

    So, how does your firing work? Is it instant?

    Another thing to consider is how quickly players can shoot. Let's say you give your players a machine gun, firing 10 shots per second. You almost certainly don't want to put 10 warnings on Player 2's screen every second, for each bullet.

    So I'd say the approach you use here is fairly dependent on how you have your combat wired up.You could always kind of "fake it" and when a shot hits the player, give the targetted player a short time to do something to cancel the shot, otherwise have it cause damage. That might look silly, though, as a headshot might take a half second before the player dies. I'd say that would make the game feel laggy/broken, and I would be frustrated by that kind of system.
     
  3. SparrowsNest

    SparrowsNest

    Joined:
    Apr 6, 2017
    Posts:
    1,860
    Do you mean a spawn "grace" period where who ever spawn can't get hit?

    most games just make you flashing transparent and everything goes though you for like 3 seconds+-.
    *if the player lets off a shot or w/e the grace period should end immediately.