# Ancient Gate Foenestra Anomaly

On January 5th, 2024 I wrote this very long winded post explaining the hardest puzzle I've ever come across by exponential margins. In order to get to the point where one can even think about solving this puzzle they have to play a Factorio mod called Space Exploration for at least 500 hours. After one has established bases on at least 7 different planets, mined and processed millions upon millions of different resources into end product, and essentially beaten the game... this puzzle serves as the end end game; an alternate win condition that actually gets the player home instantly through a portal.

The storyline on the vanilla version of the game is shrouded in mystery. You simply wake up crash-landed on a bug-infested planet with amnesia having no idea who you are or what you're supposed to be doing. The win-condition in vanilla is to simply launch a satellite into space to call for help (takes about 80 hours on the first try). The Space Exploration mod allows you to set up a research facility in orbit and acquire 9 new resources from other planets or asteroid fields that can then be transported by cargo rocket or spaceship and a lot of fuel. I'm guessing it would take a new player around 1000 hours to win an SE game due to having to learn basic things like how trains and circuits work. Simply getting to the end in any way possible is an insane achievement. I assume most gamers never make it, nor are they necessarily supposed to. It's the forever mod of the game.

### Origin Story

In any case when the Anomaly is found (after doing dozens of deep-space explorations that usually reveal asteroid fields) it provides some insight as to why the hero came to this quadrant in the first place. A corrupted ship's log shows that the player actually collided with the ancient gate on a much bigger ship, only to escape and crash land again on the starting planet of Nauvis (pronouced novice).

Once the gate is repaired and powered there is very little indication of how to operate it. There are 64 symbols in the ring that look like glyphs or constellations. Eight of these must be locked into the terminals for the gate to activate. The result of gate activation is either that the portal goes nowhere and shuts down or it goes somewhere and bugs pour out of the portal. It's assumed that there must be some sort of winning combination that will get you back home, but the number of brute-force combinations available is 60*64^7 = 263,882,790,666,240... so we need some kind of heuristic to narrow that down a bit.

https://www.reddit.com/r/factorio/comments/14elu0n/kr2se_stargate_victory_achieved/

#### Let the "cheating" begin

I wasn't exactly interested in figuring out the puzzle on my own at a certain point because of how impossibly difficult it was. After much searching I found this reddit post of a guy who brute forced the puzzle using a little bit of knowledge of how it worked. I'm pretty sure this guy must have spent at least 30 hours using this method, as opening a portal even once takes a significant amount of time due to needing to rotate the glyphs and activate them 8 times and wait for the thing to open and then reset. By the sound of his brute force strat I'd guess he opened the portal at least 200 times and also had to figure out which guesses were the closest to the destination.

### So what did I learn?

The map of the universe in which the stargate interacts with is a D60 die. Each unit-vector comes out of the center (0,0,0) and goes through the middle of the corresponding triangle. This is the first glyph in the stargate so there are still 7 more to find after this one.

To find the other positions: another 64 triangle map is laid inside the one that just got discovered. It's a recursive solution. Every time a triangle coordinate gets found a new tringle map is placed inside of that triangle which is used to find the next glyph. As more glyphs are found the position becomes exponentially more and more accurate. Remember that there are 263,882,790,666,240 triangles total on this one D60 die which represents the entire universe.

Upon realizing just how complicated the math is here I realized that this was very obviously a repurposed school project. It's far too advanced for the creator (Earendel) to have just come up with on the fly. In fact it's so advanced it's pretty obvious he's some kind of math major and this was far beyond the scope of a bachelors of science. Gonna guess master's thesis.

### So how to solve?

In my last post I pasted several of these puzzle pieces thinking someone would be able to help me out. Now I realize how foolish that was. There was no way anyone on Hive was going to be able to get the solve here. It's that complicated. Not only that I didn't have all the puzzle pieces yet... because getting all 60 required that I personally visit 60 different planets with pyramids on them and go inside to get the screenshot. I did this a few months back and got all 60 and slowly worked on the puzzle over time.

The big centerpiece rune hints at the location of that particular place. The smaller constellations around it were not needed... but I believe they show the locations around that position on the initial D60 die (completely unhelpful except for the very first rune). However, the smaller triforce at the bottom is a piece of the generic solution 64-triangle map. This took several hours to put together.

##### I saved various states of progress just to show you guys how crazy it is.

### My timestamps show I did this on February 23rd. BTC trading at $50k right before we mooned to ATH.

##### I had to use the red triangles to delete the unneeded overlapping sections.

#### The triangle in the middle is the one that matches the specific rune, while the 3 triangles around it are that position's neighbors.

I figured this part out on my own.

## So close...

### FINALLY

Solving this puzzle and getting it into a digital file like this took over 5 hours judging by all the timestamps. I was going to just do it with a pen and paper, which would have been faster... but I'm glad I have this to show for it. Now anyone looking to solve this puzzle can use the above image to help them out.

### Superimposing the glyphs

Everyone's puzzle gets shuffled around so that nobody will have the same answer. The triangle above is the generic solution for positioning, so the actual glyphs of that particular game need to be superimposed onto the correct spot... like so...

### Notice the four that don't have glyphs associated with them?

These four are built-in directional glyphs that everyone has access to.

### Up / Left / Right / Zero

The "A"-shaped glyphs point to one of the corners while the triangle glyph itself is a zero-placeholder that doesn't change coordinates at all. The zero placeholder is definitely the most powerful glyphs as it becomes great for testing and seeing where things are without further modification.

### Pattern research

To give an example of the power of the placeholder... the research one can do in game will tell the player exactly where a glyph is located on the D60 die (first slot). Using the placeholder we don't have to wait for research to finish and can calculate placement manually. This would be the first coordinate followed by 7 triangle runes.

This is also why the first coordinate can't contain these four directional symbols. These directions do not exist on the D60 but rather the 64 triangle map constructed above.

#### So after all that wtf do I do?

Finding the starting point can be tricky, but I was deep into my game and had already done a bunch of pattern research. One of the patterns I found had coords close to the ones shown in the ship's log.

### Close enough?

To make sure I had found my starting point (looked like a sideways "S") I plugged that glyph into the first slot of the stargate (which starts on the left-bottom side and runs clockwise from there). I then followed it with the A-directionals 3 times to get all three corners of the triangle.

### The raw numbers were confusing.

So I decided I needed to actually plot these lines on a 3D vector simulation. I found a good enough solution here:

### https://academo.org/demos/3d-vector-plotter/

#### Static picture doesn't do it justice.

It's hard to tell but when you rotate the object around you can see if the destination vector is inside the triangle created by the corners. My first position looked to be just barely inside on the edge. Success!

After getting the first glyph right the player must employ a guess and check method to try and figure out the second one. This is done by imagining the triangle we built put inside the triangle we just found.

Given where the destination vector was vs the corners I guessed the next glyph was somewhere in this area at the top and to the right. It didn't take long for me to lock in my second position. Progress is slow but there's at least progress. Now I only need to find 6 more to solve the most complex puzzle ever.

After solving the first few glyphs the vectors becomes so tight-knit and accurate that it becomes impossible to see what's going on. To combat this I started deleting repeating significant digits at the beginning of the coordinates. Sometimes this would create warped triangles but it still seemed to work so I pressed on.

Here we see by the time I got to this point of trying to find the fifth slot I'm deleting 4 significant digits just so I can keep guessing and checking. There's definitely a purely mathematical way to solve this but I'm not about to figure all that out. Guess and check continues.

#### THE STRUGGLE IS REAL

Here we see my guess and check failing pretty hard. Each one of these vectors takes a significant amount of time to create as every rune on the stargate has to be exactly right and there are 64 of them on the wheel that need to be rotated around like an analog rotary phone.

At this point I have to delete 5 sig figs from the coordinates just to be able to triangulate the eighth and final point. Eventually I succeed... but...

#### I get the solve.

At this point the player has messed with the stargate for so long that they've named every important constellation. It took seven hours of guess and check triangulating to get here.

- Side-'S'
- Knife Man
- Phoenix
- Pantheon
- Green Candle
- Evil Corp
- Weird Guy
- Hanukkah

I get to the EXACT coordinates within the corrupted ship's log... and nothing has happened. Wow. Seven hours down the drain just for a fail. That's frustrating. What happened?

#### 18 minutes into the video

This guy explains that the ship's log coordinates are not a location, but rather a trajectory. So you're supposed to actually multiply these coords by -1 to travel back into the opposite direction. I was absolutely infuriated by this because every indication of the puzzle implies that this is a map we are building... not a trajectory.

It would be like saying China is in a different location on the globe based on what country we are in, which is absolutely ridiculous. This globe of the universe says in the tooltip it's built from the background radiation of the Big Bang. This would mean everything inside of the D60 sphere was what the universe looked like at a previous time. I have to say this is an epic troll by the creator Earendel and I was pretty pissed.

#### The next day...

I was so pissed over this yesterday that I didn't even write a post and just set out to finally solve this ridiculous thing. Full on rage blackout. Of course upon looking at my new coordinates I noticed that none of them even came close... and I had to check the locations of 10 positions before I even found my starting constellation aptly named Headcrusher.

Unfortunately after finding the second glyph I began to realize that the https://academo.org/demos/3d-vector-plotter/ website was no longer going to serve my needs. For some reason this website doesn't allow you to rotate the camera into the negative-Z direction and look underneath the vectors being drawn. On top of this my strategy for deleting significant figures was failing, resulting in warped triangles that were not super helpful.

At this point I decided to take my girlfriend's advice and download a 3D modeling program called Sketchup. This is a program that costs $120 a year to use but has a one week free trial. After an absolutely enraging learning curve I started better visualizing the triangles as seen above. The blue line is where I'm trying to get.

Here we can see two incorrect guesses on the constellation PI (looks like a pi symbol). In order to create these shapes I had to dig deep and find a way to access the program's coordinate system (which wasn't easy). It's very stupid... but if you draw a line and check the properties of that line... it doesn't tell you where the line begins and ends. All it tells you is the length of the line, which can be modified, but apparently coordinates can't be (after doing like 20 Google searches on people asking the same questions).

After like an hour of being infuriated with the program I finally found a solution via the Ruby console. I was able to inject Ruby code directly into Sketchup in order to solve the multiple problems I was having (including not being able to copy/paste coordinates from outside the application into the application).

Here's a screenshot of me learning an important lesson about positioning. The highlighted point has three ways of getting to it.

- The top of glyph "Box".
- The right of glyph "PI". (flipped because it's upside down)
- The left of glyph "Broken Bow".

This became useful to eliminate duplicate guesses. Of which I had done many at this point.

glaive (top/right/left): -0.47070808560223, -0.88110777548465, -0.045639742869233 -0.48764234788438, -0.86446706187525, -0.12207227155495 -0.41041701529678, -0.90715839632156, -0.092852127267906

Sketchup.active_model.active_entities.add_line([0,0,0], [-470708.0856, -881107.7754, -45639.7428] )

Sketchup.active_model.active_entities.add_line([0,0,0], [-487642.3478, -864467.0618, -122072.2715] )

Sketchup.active_model.active_entities.add_line([0,0,0], [-410417.0152, -907158.3963, -92852.1272] )

##### Here's some example Ruby code that shows how I'm making these shapes.

I was taking the in-game coordinates and then multiplying the number by x1000000 to increase the accuracy and the scale within Sketchup. The units here are measured in meters, so I'm creating shapes here that are hundreds of kilometers long to get the needed accuracy. And still even that almost wasn't enough.

#### And then... there was one.

See those four tiny specs inside the green triangle? That's the second to last position with the blue dot being our final destination. I can't zoom in any farther than this, as doing so pushes us through the shape and no longer shows what we need to see. From here I was able to see that the target vector was near the bottom of the triangle after much squinting. Shockingly it only took me two guesses to find it.

- Headcrusher
- Glaive
- Box
- Pantheon (same position as the first time crazy enough)
- Elephant
- Evil Corp
- Windup 5
- Hanukkah (also the same as before)

After this game running for 932 hours straight (some of it idle farming) I had finally done it. The hardest puzzle known to man was solved. Now I can die angry :D

### Conclusion

In for a penny, in for a pound. I got way more than I bargained for on this one, and it's actually pretty insane as to the lengths I was willing to go to get the solve... right down to downloading a professional 3D modeling app and injecting Ruby commands directly into the console. End of an era.

Return from Factorio Space Exploration: Foenestra Anomaly Stargate Puzzle Solved to edicted's Web3 Blog