Does anyone want this? Find source examples as a service in docs

To be clear, the point of posting this is to find out if anyone is:

  • Interested in helping build this
  • Knows if something similar already exists
  • Would want

I wanted to put out an idea I had this morning, whilst reading the unrealengine Reddit. They were complaining about the documentation, which is fair in the sense that the docs are usually not a “one stop shop”. Rather it’s your first stop on a tour of video tutorials, source code, etc.

Well, we do have source code, available for free:

  • Engine
  • UT
  • ShooterGame
  • Action RPG
  • RTS sample

It’s just not hooked up to the docs.

If we could automatically find usages in the code, we could then put those into the docs, rather than manually going and searching for this ourselves, every time, across multiple projects…

“But how do you add things to the docs? We’d need Epic to support this etc. etc.” - A chrome/firefox plugin or greasemonkey script should be able to patch this in. I was a frontend js developer in a past life. It can be done

The crux is actually getting the search results, which is slow and expensive. These projects are all quite large, so you’d need heuristics such as only including the first few occurrences, abandoning searches that take too long, etc. There are things like this, but I seriously doubt they are up to the task:

So, if you want something serious, you look a little more and find GitHub - mozilla/dxr: Powerful search for large codebases
DXR: “DXR is a code search and navigation tool aimed at making sense of large projects like Firefox. It supports full-text and regex searches as well as structural queries like “Find all the callers of this function.””
Example (it is indeed quite fast)

Oh well that’s pretty nifty, but how do I use it? You need a linux machine, running a docker container, which can act as an API. So let’s get this straight we need a:

  • Browser extension/plugin which can monkey patch results from our
  • Source code searching engine hosted in docker land, probably via AWS/Azure or whathaveyou, which is accessed via an
  • API which accepts a UE API docs URL and transform this into a search query return the results

Each one of these pieces is relatively straightforward but as a project it could take a reasonable amount of effort considering the range of knowledge required

And then of course there are improvements that are not 100% essential to the basic functionality but that would be nice

  • Making sure the server is not super expensive, getting funding for the server
  • Having a basic up/down vote system for the examples to improve the visibility of higher quality examples (ones that are commented and clear)
  • Dealing with versions, differentiating which project the source code came from, adding more example projects…

This is just a thought experiment, I can’t really tell if it’s a good idea or not. I do have the time to make it, but it would take longer to make than it’d be worth just for myself.