Skip to content

Thad writes blogs

this is a lot more work than i expected

Menu
  • About
  • Pin Posts
Menu

Advent of Code in Unreal Engine – Boilerplate Part 1

Posted on November 27, 2022November 30, 2022 by Thad

I enjoyed last years Advent of Code. I solved all the puzzles, eventually, and my solutions (all c++) can be found on github, here: https://github.com/codemonkey-uk/aoc-2021.

I thought this year I’d try to do it in Unreal, and more specifically, in UE5.1 and focus on solving in Blueprint. I don’t expect this to make it easier, except perhaps in some specific cases, but instead am doing it for the challenge and interest. Today I wanted to do some prep.

To give my prep some direction, I am re-solving Day 1 from 2021. By working through some of last years puzzles I hope to get the inevitable boiler plate code and project set up done so I can hit the ground running on December 1st on Thursday.

The puzzles usually have some text input that needs to be parsed, so I thought I’d see if I could get that direct from the site, rather than manage files or set up string-table assets. To get access to the Http engine code, I installed the HttpBlueprint (Beta) Plugin, currently on its v1 release from Epic.

You have to be logged on to get the puzzle input, but that’s straightforward to set up using the “cookie” header:

To see how to get the cookie value for your AoC session, see: https://colin-fraser.net/post/a-quick-tutorial-on-importing-data-from-advent-of-code-into-r/

Then you can make the GET request using those headers:

Somewhat surprisingly I had to now dip into C++ to break that string into lines, because the Parse into Array (node) doesn’t support special characters, and FString::ParseIntoArrayLines isn’t exposed to Blueprint, so I created a C++ blueprint function library:

And with that we have the boilerplate to get the puzzle input and can process lines we can parse to integers and pass to the logic for the Day 1 puzzle:

And the solution (with logging), in Blueprint:

https://blueprintue.com/blueprint/le1ege0x/

1 thought on “Advent of Code in Unreal Engine – Boilerplate Part 1”

  1. Pingback: Advent of Code in Unreal Engine – Boilerplate Part 2

Leave a Reply Cancel reply

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

Archives

  • October 2024
  • January 2023
  • December 2022
  • November 2022

Categories

  • Food
  • meta
  • Uncategorized
© 2025 Thad writes blogs | Powered by Minimalist Blog WordPress Theme