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.
User avatar
arrow in my gluteus
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Raycasting engine in factorio

Post by arrow in my gluteus »

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 16455 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.
--------------------------------------------------------
explanatory videos:
architectural changes: pipeline design
trigenometry
blueprints
If you use these, please provide credit where possible/appropriate
v2.0 iteration 1:
v2.0 iteration 3:

--------------------------------------------------------
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 Nov 24, 2020 4:38 pm, edited 11 times in total.
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Raycasting engine in factorio

Post by Bilka »

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: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Raycasting engine in factorio

Post by MeduSalem »

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
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

Bilka wrote: Tue Apr 23, 2019 5:21 pm This is incredible.
Thanks
adam_bise
Filter Inserter
Filter Inserter
Posts: 442
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Raycasting engine in factorio

Post by adam_bise »

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
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

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
Filter Inserter
Filter Inserter
Posts: 442
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Raycasting engine in factorio

Post by adam_bise »

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
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

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: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Raycasting engine in factorio

Post by Qon »

Good job, I'm impressed. Can't really say much more because this is beyond what words can express. Thanks for doing it. :)
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: Raycasting engine in factorio

Post by Dominik »

Very cool!!
dee-
Filter Inserter
Filter Inserter
Posts: 416
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: Raycasting engine in factorio

Post by dee- »

ImageImage

This is geniously insane. Also wastly underviewed :)

Proper raymarcher next?
User avatar
arrow in my gluteus
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

dee- wrote: Wed Apr 24, 2019 5:00 pm This is geniously insane. Also wastly underviewed :)
You can help mitigate that.
MaexxDesign
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Tue Jun 21, 2016 9:59 am
Contact:

Re: Raycasting engine in factorio

Post by MaexxDesign »

I N S A N E
Maddhawk
Fast Inserter
Fast Inserter
Posts: 125
Joined: Sat May 05, 2018 6:53 am
Contact:

Re: Raycasting engine in factorio

Post by Maddhawk »

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: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Raycasting engine in factorio

Post by Koub »

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
Inserter
Inserter
Posts: 48
Joined: Fri Mar 01, 2019 1:14 pm
Contact:

Re: Raycasting engine in factorio

Post by DoubleThought »

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
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Raycasting engine in factorio

Post by quyxkh »

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
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

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
Filter Inserter
Filter Inserter
Posts: 545
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Raycasting engine in factorio

Post by Amarula »

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.
My own personal Factorio super-power - running out of power.
User avatar
arrow in my gluteus
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Apr 24, 2017 1:52 pm
Contact:

Re: Raycasting engine in factorio

Post by arrow in my gluteus »

if anyone is interested you can follow along with the development of version 2.0 of this raycasting engine on my second channel: https://www.youtube.com/playlist?list=P ... Le9xX_7tjb
Post Reply

Return to “Combinator Creations”