Original Post — Direct link

Title.

EDIT: I know I can use a 3rd party app to manage loadouts. Thanks for mentioning it for the 16th time.

External link →
over 4 years ago - /u/HelloControl_ - Direct link

Originally posted by Fuzzle_hc

Hot take?

I am glad Bungie focused on a robust API that allowed our talented community to program so many amazing tools and websites we use every day instead of trying to implement systems the community of millions will do three times better in half the time.

Hell, even I made my own little project with the API, it's very easy to get into and has a very high ceiling of possibilities.

This is a focus of our team (Bnet). We have a pretty small team, so we have to choose where to focus our resources. If we build lots of our own tools, we can't spend as much time focusing on including game features in the API, and building the stuff only we can make (Cross Save, etc). It would be really cool to build LOTS of features for everyone, but with a limited team size, it's very difficult to hit every use case. When we can, we provide features that enable the community to build super cool stuff on top of them. Finding that line is always a WIP, but it's really great to see that the community has made tools that provide stuff for everyone, even niche use cases.

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by willhockey20

Man I wish I had the time to figure out how to use the api. I just get lost everytime I try to do something with it.

If it helps, the biggest initial conceptual hurdle to jump over is the fact that the API is actually split into two big components that need each other but that are accessed in very different ways:

  1. The static data, which you can download and provides information about any entity in the game that doesn't change dynamically as you play. For instance, the names of items, or what plugs could possibly be inserted into which sockets for an item, or other information critical to use when showing or interpreting "live" data, but has no information about a specific character or "instance" of an item and its state. This data is contained in lists of "entity definitions" (for instance, the "definition" of a particular weapon, or the "definition" of a specific Triumph rather than an actual instance of one) and each of these entities is referred to by it's identifying "hash" (a numeric identifier that is unique for that given type of entity)
  2. The "Live" data, which you can access through the web services, that will get you information about specific character, instances of items, etc. The live data is mostly "hashes" that reference entities in the definitions, and values that relate to those entities.

For instance, the weapon "Thorn" (https://data.destinysets.com/i/InventoryItem:3973202132) might be identified as hash 3973202132. You can use that definition to pull some information (see the link here for a nice view of that "static" data, as provided by destinysets.com!), but for it to be useful for a player you have to combine it with "live" data - look up a character that has the Thorn item, find it in their inventory by looking for that hash, and then using the properties it returned like the stats on the item, what plugs are inserted into its sockets, etc...

Once you've gotten that figured out, the biggest problem becomes digging for what you want. We added documentation where we had time to here to try and give people more context about what each property on a definition or in the live data means, but it's a lot to work through: https://bungie-net.github.io/multi/index.html

Hopefully this helps! I've had a long running dream of making some kind of more in-depth tutorial or even youtube video series in hopes of teaching people about these core API topics, but the odds of me ever finding the time to do that feel low unfortunately. Fortunately though, many people in the community are super helpful in teaching folks the ropes!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by RLgeorgecostanza

Thanks for taking the time to share that stuff! I find it super interesting to hear these technical details and I’m sure a lot of fellow guardians do as well.

Really appreciate it. Cheers.

No prob, glad to provide help when I can! I wish we had more resources and info to share.

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by [deleted]

[deleted]

Yes, this is true - some of the API actions are limited to certain areas of the game (or while offline). Unfortunately, this'll be the situation for the forseeable future: the potential for abuse vectors if the API could perform actions in combat-capable activities is too high. Funny story, you can actually see some of the cheese that came from it when the flashback activity during Moments of Triumph accidentally allowed API equipping back in the day. There's some humorous videos out there, but it's the kind of category of problems that could cause potential grief if those actions were allowed in potential combat situations.

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by [deleted]

[deleted]

Oh yeah, I definitely didn't see the OP as an API complaint for sure (nor any of your comments!). Sadly I don't have any control over the in-game choices and focus, but I do think it's good to know that people have this desire!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by _R2-D2_

Hey man, you've probably heard this a few times before, but this type of in-depth response is fantastic and really what this community craves - genuine interaction from Bungie. Keep up the good work!

Thanks! I'm glad to be of help when the opportunity arises!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by willhockey20

Seriously thank you! Now I just need the time to actually do something with it. I swear every time I try to sit down and get started on something, something else comes up which needs a lot more of my time.

Thank you, again!

I totally understand how that goes! Have fun if you end up finding the time to, but no stress: it'll be here when the free time comes around!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by [deleted]

[deleted]

Thank you! I am glad that it has been useful to folks!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by DoroFuyutsuki

Could you talk a little about how the actual weapon hash translates into an item? Do you dereference a static item and then perform adjustments to it based on the instance’s details?

I’m trying to understand some of the design choices made about your architecture at scale. I didn’t used to REALLY care about such things, but as I have started to work on larger projects in my professional scope, these kinds of things have mattered more to me.

Sure thing! So it depends on the situation. Some properties of an item, for instance the plugs that are initially inserted into the sockets or the "level" of the item that ends up determining things like the base power stat of a weapon etc... pull together info from the definition and sometimes random values assigned by the server when an instance of that item is created in the world, and then that resulting value gets saved off.

Other times, the truth about some property of the item lives in the definition because it doesn't change for any given instance, or requires both information from the definition and information from the live data to come up with a true value for an item. (We try to hide some of that complexity in the API because that can become excessively complicated, but for better or worse parts of the game systems are built so flexibly that if we try to hide it, a future design change could render our abstraction incorrect in a way that requires us to break our contracts. That is still a balance we are trying to learn from and still make mistakes judging to this day! You can see the cruft from some of the times where I made the wrong bet on the layer of abstraction when you find deprecated properties in the API, or two properties that mean similar things but one is more robust)

In the end, any of those values that aren't directly in the definition end up as instance data, and every instance of an item that can have such data has an "instance ID" that we also expose in the API to uniquely identify that specific item as it exists in the world, with all it's unique states compared to the definition.

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by ManBearPigIets

So we never released it, and it got fixed in the famous April update after TTK, but for a while you used to be able to do those things by loading up Destiny on both Xbox 360 and Xbox One (and I would assume ps3/4). Because everything was server side, you could sit in orbit on one system and swap gear and your in-game character on the other system would instantly do the same thing through the servers.

You could do the old Halo style guardian glitch and kill friendly players in PvE and obviously use it to instant swap exotics around in crucible etc. Oddly enough, crucible seemed to calculate “unknown origin” bullets for very little damage, so you couldn’t actually betray people unless you sat there unloading a couple of shotgun magazines into someone afk. But we just used it to troll people in patrol and raids.

Ha, I never knew about that one! That is clever!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by DoroFuyutsuki

So are you treating the static elements like templates and then saving the full item's properties into a database to cut down on references, or are you linking all the base values into the instance through reference and only storing deltas in the hash?

Both approaches have their advantages and disadvantages, mainly in how affecting individual instances of items takes place. Very curious to know if you've taken an approach of de-normalization here as I have an analogous case at work that is under live development.

Oh yes, it is more like deltas - though not strictly. The two have very different schemas, and not everything in the definition has the potential to have a live data override: and many live data properties are more "derivative" than a direct overriding of a definition property. For instance, the definition has properties pertaining to how sockets are first initialized, but all that content strictly exists for initialization purposes and then ends up as a different set of data once initialized.

As far as referencing them at runtime, the game side can locate definitions quickly because on their side these definitions are in sequential arrays and referred to by index which allows for very quick retrieval of that static data on demand. The live data for a character will store instance IDs for an item, and also it essentially stores the index of that item in the definitions, at least by the time the characters inventory is pulled into memory. (There are additional complexities in the game client that I am not well versed in, I can only really talk about the server side)

Bungie.net uses hashes of internal identifiers for these entities instead, despite the extra expense in lookup efficiency, because we have a greater need for content version agnosticism: that is to say, we can't guarantee that our definitions are in sync with the game at all times, and so if we too used indices then our index might point to a different item. (There are other reasons as well, for instance we might have our own configuration that refers to some entity in the game to build up extra information, and we need a content version agnostic way to refer to them in such configuration) This is also why you may note that the API turns off certain features like Vendors during game deployments. There are a couple of systems where we cannot safely rely on these identifiers as being truly content version agnostic, and thus to prevent showing incorrect data the systems are disabled until the content is brought back into alignment with the game! It's some ugly cruft that I would like to see resolved someday, but if you have ever spotted that and wondered why, that's the reason!

over 4 years ago - /u/EdgarVerona - Direct link

Originally posted by DoroFuyutsuki

This is very intriguing. Thank you for the deeper dive into the systems underpinning this facet of the game.

No problem! Glad it is interesting, and hopefully it's helpful!