Destiny 2

Harbinger 1m 30s completions, nutshell version for dev nerds.

destiny2 2 - Harbinger 1m 30s completions, nutshell version for dev nerds.

This may or may not be of interest to people who play Destiny and are interested in software development. I'll post it and let you be the judge.

A lot of you probably noticed that if you complete the Harbinger mission you get the Triumph saying you completed it in 15 minutes no matter how long it took. You may also notice the emblem tracker thinks you completed the mission in 1 minute 30 seconds no matter how long it took.

Is there a relation between these two issues? Well, yes, probably. It is common to use millisecond time values in game development because you are often timing things well below second resolution but don't care enough to use higher resolution than milliseconds (most of the time).

15 minutes is 900000 milliseconds.

1 minute 30 seconds is 90000 milliseconds.

Pretty much the same value if you get rid of a couple of pesky zeros at the end!

This is a simplification, and speculation and this probably occurs in some gameplay scripts rather than in lower level code, but… these broken triumph and emblem tracker problems could come down to issues in just two lines of code:


#define SECONDS_IN_MINUTE 60 #define TRIUMPH_COMPLETION_TIME (15 * SECONDS_IN_MINUTE * 100) // <-- First Oopsie 


 #include <harbinger_mission.h> void endMission() { if (completionTimeInMs = TRIUMPH_COMPLETION_TIME) { // <-- Second Oopsie goodJobGuardianYouGetCoolTriumph() } } 

First Oopsie: Supposed to multiply by 1000 to get milliseconds but missed a 0, so now TRIUMPH_COMPLETION_TIME is defined as 90000 (amount of milliseconds in 1.5 minutes) instead of 900000 (amount of milliseconds in 15 minutes)


Second Oopsie: Did assignment (single equal sign) when meaning to do comparison (double equal sign). So now completionTimeInMs gets assigned to the 1.5 minute millisecond value instead of compared against the desired fifteen minute value and we later apply this value to the emblem stat tracker. Because assignment always resolves to boolean true the contents of the if block are always executed and we have both just overwritten the real completion time with a fixed 1.5 minute value and incorrectly given out the fifteen minute triumph.

Oftentimes people who have been bitten by this assignment-instead-of-comparison issue in a bad way in the past begin to put the fixed value on the left side of the comparison even if it feels unnatural because the compiler can readily recognize when we did an oopsie if the left side of the operator is a fixed value and not a variable. But life is just a long series of lessons, until it bites you bad you tend not to get into this habit.

Its possible they also encoded the time as a float value in minutes with 1.5 encoded when they meant 15, but using float values for time like that is very uncommon in development in general because of problems with doing equality comparisons on variables that use IEEE 754 style encodings for floating point. So it seems much more likely to me they were working in milliseconds and missed a zero.

You may look at this and think "Geez, Bungie should find and fix bugs like this before release", but before you cast a stone remember that Destiny and the Tiger engine and the gameplay scripts that run everything have to be MILLIONS of lines of code with tons more code added each time there is a significant DLC.

There's a lot of space for bugs like this to hide in such a giant code base. The fact that the game runs as well as it does now is actually a huge triumph. The game industry road is littered with the corpses of would-be Destiny killers that shipped in much worse states than Destiny has ever been in.

Game development is hard. Game development during a pandemic is really hard. Enjoy your not-entirely-earned Triumph.

Source: Original link

© Post "Harbinger 1m 30s completions, nutshell version for dev nerds." for game Destiny 2.

Top 10 Most Anticipated Video Games of 2020

2020 will have something to satisfy classic and modern gamers alike. To be eligible for the list, the game must be confirmed for 2020, or there should be good reason to expect its release in that year. Therefore, upcoming games with a mere announcement and no discernible release date will not be included.

Top 15 NEW Games of 2020 [FIRST HALF]

2020 has a ton to look forward the video gaming world. Here are fifteen games we're looking forward to in the first half of 2020.

You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *