Raycasting engine in factorio

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Raycasting engine in factorio

Post by arrow in my gluteus » Tue Apr 23, 2019 5:15 pm

I've made a raycasting engine inside factorio.
I call it FactoRayO v1.0
It allows you to play simple 3D games inside factorio.

https://youtu.be/7lVAFcDX4eM

No explaination of how it works here (might put one later), because a lot of information is already in the video.
-------------------------------------------
a screenshot:
3dthumbnail.png
3dthumbnail.png (1.52 MiB) Viewed 3351 times
you can download the map here: https://drive.google.com/file/d/11jeOkZ ... sp=sharing
(had some trouble uploading the file, drive link will have to do)

If you open the map you will still be in god mode. I used that to make sure the player character wasn't zooming back and forth when recording just to press the buttons.
If you want to disable god mode, type this in chat:

Code: Select all

/c game.player.create_character()
--------------------------------------------

A new frame is generated and displayed every 45 game ticks. And I only get about 20 UPS when using this map, so this video is sped up about 135 times to compensate.

Some clarification about vanilla. When I say vanilla it means it works completely in vanilla. However mods were used to help build it (for example creative mode to get materials for free) and film it.

credits for external resources used:

design for the screen: DaveMcW
viewtopic.php?t=37490
(I did not use the original but a modified version)

idea for the user input mechanism: Kleeb
https://www.reddit.com/r/factorio/comme ... s/efyjo9r/

power generation: Hunter / Claudio Périco
https://factorioprints.com/view/-Kp1YWKm_JIXUisCB1lo
https://www.youtube.com/channel/UC3r-Y4 ... snXGGjbGSD

music (in order used in video, you can find them in the youtube audio library):
Heaven and Hell - Jeremy Blake
New Land - ALBIS
Ticker - Silent Partner
Water Lillies - Density & Time
Righteous - Silent Partner

pixel art fonts:
https://www.dafont.com/04b-30.font?text=You+Win%21
https://www.dafont.com/fipps.font?text=subscribe
https://www.dafont.com/pixel12x10.font?text=Game+Over

image assets:
paper background: Designed by rawpixel.com / Freepik
camera icon: by Iconnice for flaticon.com https://www.flaticon.com/free-icon/vide ... osition=81 -

help translate my videos:
http://www.youtube.com/timedtext_video? ... lVAFcDX4eM
http://www.youtube.com/timedtext_cs_pan ... 6TRYMTHMwg
twitter: https://twitter.com/ArrowGMaximus
Last edited by arrow in my gluteus on Tue Apr 23, 2019 7:42 pm, edited 3 times in total.

Bilka
Factorio Staff
Factorio Staff
Posts: 2122
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Raycasting engine in factorio

Post by Bilka » Tue Apr 23, 2019 5:21 pm

This is incredible.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1349
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Raycasting engine in factorio

Post by MeduSalem » Tue Apr 23, 2019 5:29 pm

Now off to playing Doom or Wolfenstein 3D in Factorio.

Kinda makes me remember that Turkey Puncher Arcade game within the mess hall in the first level of Doom 3.
Last edited by MeduSalem on Tue Apr 23, 2019 5:29 pm, edited 1 time in total.

User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus » Tue Apr 23, 2019 5:29 pm

Bilka wrote:
Tue Apr 23, 2019 5:21 pm
This is incredible.
Thanks

adam_bise
Fast Inserter
Fast Inserter
Posts: 181
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Raycasting engine in factorio

Post by adam_bise » Tue Apr 23, 2019 6:32 pm

Wow!

How did you come up with the ray casting method? How long did all of this take to put together?

Now you just gotta figure out transparency =D

User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus » Tue Apr 23, 2019 6:41 pm

adam_bise wrote:
Tue Apr 23, 2019 6:32 pm
How did you come up with the ray casting method?
Just trying different things in my head, until I found one that was feasible. Went through multiple designs before I even opened up factorio.
adam_bise wrote:
Tue Apr 23, 2019 6:32 pm
How long did all of this take to put together?
About a year? It's hard to tell, because I don't just start working on something like this. I wonder if it would be possible and that gradually transitions in working it out in my head.
adam_bise wrote:
Tue Apr 23, 2019 6:32 pm
Now you just gotta figure out transparency shading =D
You may notice a v1.0 in the title. I didn't build the whole design in my head to be able to release sooner.

adam_bise
Fast Inserter
Fast Inserter
Posts: 181
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Raycasting engine in factorio

Post by adam_bise » Tue Apr 23, 2019 7:01 pm

Had you wrote a 3D game engine outside of Factorio? Seems like something so complicated would be even more complicated using combinators.

Also, if you ever make a single player campaign lol, you should use this for the music =D https://www.youtube.com/watch?v=K1oRQX8xQeg

Between this, the sequencer above, the controller method (first time I've seen it) and daveMCW's player for FMV sequences, you've got the pieces for a full game =)


Just amazing. Hats off to ya.. I can barely figure out a few combinators at once lol!

User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus » Tue Apr 23, 2019 7:19 pm

adam_bise wrote:
Tue Apr 23, 2019 7:01 pm
Had you wrote a 3D game engine outside of Factorio? Seems like something so complicated would be even more complicated using combinators.
It's my first.

Qon
Smart Inserter
Smart Inserter
Posts: 1240
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Raycasting engine in factorio

Post by Qon » Tue Apr 23, 2019 8:53 pm

Good job, I'm impressed. Can't really say much more because this is beyond what words can express. Thanks for doing it. :)

Dominik
Factorio Staff
Factorio Staff
Posts: 645
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: Raycasting engine in factorio

Post by Dominik » Wed Apr 24, 2019 9:50 am

Very cool!!

dee-
Filter Inserter
Filter Inserter
Posts: 390
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: Raycasting engine in factorio

Post by dee- » Wed Apr 24, 2019 5:00 pm

ImageImage

This is geniously insane. Also wastly underviewed :)

Proper raymarcher next?

User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus » Wed Apr 24, 2019 5:22 pm

dee- wrote:
Wed Apr 24, 2019 5:00 pm
This is geniously insane. Also wastly underviewed :)
You can help mitigate that.

MaexxDesign
Inserter
Inserter
Posts: 46
Joined: Tue Jun 21, 2016 9:59 am
Contact:

Re: Raycasting engine in factorio

Post by MaexxDesign » Fri Apr 26, 2019 5:47 pm

I N S A N E

Maddhawk
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Sat May 05, 2018 6:53 am
Contact:

Re: Raycasting engine in factorio

Post by Maddhawk » Sat Apr 27, 2019 12:00 am

First question: What do you do for a living? I ask cause I am wondering what helped you develop the skills to pull this off.
Second question: How did you decide on where to begin developing something like this, both this and Pac-Man?
Third question: How much math did you need to employ when figuring this out?
Fourth question: How did you go about prioritizing the order for developing each part?
Fifth: Just HOLY CRAP! I almost felt like you were channeling John Carmack while making that, cause I immediately thought of Wolfenstein and Doom.

Koub
Global Moderator
Global Moderator
Posts: 5032
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Raycasting engine in factorio

Post by Koub » Sat Apr 27, 2019 7:16 am

I just realized I was so speechless when I first saw this that I forgot to express my speechlessness (which makes sense on a second thought).
This is mindblowingly insane.
And you just terminated me with that 2 player thing.
Koub - Please consider English is not my native language.

DoubleThought
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Mar 01, 2019 1:14 pm
Contact:

Re: Raycasting engine in factorio

Post by DoubleThought » Mon Apr 29, 2019 12:12 pm

Maddhawk wrote:
Sat Apr 27, 2019 12:00 am
First question: What do you do for a living? I ask cause I am wondering what helped you develop the skills to pull this off.
According to him on Reddit, he's a student, currently studying Computer Science at some university.

quyxkh
Filter Inserter
Filter Inserter
Posts: 747
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Raycasting engine in factorio

Post by quyxkh » Mon Apr 29, 2019 2:51 pm

That's some seriously next-level wizardry. For some reason it made me think of Will It Go Round In Circles, I have no explanation for that but there it is.

User avatar
arrow in my gluteus
Inserter
Inserter
Posts: 46
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus » Thu May 02, 2019 11:40 am

Maddhawk wrote:
Sat Apr 27, 2019 12:00 am
First question: What do you do for a living? I ask cause I am wondering what helped you develop the skills to pull this off.
I'm still a student.
Maddhawk wrote:
Sat Apr 27, 2019 12:00 am
Second question: How did you decide on where to begin developing something like this, both this and Pac-Man?
I start by wondering if something is possible. That slowly transitions into designing and testing (high level) components in my head. I go through different designs, mix things up. Once I'm confident that the design will mostly work (The simulation in my head is ofcourse not perfect, and the design gets improved while building) I start up factorio and just start building.
Maddhawk wrote:
Sat Apr 27, 2019 12:00 am
Third question: How much math did you need to employ when figuring this out?
Actual math, as in "doing the math" and not just approximations. Not much actually.
I did the formulas for implementing sin() on paper. And made sure I had enough significant bits to avoid too many rounding errors. And I worked out at what distances I should scale the textures. And that's about it.
Maddhawk wrote:
Sat Apr 27, 2019 12:00 am
Fourth question: How did you go about prioritizing the order for developing each part?
I start with the stuff most likely to go wrong (fail early), and then just follow the flow of information through the system.
I think I started with modifying the screen. Then did the sin() function, tested if they worked properly.
Did the fish eye correction, simplifying the world. Midpoint iteration. Then a simple texture. Copied the whole thing down and connected the copies together. Tested with some test map. Debugged a bit, copied the fixes down. Added the controls. More debugging, more copying fixes...

In fact I have multiple versions of the map, If you want I could show you how it looked at different stages of development.

Amarula
Fast Inserter
Fast Inserter
Posts: 172
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Raycasting engine in factorio

Post by Amarula » Thu May 02, 2019 1:14 pm

Let me add my speechless voice... this is... inconceivable!
(thanks Princess Bride for a word where there are no words)

Thank you, arrow in my gluteus, for opening up worlds more possibilities in Factorio.

And thank you to all the developers for creating a game where work like this is possible.

Post Reply

Return to “Combinator Creations”

Who is online

Users browsing this forum: No registered users