Create an offline in-game Wikipedia for lore browsing?

Hey there.

I’ve been trying to think of ways to create a sort of Wikipedia or series of webpages with information related to characters, vehicles, locations, and more that the player can access if they choose to. This serves as a way to obtain additional lore about the world by accessing it through a console at the game’s hub world/headquarters.

I know enough html to make some simple files that have text (Hello world!), but the goal would be to create hyperlinks, show photos, and possibly play music(Is that even possible?).

Under the Edit menu>Plugin>Widgets there’s a Web Browser plugin, which if enabled allows you to load webpages in a widget. Tesla Dev has a great tutorial that got me started.

What I’d like to do is package the webpages with the game and use the above plugin to access them, but I’m not quite sure how to do such a thing. I come into a problem.

From the testing I’ve done so far, I can put a simple HelloWorld.html file in with the game files and point the WebBrowser Widget’s Initial URL to the file location (C:\Program Files\GameName\Content\HelloWorld.html). This opens the webpage which is neat.

The issue I see happening is that file locations change. Not everyone is going to install the game in the same directory. How do you work around that? Is there a way to grab the file location? How do all the hyperlinks work between the webpages then? (That last one is probably covered in an html tutorial)

Anyhow, any feedback is appreciated. And if anyone knows a better method please let me know.

Use relative paths from FPaths::GameDir(). It’ll always return the root folder of the installation.

The same way they do on the web, with relative paths.

I apologize, I’m not very well versed in programming. I’m familiar with blueprints, but could I see an example of how you use FPaths::GameDir()?

Would you put that into the Initial Url like FPaths::GameDir(Content\HelloWorld.html)

Thank you.

Assuming you have the standard folder structure of a packaged game, with your html content added like this:


Root Installation Folder
- GameName
  - Binaries
    - ...
  - Content
    - ...
  - Lore
    - index.html
    - ...
- Engine
  - ...
- GameName.exe

Then you would get a path to index.html with


FString Path = FPaths::GameDir() / TEXT("Lore/index.html");

which you can then pass to the web browser. If you want to do that with blueprints, I have no idea, sorry.

That would be ideal if anyone has a clue on how to do that, but if not…

Where or how would I get started on learning to use that code? Where do you even input code like that? I’ve been using blueprints for the last year, so this would be my first time tackling actual code.

The game is actually a small portion of a sci-fi story that’s already been written but not published. The lore (character profiles, places, items, events outside the scope of the game, etc) are already written, it’s just a matter of organizing the data into a sort of Wikipedia that the player can access for additional information about the universe they’re in.

I could create a Prey style computer interface with blueprints that a FPS character can access by activating buttons on the screen, but that takes just as much time if not more.

However, I just don’t know anything about C++ or programming in general (aside from blueprints). It’s all completely foreign to me but I’m willing to learn it if it means accomplishing my goal. I’m just not sure where to start, or if there’s a blueprint alternative.

I’ll take a look at the data tables, thanks.

One other thing, I just thought of an example of where something like this is actually in use in a video game. In GTA5 they have that fake internet.