For example: where is the code in Unreal Engine that deals with the player picking up a weapon?

Is this an acceptable type of question?

What about a more general version: how can I find the code for different systems in CryEngine?

  • 3
    \$\begingroup\$ If you have an argument for "Yes we should and this is why" I encourage you to post it as an answer. \$\endgroup\$ Commented Aug 20, 2014 at 16:25
  • \$\begingroup\$ @SpartanDonut I don't have an argument for either side. I'm just wondering what the community thinks. \$\endgroup\$ Commented Aug 20, 2014 at 19:25
  • \$\begingroup\$ Sure. No worries there :) \$\endgroup\$ Commented Aug 20, 2014 at 19:40

2 Answers 2


Absolutely not.

I don't think it matters what the content or circumstances around the question are. I cannot think of an example of a question along the lines of "Where is the code for X?" isn't an XY problem.

The following example scenario was provided as a counter argument to this:

"I may know how to implement an achievement for picking up a specific weapon, but not know where the code is located."

This is clearly an XY problem because the question assumes that their solution includes finding the code for how to pick up a specific weapon. The reality is that the code for picking up a specific weapon may not exist. Even if the code did exist, maybe the engine contains the ability to handle certain triggers such as picking up a weapon? Maybe there is an OnItemPickup event that the askers code could hook onto? Wouldn't these be better solutions than modifying engine code directly?

If the asker had asked something more like "How do I implement awarding an achievement on pickup of a specific weapon?" instead of "Where can I find the code for picking up a specific weapon?" we end up with a better quality question and a better quality answer that more people are going to be able to use because of it.

One final note, if the solution to a problem actually requires locating and modifying code it will be answered as such regardless of what the question is. If the question is an XY problem (Where is the code for...) I would say 99% of the time the question should be edited / improved to remove Y.


The second question, "how can I find..." is too broad and not game-development specific (the art of navigating a complex code base is generally discipline-agnostic).

The first question is, I think, not good. It's an XY question. That is, you are asking about what you think is the solution, rather than the actual problem you are trying to solve. That certainly makes it a bad question, but does it make it off-topic entirely (and thus suitable for closure)? I still think so; I don't think it's our job to host questions that effectively serve as documentation for third-party source code.

I think at an appropriately-high level of granularity (such as "what file handles the picking-up of weapons?) this may be okay. I'd be willing to let a few such questions exist and see how they work out. However, I worry about the fuzzy line between appropriately-granular and too-granular ("where's the function that gets called to enumerate available D3D adapters?") and about the time-sensitive nature of the queries if phrased improperly.

  • 2
    \$\begingroup\$ I disagree that the first example should be considered an XY question. I may know how to implement an achievement for picking up a specific weapon, but not know where the code is located. Ideally, those example question titles would be followed by a question body that goes more in depth so in the case of an XY question, an edit can be made. \$\endgroup\$ Commented Aug 19, 2014 at 15:58
  • 1
    \$\begingroup\$ Yes, if there is substantial additional information in the question itself, it can be fine. I'm still not sure about the applicability of essentially documentation questions. At what point do we draw the line? Asking for the files where the code exists is probably something that will have a stable (in time) answer for a given version. But asking where individual functions are? Asking for individual lines? I worry a bit about the time-sensitive nature you can have when you get extremely granular, is all. I think we could certainly try them and see how they go. \$\endgroup\$
    – user1430
    Commented Aug 19, 2014 at 16:05
  • \$\begingroup\$ I imagine the line we draw would be as specific as the answerer could get. While picking up a weapon may fall into a single function, driving a vehicle may be contained in a single file. However, the OP should not be expected to know this prior to asking. \$\endgroup\$ Commented Aug 19, 2014 at 16:15
  • \$\begingroup\$ Yes, I mean from the perspective of the question (that is, "where's the code for picking up weapons" is perhaps fine, but "where's the function that gets called to enumerate available D3D adapters" is starting to get a little too specific. I guess you could give that more leeway if the problem details were sufficiently broad. I don't know. I'm very curious to hear from people other than myself (and you) on the topic though. \$\endgroup\$
    – user1430
    Commented Aug 19, 2014 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .