Author Topic: Perfect Dark Fact Info Dump  (Read 896 times)

Icy

  • Posts: 1907
    • GE
    • PD
    • twitch
    • 2014SilverStar
    • 2015SilverStar
Perfect Dark Fact Info Dump
« on: July 31, 2018, 01:17:38 am »
With huge thanks to YE for providing a ton of the coding for Perfect Dark, I've been skimming through all of it and collecting interesting information about every level. Somewhat surprisingly, there's very little new content due to the collective efforts of the community over all the years, as well as my own personal playing around with the game. That said, I still think there are a lot of useful facts here, as well as access to numerical values such as health, cycle timers, RNG, and so forth. I also can't provide absolutely everything, so I picked out what I personally found to be interesting. Hope you enjoy it!

If you're interested in exploring the coding yourself, visit here!

General

All level-specific luck-based events (Investigation terminals, P2 switches, Ruins pillars, etc) are all equally random. However, because they're generated from a single byte (I think), there are only 256 possibilites, so some outcomes are more common than others.
All "luck-based" NPCs (Rescue Agent Disguise guy, Air Base Stewardess, Elvis, President, Investigation bots, etc) have no randomness ever assigned to them, so any differences in their movement speeds is because of loading, unloading, lag, other NPCs along their paths, etc. They're not affected by RNG, but instead a chaotic storm of countless factors.
Most "per frame" checks are likely per 2-4 frames due to lag, scripts/functions not being checked every frame, and many more factors. The information provided is just what the code says.
Idle animations happen 1 in 327ish per frame.
Gun Jams occur 3.9% of the time. Skedar do not have gun jams.
Every guard has accuracy, reaction speed, health, armor, and more stats all individually assigned.
Most basic enemies have 40 units of health, Caroll has 100 health and 100 shield, the dual LX guard on SOS has 280 health (to give you a relative value and reference).
Seated guards if alerted by noise and not by you directly, will not have their health set and will instantly die to anything on any difficulty.
Some guards are given 18 units of Magnum damage (RL guard on Infil, dummy Maian on Attack Ship, etc), but are able to survive on DLTK. Other such guards are given multiples of 18 units of Magnum damage and will never survive (such as the lonely guard on Deep Sea).
All speeches can be skipped, but many have timers associated with them, which is why not all save time. There are also some which have a timer, but the speech length is slightly longer, for example "I'll get out on that hoverbike. Now cover me while I open the doors" only has a 2-second timer, meaning it could be partially speech skipped. I'm not sure about any applications of these however because there's usually other important things to be doing.
Guards take 5 seconds to attack a spy item, and will approach them if the spy is within 30 units. The 5s timer begins when they stop and resets whenever they move again.
Spy items gain health boosts from difficulty differences and Enemy Health settings (LTK/DLTK).
Psychosised guards will hunt for any guard within 254 units (basically across most levels).

Defection

Security cams disabled from ECM lasts 2 minutes.
Data Uplink works within 25 units. It takes 5s to complete. It does take vertical distance into consideration, but the centre is very close to the glass windows.

Investigation

Isotope room causes 10 units of motion blur (flat value), and causes 1024 units of damage every 5 seconds.
Alarm guards take 0.5s to spawn one after the other.
The 3rd scientist will always activate the alarm instead of deactivating the console. You can do them out of normal order and get a different scientist to activate the alarm rather than the angrier one we usually do last.
The level ends when you're in the final room, and the final door is opened, so it could work from across the hall in theory.
Uplink spawn guard appears after 0.5s and then another after 1s more.
You must be within 20 units when uplinking. It takes 7.7s.

Extraction

The copter will fire rockets every 8.3 seconds on SA or higher difficulty when your height is high enough (roof).
The endzone is a 20 unit radius from the centre of the helipad, and when your height is high enough.
Cass room bodyguards are invincible until you enter the room.
Caroll "has been damaged" when his shield is gone.
Cass office key card disappears when Caroll is damaged or if the lights are restored on the bottom floor before completing the lift objective.
Cass is immediately moved to the bottom of the level when you're 30 units away from her and you're out of her line of sight (she has 360 vision). Unfortunately, there's no way to make a strat out of this, so she still will block you on slower/safer runs (like on PA).

Villa

The CI ally (sniper guy in the shower) is immediately killed at the start of the level.
Snipers on A/SA appear once your height is low enough (at the bottom of the cave).
Hackers appear 10s after the wind generator is activated.
The final door at the end must be fully opened to end the mission.
The Sniper who drops 2x CMP150s must be killed within 38.3s or he won't drop them.

Chicago

The guard who seals the G5 door will do so if he sees you (360 vision), hears gunfire, sees someone shot, is shot, etc. He needs to instantly die.
The endzone is a 35 unit radius from the G5 entrance room.
The Limo will leave after the taxi is reprogrammed, the tracer bug is attached, 3 minutes on Agent, or 2 minutes on SA/PA, whichever happens first. When a condition is met, it'll disappear immediately if unloaded.
Chicago uses a hidden remote mine for the taxi/drone crash. The drone is normally invincible except for during the crash.
The top guard in the stairwell will only do his special death animation (falling over the rail) if he's within 25 units of the stairwell (?) and also if your height is low enough (if you ever climb high enough on the stairwell, he won't do it anymore).
Reprogramming the taxi takes 5s and you must stay within 35 units.

G5

The second of the first two cloak guards must be KO'd to drop the Crossbow. Falcon 2 pistol whip is unnecessary and you can kill the first.

Infiltration

The explosion on Infiltration is caused by hidden remote mines that are set to explode in a long series. They're only moved into the room when ready to blow up and are set to invincible otherwise.
90 seconds must have passed and the Comms Rider bug throw completed before the key guard will run to the explosives room (which is why we watch the long cutscene). On PA it's 60 seconds. On Agent, it's 120 seconds, but the objective can't be completed, so he never leaves.

Rescue

Rescue door data uplink takes 7.7s, and you must stay within 30 units.
The ending keycard on Rescue is dropped when all 4 guards are dead, but also works when only the back-right guard is dead. It's a poorly coded section, and can also despawn keys, but the tl;dr is kill back-right guard, don't kill others.
X-ray scanning the Maian takes 4s.
Rescue lab clothes on PA can be in 1 of 5 locations, not 10. They all have a 20% chance. From the side facing the doors of the lockers, and row 1 being the closest pair, the lab clothes can appear in L1, R2, R3, L4, and R5.

Escape

Escape gas room causes 7 units of motion blur (flat value), and 514 units of damage. Motion blur has a 20% chance of occurring. The cycles are 7.7s long. I think some spots along the hallway will reset this time (like the doorways?) as you can clearly see players take more than that to get out of the rooms.
You must be within Jonathon's line of sight to activate him, and then be within 30 units of him to trigger the objective. It takes 2.5s from being initially seen by Jonathon. If you're not facing him it takes an extra 1s .
Jonathon has 1200 armor and 1 health. Elvis has 200 armor and 1 health.
The Escape protection takes 33.3s. The X music lasts for 30s.
Jonathon triggers the ending (activates consoles) once his height is greater than -600 (climbing the ramp). If you are within 30 units of him, the alternative exit will trigger.
When the alien medpack is activated, Elvis will revive after 2s and a certain spawn guard is dead. Elvis will always revive after 35.3s.
Spawn guards have a 1 in 51.2 chance to spawn each frame (assuming they're able to). After the ending consoles become activated, this drops to 1 in 128.
The Remote Mines despawn if you take 40s or more to drop-off Elvis, including the opening cutscene.

Air Base

There are 3 types of lasers at the end, each with a different on/off cycle. They are 1.5s, 2s, and 3s, that is, they'll be on for that long, then be off for that long, repeating forever.

Air Force One

For the Timed Mine to succeed, it has to blow up 5 Comms Hubs, which are invincible until after talking with the President.
AFO takes 50s to crash after pilots are killed. The pilots are not attacked, but are instead given 18 units of Magnum damage, which is why they can prevent the crash on DLTK.
"The President's room is on this level, Joanna" plays when your height is 440 or higher (up past the ramp).
The President starts with 0 health, then is given 500 and becomes active 2s after "We have to get you to the escape pod. Follow me.".
The President completes once he reaches his ending spot and has stopped travelling (probably meaning 0 movement speed). Because of this, it's probably better to have him stop at the door and push him in so he has lower acceleration. See: Karl's 1:17 ending.

Crash Site

Drones have 250 health.
The President completes similarly to AFO (needs to stop moving).
Spawns begin appearing 60s after any objective is completed, or Joanna is given Proxy Mine from Elvis. They appear in one of four locations, all around the UFO.
The level ends 2s after all objectives are completed.
The President has 300 health.

Pelagic 2

Most (all?) guards have 70 health.
GPS/Autopilot scientists seem to struggle to complete sometimes because they both want to go to the same spot and must stop completely, which is clunky when unloaded and why Agent completes at random speeds (if at all).
Elvis has 2000 armor and 1 health on Pelagic 2. He becomes hidden and invincible after you leave the first area.
The level ends 2s after all objectives are completed and you enter the endzone.
When clicking a wrong switch, it takes 2s before the correct ones are deactivated.

Deep Sea

Cloaking Shotgun guards have 10 health and 70 armor.
If you kill the Proxy Mine guard without taking any Shotgun damage, he'll drop it. Difficulty, time, Elvis, etc have nothing to do with it. You can also take explosion, melee, and CMP150 damage and still get the Proxies.
Elvis has 900 armor and 1 health.
After you take the teleportal on Deep Sea Agent, it's possible for Elvis to fail teleporting if other scripts are ongoing, but it's hard to give exact details. This doesn't seem to be an issue on other difficulties.
Mini Skedar have 20 health.
On Deep Sea Perfect Agent, the Megaweapon objective fails if your Farsight ammo goes to 0 before destroying the canisters.

Defense

Spawning guards have 40 health and 90 units of shield.
Hologram room hostage clones have 1 health.
The hostages only drop the Devastator if no hostages have died. I believe the hostage who drops it is the one who stops moving first, which should always be the woman if you're fast, as Grimshaw will take a small step.
On PA, 5 hostages must be saved, on SA 4, and on Agent 3.
The firing range guards and hostages are invincible until you either enter the room, or 10s pass after opening the door.
The uplinking on the Skedar bomb ship takes 7.7s and connection is only broken when you leave the room.

Attack Ship

Most Skedar on Attack Ship have 10 health and 190 armor. Elvis has seemingly no health and 200 armor.
The ending Skedar spawns have a 1 in 256 chance to become visible per frame. After 5 seconds, they become visible regardless.
Cass's necklace on Attack Ship doesn't appear on A/SA.
All 4 hangar Skedar spawners and the 2 ending Skedar spawners can be blown up and will prevent all future spawns from that location.
Most of the Skedar above the hangar only appear after your height is high enough (from riding the lift).

Ruins

Skedar have 40 health and 160 armor. The Skedar of the secret army have 40 health and 50 armor.
The Skedar King has 500 units of shield, which decreases by 100 for every pillar destroyed (400, then 300, etc). When he has 20 or less, he flops for 8.3s or until a pillar is destroyed.
The tile switch activates when the pyramid object is within 5 units.
The only weapons that can be sacrificed are Falcon 2 (Scope), Callisto, Mauler, Devastator, and Slayer. This is because those weapons are already resting on the altar (hidden), and other weapons don't exist there.
The secret army objective checks for Skedar death animations, not just death, before completing. This is why it takes a bit of extra time.
Secret army Skedar are released every 8.3s.
After the Target Amplifiers are placed on all 3 pillars, one will explode after 10s, the next after 3s, and then the last after 3s.
Each of the 5 pillars at the start of the level have a hidden Remote Mine inside, 3 of which are invincible (the ones destroyed by Target Amplifiers), which is what allows them to be destroyed by the Devastator. Make sure to know where the Remote Mines are hidden to blow them up successfully, particularly with the largest pillar.
A large pillar bridge exists over the canyon on Co-op/Counter-op only.

---
Ruins King Logic:
If shield < 20 any time except while Melee Attacking, go to centre and flop

If RocketCount < 2
201 / 256 (~78.5%) -> Fires a Rocket
18 / 256 (~7%) -> Summon a Mini Skedar
19 / 256 (~7.4%) -> Summon a Skedar
18 / 256 (~7%) -> Melee Attacking

If RocketCount = 2
18 / 55 (~32.7%) -> Summon a Mini Skedar
19 / 55 (~34.5%) -> Summon a Skedar
18 / 55 (~32.7%) -> Melee Attacking

Fires a Rocket: Jogs to left spot if within 30 units of right, otherwise go to left spot (might be vice versa) -> Fires Rocket -> RocketCount+1
Summon a Mini Skedar: RocketCount=0 -> Summon a Mini Skedar -> Do nothing besides idle around or flop until Mini Skedar is dead
Summon a Skedar: RocketCount=0 -> Summon a Skedar -> Do nothing besides idle around or flop until Skedar is dead
Melee Attacking: RocketCount=0 -> Flop immunity + cloaking -> Wait 2s, then chase for 7s, or until King attacks (must be within 15 units), then wait 1s and warp back up -> Flop immunity + cloaking ends

When the King flops, RocketCount=0.
---

For Agent (or safe SA/PA) runs with 2-1-1-1 pillar breaks, the King has 3 chances to ruin the run with Melee Attacking (~19.6% in total).
For SA/PA runs with 2-2-1 pillar breaks, the King has 2 chances to ruin the run with Melee Attacking (~13.6% in total).

MBR

Cass has 40 health.
If Cass is out of sight for 2s, she will stop running.
Cass completes whenever her height is high enough (this fact is related to how modern strats work).
Most of the guards in the level are hidden until your height is high enough (riding the lift). This occurs at -4100.
On PA, the lift will be deactivated once your height is high enough (riding the lift). This occurs at -4400. The opposite lift will rise until the guard's height is -4600 and then 0.5s passes (I might be wrong on this).
The captain has 60 health and 40 armor. Most of the guards have 40 health and 40 armor.

Maian SOS

The dual LX guard on SOS has 280 health, while most others have 50 or 80 health.
Once the alarm on SOS goes off, guards will respawn every 50 seconds after the previous spawn finishes his death animation. It may be possible to kill the spawner with explosions?
The ending console takes 3s before the message "Distress signal has been sent." appears and the objective is complete.
The level ends 2s after all objectives are complete.
Calling the final lift only sends it to the upper location (it's broken).

War

The Maian Leader and all three Skedar Kings on War have 40 health and 300 armor. If they spot an enemy, they will move around and attack it, but always return to their starting area.
Maians have 200 health, Skedar have 150 health and 80 armor.
There are 7 Remote Mine explosions, starting during the opening cutscene.
A total of 50 Maians can be spawned. Only 3 Maians can be spawned at a time.
A total of 65 Skedar can be spawned from first King, 50 from second King, and 50 from third King. Skedar will spawn as much as possible in cycles of 1s and 10s from the first King, 15s from the second King, and 15s from the third King (the code isn't complete, so I don't know what the triggers are). In other words, the game will always try to spawn as many as possible after each cycle. The game will also spawn as many as possible at the start of the level, and after each King death. Only 4 Skedar can be spawned at a time.
The level ends 2s after all Kings are dead.
The first King is invincible if you're not in certain rooms (the ones along the halls towards him).

Duel

The guard has 20 health, Jonathon has 40 health, and Trent has 40 health.
Jonathon is unable to shoot you, but can melee attack you.
After killing each opponent, you wait 2s until you can duel the next one.
The level ends 3s after all objectives are complete.
The total wait times are 3s on Agent, 5s on SA, and 7s on PA.

Closing

Hopefully you've learned some new things or at least were entertained! If you notice any errors of any kind, let me know!
« Last Edit: July 31, 2018, 11:51:07 am by Icy »

Wyst3r

  • Posts: 4164
  • Train Strat Master
    • Henrik
    • GE
    • PD
    • twitch
Re: Perfect Dark Fact Info Dump
« Reply #1 on: July 31, 2018, 02:30:36 am »
Awesome! I've added a link to this post in the regular facts topic.

Alka Maass

  • Posts: 216
  • Defense Strat Maasster
    • GE
    • PD
    • twitch
Re: Perfect Dark Fact Info Dump
« Reply #2 on: July 31, 2018, 06:28:38 am »
Good stuff, also this might be hard to do/say but what exactly in terms of distance is 1 unit? Maybe there's an object that can be somewhat used as a reference to get a basic idea of a distance of 1 unit?

Icy

  • Posts: 1907
    • GE
    • PD
    • twitch
    • 2014SilverStar
    • 2015SilverStar
Re: Perfect Dark Fact Info Dump
« Reply #3 on: July 31, 2018, 10:55:38 am »
How long is 1 meter? :nesquik: It's much easier to visualize their values by comparing them to others. I'd say get a relative idea of 30 units by one of the uplink distances (like the 30 unit one on Rescue), and use that as your reference.

NonnX

  • Posts: 15
Re: Perfect Dark Fact Info Dump
« Reply #4 on: August 02, 2018, 04:24:24 pm »
Very nice writeup Icy. Lots of very interesting stuff.

I was about to suggest an idea to open last door on investigation with the campsy while standing at the experimental shield item, but then realised it only completes if you are in the room as well :(

Did the sniper ally in Villa get 18 magnum damage once or multiples, or something else entirely?

Are armor units the same as shield units, or are they distinct?

If all hanger spawning skedars are eliminated before the objective is completed, does it fail? Or is there a global timer for such cases?

Thanks for sharing!

flicker

  • Posts: 1445
  • Shadows of the Empire N64 World Champion
    • Flickerform
    • GE
    • PD
    • twitch
    • 2016RankingsDev
    • 2017RankingsDev
Re: Perfect Dark Fact Info Dump
« Reply #5 on: August 02, 2018, 05:28:17 pm »
I was about to suggest an idea to open last door on investigation with the campsy while standing at the experimental shield item, but then realised it only completes if you are in the room as well :(

Turns out you actually have to go more than halfway through the last room to trigger the ending. Specifically you need to get to the 2nd archway.

Are armor units the same as shield units, or are they distinct?

They are technically distinct in that you cannot headshot or disarm a guard who is shielded, where you can if they just have armor, although this does not mean you can disarm all guards with armor as some are still immune to it, for example Deep Sea shotgun guards, but I believe that is a property of cloaked guards. If you are talking purely about the values of armor or shields, I think they are still distinct, but I cant say for sure or in what way.

If all hanger spawning skedars are eliminated before the objective is completed, does it fail? Or is there a global timer for such cases?

There is a 2 minute timer.
« Last Edit: August 02, 2018, 05:51:03 pm by flicker »

punjabie

  • Posts: 102
    • GE
    • PD
Re: Perfect Dark Fact Info Dump
« Reply #6 on: August 02, 2018, 05:34:49 pm »
Im sure this has been covered before but playing the level has got me curious so I just need to ask. On Villa A and SA why does the negotiator sometimes complete quickly and other times not so quickly. Seems to me she starts running the second both are dead so why the difference in completion times? Just wondering is all

flicker

  • Posts: 1445
  • Shadows of the Empire N64 World Champion
    • Flickerform
    • GE
    • PD
    • twitch
    • 2016RankingsDev
    • 2017RankingsDev
Re: Perfect Dark Fact Info Dump
« Reply #7 on: August 02, 2018, 05:36:35 pm »
Im sure this has been covered before but playing the level has got me curious so I just need to ask. On Villa A and SA why does the negotiator sometimes complete quickly and other times not so quickly. Seems to me she starts running the second both are dead so why the difference in completion times? Just wondering is all

This is likely due to some funny pathing and the way she becomes unloaded.

Icy

  • Posts: 1907
    • GE
    • PD
    • twitch
    • 2014SilverStar
    • 2015SilverStar
Re: Perfect Dark Fact Info Dump
« Reply #8 on: October 03, 2018, 11:34:27 am »
Again, thanks to Prism019/TheCubeMaster019 for the multiple version function explorer and finding which functions have differences, I compiled all of them. Just like with Goldeneye though, these are mostly Co-op/casual play bug fixes it would seem, and nothing interesting or useful is available, but here they are anyway.

Global 0016
-On PAL/Jap, the "Objectives Failed" message that pops-up occasionally after failing objectives is smaller? Might just be a typo in the function explorer.

Defection 0C00
-NTSC/Jap have different lighting in the opening cutscene in room 00.

Defection 1418
-PAL has different lighting in the opening cutscene in room 00. It appears that this and the above function do the same thing, but are triggered at different times.

Villa 1005
-At the start of Villa PA, only 2 of the Snipers are visible (the roof one and the one way past the water), and the rest become visible after going above a certain height. On NTSC, this is above -500, and on PAL/Jap, this is above -550. NTSC's would trigger later, but all will trigger as soon as you climb the first ramp, so I would imagine this change was intended for Co-op.

Infiltration 1006
-On NTSC, the 2nd player on Co-op can't trigger the left lift switch even with the keycard. This glitch is fixed on PAL/Jap.

Rescue 041F
-When you meet the Disguise scientist on SA/PA and he says "Who are you?", he has to finish his line before being able to do anything else on Jap. On NTSC/PAL, he can immediately do something else.

Air Base 0C01
-On NTSC the plane disappears at the end of the ending cutscene. On PAL/Jap, it stays visible.

Air Force One 1005
-On Jap, killing the Steward or Stewardess fails the mission for neutral kills, but doesn't fail on NTSC/PAL.

Defense 1014
-On Jap, when Carrington says "Damn it. My office... If they get access...:, the sensitive data is no longer immune to explosives.

Defense 1019
-When the level starts on NTSC/PAL, the sensitive data is no longer immune to explosives. Combined with the above function, the sensitive data on NTSC/PAL can be destroyed at any time, while on Jap, you have to wait until further into the level.

Ruins 1005
-On NTSC, the block for the ravine switch is always pushable, but on PAL/Jap, the block can become unpushable after the switch is activated/you've crossed the ravine, under some other sort of condition. Might be for Co-op?

CI Lobby 1013
-On NTSC, some other condition must be false in order to display the Hovercrate message.

CI Lobby 1014
-On NTSC, some other condition must be false in order to display the Hoverbike message.

CI Lobby 1015
-On NTSC, some other condition must be false in order to display the Doors message.

CI Lobby 1016
-On NTSC, some other condition must be false in order to display the Elevators message.

CI Lobby 1017
-On NTSC, some other condition must be false in order to display the Terminals message. All of these use the same condition, so it might be checking if you've completed the "tutorial" part of the game.

Alka Maass

  • Posts: 216
  • Defense Strat Maasster
    • GE
    • PD
    • twitch
Re: Perfect Dark Fact Info Dump
« Reply #9 on: October 03, 2018, 11:53:08 am »
Interesting info, does this take into account cart versions? (e.g 1.0/1.1)

Icy

  • Posts: 1907
    • GE
    • PD
    • twitch
    • 2014SilverStar
    • 2015SilverStar
Re: Perfect Dark Fact Info Dump
« Reply #10 on: November 12, 2018, 01:25:13 am »
I went digging into Investigation's coding for scientists failing the mission, but it's very poorly programmed and leads to some strange logic:

PA/LTK/DLTK
-if any scientist is dead, it fails

SA
-if 3rd scientist is dead, it fails
-if K7 scientist is dead and both 1st and 2nd are alive, it fails

A
-if 1st and 3rd scientists are both dead, it fails
-if 3rd scientist is dead and 2nd scientist is alive, it fails
-if K7 scientist is dead and both 1st and 2nd are alive, it fails

The game will always fail objective 3, which doesn't exist on Agent, so triggering one of the fails there will only give you the casualties message.

Unfortunately, none of this is particularly useful.