Jump to content

Berserk and Sonic Cannon v2.1


silencer_pl

Recommended Posts

This happens in unpatched copies of the game as well. Since shooting costs are percentages, you shouldn't be able to fire more than 2 ~ 3 shots with the sonic weapons, but to go berserk and empty off most of the ammo clip does suggest the aquanaut's been given far more TU's then his or her current maximum TUs to play with.

 

- NKF

Link to comment
Share on other sites

It's certainly not behaviour you'd expect with slow weapons like a sonic cannon, but I'm not sure its a bug bug or if its intended as another degree of panic.

 

Hmm - perhaps we're not panicking often enough. ;)

 

- NKF

Link to comment
Share on other sites

Hobbes seems to remember his berserk HWP getting 255 TU and firing off all it's rockets during it's phase. So it must be TU misallocation bug of sorts, most likely Current TU getting set to 255 and the Base TU remaining the same, those interacting and causing trouble. I wonder if Tycho knows about this?

 

- Zombie

Link to comment
Share on other sites

HWP can become berserk?

 

You bet, and panic too. Here's a post I made way back in 2005 (had to re-up the old pics as the forum software changed how it handled images over the years).

 

I tried getting a tank to panic by allowing my squad to be wiped out by the aliens with no luck.

 

I wonder... what would happen if the tank itself is responsible for killing a friendly? Ah, ha! A reduction in morale! Being a bit lazy, I MC'd all the aliens (except for one) on a landed UFO mission. Then I bunched them all up and fired a Fusion bomb into their midst from my Hovertank/Launcher. Since the aliens were considered "friendly" while under X-COM control, my hovertank lost almost all of its morale.

 

I didn't have to wait long because my HWP panicked! I reloaded the game and also got it to go berserk! (It fortunately didn't fire its weapon, though). Here are a couple of screen shots:

 

 

 

You won't see that happening every day, that's for sure! blink.png

 

- Zombie

 

Hovertank_Panic.pngHovertank_Berserk.png

 

Here's the post NKF made about berserk which makes so much more sense than I can ever explain from memory:

 

Bug? Bug? This isn't a bug. It's the effect of cocktail of bodily chemicals that give your soldiers superhuman strength and speed while under extreme mental duress. Or something like that. It happens in the PC versions of UFO and TFTD - although I don't have the playstation version so I can't really tell how it works in there. We'd need someone with the Amiga version to give us an overall picture of whether or not it's meant to be a bug. I say it makes things so much more dangerous - for everyone.

 

The reason you get so many shots is beacuse all your weapon costs are based off your Max TUs. Say 60. Using a laser rifle, we can get snapshots at 15 TUs each (4 shots at 25% each). Not bad.

 

Now, when your soldier goes berserk, your Current TUs is pushed to 255 or slightly less points. Even at this level, your firing cost is still based off your Max TUs. In my example, it's 15 TUs per snap. This is 255/15 = 17 possible snapshots. It won't be 17, exactly, as you still need TUs to turn about wildly.

 

Just imagine what you'd get with a soldier at 50 Max TUs and a laser pistol or pistol?

 

How about trying to get an alien to do this? Might have to help it pick up its gun every so often.

 

- NKF

 

Edit: assuming units get 255TU (not 235 as is sometimes reported), I back calculated and found your soldier's TU to be ~51. Is that correct silencer?

 

- Zombie

Link to comment
Share on other sites

More like something near 61-65

 

Well, that's odd. 60 TU equates to 8.5 shots per berserk event which doesn't match you emptying out an entire Sonic Cannon Clip. Are you sure it was the full 10 rounds or was it 9 or 8? ;)

 

- Zombie

Link to comment
Share on other sites

  • 3 months later...
This is an oversight in the code for a unit going berserk. The routine calculates the amount of TUs to subtract for each shot at the beginning of the sequence and then determines if the unit has enough TUs to fire. Later it determines a facing and turns the unit, subtracting the TUs for the turn. The sequence doesn't check that the unit still has enough TUs after adjusting the unit's facing, so the unit will fire and the TUs for the shot are subtracted from its current amount. This rolls the value "below" zero. Since TUs are read and stored as an unsigned byte value, the game believes the unit now has a huge amount of TUs to use.
Link to comment
Share on other sites

  • 3 months later...
I said this was an oversight. But after going over the code to decide how to "resolve" this, I now think that this was an intentional design by the Gallops. The code for a unit going berserk and making attacks is a loop that ends: 1) if the unit doesn't have enough TUs to make a single shot at the start of the loop or 2) the loop completes 10 cycles. It is this cap on the number of cycles that makes me think the Gallops intended for berserk units to get more TUs than normally possible. The sonic cannon has the perfect TU cost to keep this loop rolling: Since the snap shot TU cost is 50%, a berserk unit only has to make one shot, turn its facing one degree, and shoot again to continue the cycle. As long as it can continue to repeat these actions in order, it will do so until either it hits the cap on the number of cycles or it runs out of ammo.
Link to comment
Share on other sites

Looking at it myself, it's either a genuine unintentional effect or a clever adaptation to prevent a potential endless loop.

 

There's one check as you enter the loop to see if there are enough TUs to make the shot, but this check isn't made again after turning the unit to face the target before firing. The only checks made after that are to see if the unit is still alive after each shot.

 

Let's say you enter the loop with just enough TUs to make one shot, but have to turn a few times to point at the right target/direction. This will leave you with less TUs than what you started. Then the firing cost gets deducted, this will cause TUs to go into a negative. As TUs are stored as an unsigned value, this wraps around. On the next cycle, it will see that there are plenty of TUs left so will proceed with the next round. The 10 attempt check is done to stop this from going on forever.

 

It's quite a specific scenario to get into, but that's the best way I can think of how it could happen.

 

- NKF

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...