Sprites in a 3D World | E3. Crazy Fun Raycasting
VloĆŸit
- Äas pĆidĂĄn 21. 07. 2024
- How to make a simple 3d game (Raycaster) in Scratch. In this episode we project a 2d sprite (entity) into our 3d raycast world. We also fix the camera so that we have accurate straight lines, and can zoom like a real camera with Wide Angle and Telephoto views! So cool!
Don't forget to submit your projects to the studio linked below by commenting the project URL in the studio comments.
My tutorials are for all budding game & software developers using Code Blocks. Scratch On guys!
đ Next Episode #4 - âą Sprites Behind Walls (...
đ„ Bug Fixes - âą Quick Fixes for Raycas...
đ Boost Your Creativity with Griffpatch
The Griffpatch Academy will take you from "Gamer to Game Creator"
Learn more at đ griffpatch.academy đ
đș Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. See scratch.mit.edu
đ± Scratch Studio for this tutorial - scratch.mit.edu/studios/31013...
đ Part 1 - âą Crazy Simple Raycastin...
đ Full Episode Playlist - âą Crazy Fun Raycasting (...
đ Quick and Fun Tutorials - âą Quick and Fun Scratch ...
â€ïž Scratch Addons - scratchaddons.com/
đč Video Editing Software - techsmith.pxf.io/c/2682566/50...
-------------Video Chapters-------------
0:00 Intro
1:11 Begin with a Tidy up
4:21 Linear ray distribution explained
7:53 Coding the linear ray distribution
10:11 Field of View is not just horizontal
11:44 Entities - Enemies & Collectables
18:04 Preparing a 2D sprite for use in a 3D scene
20:45 Projecting the 2D sprite into 3D
24:45 Outro
griffpatch is like that one teacher who trys to be funny, cool and understanding...
...and succeeds
huh?
How can you not understand that .-. @@coldfrozenmuscles1575
How is this the top comment if it only has 30 likes
true
??? Might be a bug đ
scratch in 2022: we can finally be able to create perfect 3d game..
scratch in 2069: now how beautiful that ray-tracing graphics we are making..
Nice
Thats already possible im sure
scratch 3033: you can use the block codes to hack into russias systems and launch all of the missiles onto russia
raytracers already exist :)
@@evilfire94090 yea
I love how griffpatch shares his knowledge to other Scratchers that needed help on their projects. I often learned how to use blocks that I haven't used before.
I learned how to use the "Mod" Block from His Platformer tutorial.
i wouldnt what a custom block was without griffpatch
i'm makin one of these in python, and this was the best tutorial I could find! , even though it isn't in python, the way he makes complex concepts so easy to grasp is brilliant!
Honestly, I can't help being mind blown by the clever techniques you place in your tutorials! It's amazing!
How did he not think of a sniper scope đ
Yes his tutorials are amazing đ€©
@@vladimir6201 itâs still 3d it doesnât need that
Now I finally understand why Minecraft completely breaks when you swap the sin and cos functions. I used to think they weren't very important, but it turns out they're used a ton for rendering 3D games! I had no idea!
@@lightning_11 hrmm
This is hands down, my favorite series in all of CZcams. (I really love programming.) so ofc, griffpatchâs series are the best, and his 3D series is definately the best series out of all of the ones he had made. All of this 3D stuff is super cool, and makes me super excited. I love it!!! I hope griffpatch doesnât hold back on fear that it might get to difficult. I really love learning about all of this, and am really confident in my ability to follow along. I want to put all of this 3D stuff to itâs fullest potential.
Woohoo!!! :D
Can you release part 4? I like your coding griffpatch
@@AlexanderO_TheGamer Iâm sure heâs working on it. Just give him some time.
yaaaaaaaaaaaaaaaaaass
Ye
When I turn away from my entity, it just gets bigger and bigger until it loops back around, becomes really small, and then grows again until i'm looking back at it.
same
Same
Go to entities code and for the set VY to make sure that itâs X times sin of camera DIR PLUS NOT MINUS Y times cosine of Camera DIR that should fix it
Same idk why
Make sure that you didnât delete the purple square
you just gotta love griffpatch's videos, he's just always so cheerful and fun to watch! just how he interacts with Nano is fun and playful, and it just creates such a welcoming and happy atmosphere for the video. absolutely just a joy to watch and follow along
It would be really cool to see how to make the walls have patterns, add looking up and down, add objects and make the map bigger using some sort of scrolling mechanism. Maybe even add random or infinite map generation.
Yes, we NEED texture mapping
Yes, just, yes
I bet you could do it with lists. You could probably turn a list into a cube list instead of a grid list, and store the colors as the values for the list. When the raycaster senses a wall, it can detect what color you want by what value is in the list
This could really help with a my Windows 95 Screensaver project
@@IceGuy369 yesss
3D in scratch never ceases to amaze me
It's amazing how the projects can be created so easily with these awesome tutorials!
Hello, I love what you do and I'm a scrapper too! And thanks to you, I'm getting better and better!
Thank you for these tutorials that allow passionate scratcher like me to do things (like you) incredible!
This is probably one of the best ray-casting tutorials out there! However, I really need to be able to hide enemies and not see them through walls soon, so if you could release episode 4 soon that would be amazing!!! Thank you!!!
This is simply incredible! It amazes me that someone can create this in scratch!
me after showing this to people knowing damn well i have no clue what i did
man, i like how griff went from "easy scratch game" to TRIGONOMETRY
Can we appreciate how much effort griffpatch put into editing
So much - hehe
@@griffpatch I would think so and the editing is amazing đ€© never better
@@Ipostmemes1 idk what's the application he uses đ§, pls tell me
@@GAMEOVER-ud3rp idk either
Its scratch
hello Griff, I love your tutorials and games on scratch and am currently working on a platformer using your series. Keep up the amazing work.
Glad you like them!
@đĄ Ali's Game World đĄ Me too
@@griffpatch The tutorials are amazing
@@haticedemirgan4296 Me three!
@@griffpatch Awesome!
I still can't believe the 3D part was already made in part 2. Keep up the good work!
Grifftpatch is not only the best scratcher, but also a very good person at maths.
Dang! The quality of this video! As always, awesome tutorial! And thanks
@Kaniishh Jaey - Fortnite Fun
How is this 3days ago if this episode is only today
@@MamaMoLangNaman20 cuz he's a member
@Kaniishh Jaey - I Make Games it says day at my screen đ
@@RandomGeometryDashGuy what?
I love this type of series please continue making Videos about this 3D stuff I'm very excited!!
I love how he explains everything so well
From where we can get height plz replay
@@FitWithJenish Episode 2.
I understand the whole thing and even came up with the rotation beforehand with complex numbers but I would have never come up with this myself. Amazing work griffpatch! However I think an SDF raymarching that allows for a z position would be great to have. Here are some useful formulas if you need them:
Union of A and B: min(a, b)
Intersection of A and B: max(a, b)
B subtracted from A: max(a, -b)
Where a and b are the SDFs of A and B respectively.
Hey griffpatch, love your tutorials. They are very clear and in depth. I have a request, can you make a video on a topic we all are afraid of? Lists! Seeing your other tutorials I am sure that you'll explain this topic very well. Thanks
I really love this series! I canât wait for part 4!!!!!!!
i remember that griffpatch's first platformer video was still really good - this is even better
Sometimes people underestimate Scratch's possibilities
This is one of your best videos. Your making harder and tougher projects to code for long-time fans like me. Keep it up griffpatch!
Wow, thanks!
i like you griff
i used this for my 3d plane game and my engine 2 engine, thank you for this series! without this series I could not have made my 3D scratch games!
I just love how much efort you make in these videos
Wow I love it, its so easy to copy these tutorials and slowly, I'm becoming smarter in coding! I'm sure all your fans are having the same thing griffpatch! We all would like to thank you for this!
Great to hear! - Thanks a lot - and Scratch on!
i am having the same experience, griffpatch is a hero!
Method of creating a floor: after drawing a ray, you need to set the brightness to 100% and set the color of which will be the floor and after that you need to move the drawing lines to the edge of the map.
dumb it down by alot pls
@@drawsap lol
I gona Remake the backrooms.
Me too
ok
Noice
Me too
There's a bunch of games like that
i like your tutorials Griffpatch, because instead of repeating your moves i actually understand them!
Splendid
This is just amazing! I hope you will release some more videos on how to add stuff in 3D!! Btw. this game reminds me of The elder scrolls 1 or 2 :D
14:47 imagine we can definitely make a 2d mini map display then put it at any viewport corner
I tried making Maps. its hard.
Easy make a map grab the same collision script then, put it at the exact position your standing, then you're done
@@kennethmackissack9022 agree
@@TheDakey12 please explain i am very confused
@@jofsalter He means scaling down the collisions of the map and sticking it in the top right as another sprite, but I don't know about the player and other stuff
thank you so much for this tutorial griffpatch! these tutorials have helped me so much.
My heart is still shaking of horror because Iâm making a horror game with this and I wanted to see my like freaking SCP HERE and it popped into my face and I donât know I I passed out or not
Amazing series Griffpatch! You make coding really easy! I learnt a lot from you!
I love his humorous and fun way to teach. The other tutors are usually like, put this and that and here and there and you have it, your game. We donât learn anything.
i mean, the maths kinda confuses me soooo
@@neo1754 Lol true
Griffpatch! Thanks you for adding my 3D Raycaster E3! Oh, It has 53 views! That is the most amount of views I have ever seen on my Scratch account!đ€©
Thank you for all your efforts. My 9 year old son is now the king of his code club having followed your tutorial and has started asking me to teach him what sin, cos and tan are - wish me luck ;-) Your content is so well put together thank you so much.
We had a couple of troubleshooty moments that were a bit challenging along the way and it would be really useful if you could add some screenshots of the complete finished code blocks somewhere to help though?
If it's possible, you should make a episode where you can change the walls appearance, have ramps or stairs or make it able to have outside areas
deffinitly
Probably could he made on with stairs before
that impossible because in episode one he said make sure there are no gaps otherwise we would get great lag
To make stairs, you need to heavily modify scripts to make the project support stair collision.
@@maxsanby9974 It is possible, you just need a different type of raycaster. Adding stairs does not mean you have to leave gaps on the edge.
I used your random maze script with this project as well. i had to change the stamping of corridors into clones to get it working in game, however the moment i start raycasting clones, the game gets really laggy compared to when it was only raycasting off a single large sprite. anyone find a way to generate random mazes without lagging the raycaster?
Omg thank you so much now my game doesn't feel empty anymore
I love how much this looks like you're just teaching us how to make it run Doom. Because Doom looks a lot like it uses the same formulas!
I CAN SEE WHY LITTLE ME WAS SO OVERWHELMED NOW... The new position after rotation formula is making my brain hurt just by looking at it
@@virtuedreamer6623 bro a whole different person in under a month
Iâm killing myself because of how hard the rotation formula is
I made some slight changes with the FOV change,
In "Define (Single Ray)" script, scroll down until you see the "set pen brightness" block.
"Set pen brightness to (120 - (distance / (DV / 300)))"
When you do that, when you slide up the fov, the brightness will change even darker, like the player moving.
something i really like about this is how when i set the FOV to a multiple of 180 everything just flips again, and again, and again yet nothing else changes. (like how it works in other games)
At every video you broke my brain with your ingenius ideas ! Sorry for my english, I'm french
love it griffpatch and my raycaster work perfectly so far thanks man
If you are going to make a new one, could you add textured walls?? Maybe with sprites or pen patterns
only issue(s)
1. Alot of M A T H
2. How to make the pen correctly draw the texture
but its a great idea since textured floors and walls makes the game look better
@@PrivacyNProgramming no its simple, you can just use another go to x x y 0-height/2 pen down set y to height/2 pen up
@@js62926oh, i thought it would be much harder but thanks :)
@@PrivacyNProgramming actually i messed this up a bit, you just tweak it around a bit and it should then eventually work
@@js62926 oh ok, its fine since we can wait till the next part :)
WE GONNA MAKE BACKROOMS AND THE ENTITIES WITH THIS ONE!!đ„đ„đ„
same
It's cool thx for the tutorial!
I need some help pls. I followed your tutorials exactly on Nanos position with my own photo is it possible that uploaded sprites from the computer won't work? It doesn't stand in one place, instead, the sprite just goes back and forth to the sides of the screen whenever I walk
I'd love to see how I can make the player look up or down, and how to move the camera with the mouse, like in games like COD or Minecraft, it would be VERY useful :D
my guy making the backrooms đ
đ why is that so true
This man explains everything so well and easy too learn
Oh this is the perfect way to make a multiplayer scratch game
I think this is the episode where things go from "simple and intuitive" to "just trust the maths!"
There's a reason he dropped "simple" out of the title in favor of "fun".
just trust the lag!
In the next episode can you make something like doors to next levels? That would be cool
Oh yeah like a portal, that would be so cool
@@Aiaimonkey8093 thats actually simpler than you think, you can just make it when the player touches a sprite on the map, teleport them to this x and this y. and you can also add raycasting to that as well
@@js62926 you can just change the level costume if the player sprite touches a certain portion of the map. used this to code in some dynamic obstacles
i am amazed by griffpatch explaining math like spittin' bars
hi griffpatch if you see this when you set distance to vy, vy doesnt pop up and also when you set size to height i can't find the height block please respond.
That's Awesome! Could You add the Following Episodes in a Platformer Tutorial?
- 12: Moving Saws and Trampolines!
- 13: Add Death animations
- 14: Smooth Platform Movements
- 15/Final Episode: Bosses and Goal!
Please Reply Griffpatch if You Like It!
I do love all those! I have a similar list myself :D
@@griffpatch Make a Episode of platformer game it is been long time for that episode
@@parthsolanki2617 TRAMPOLINESSSSSSS
and TELEPORTERS
you should change the "simple" in the description
I already did... But the post link perhaps doesn't change?
@@griffpatch i think so!
@@griffpatch im encountering a bug where when i look around my entity just zips and zaps around the random spots on the map?? but when i check my code its the exact same as yours
Hi Griffpatch I'm having an issue for some reason I can't find the vx and vy variable in my scratch a little help, please? Thank you.
i really appreciate how you explain all this stuff, these tutorials are so good
I try my best :) thanks
@@griffpatch you are amazing
@@griffpatch When i do the thing on 8:50, it just breaks the raycasting and it just became one-dimensional raycaster. How am i gonna do that if it just goes 1D instead of being working as a 3D?
If there was an award for the best scratcher of the year , then it would be you griffpatch.
"Now we will be using trignometry again, thank you wikipedia" got me dying
so i have a problem. when i tried to make one side of the hallway dark. it wouldn't work. what should I do.
hey can u help me cz wene in the of block of the sensing category wene i do entity on the right i cant make the vy in the left they dont show it to me
I love Griffpatch's enthusiasm, It just makes coding a lot more fun, and it makes learning so entertaining! It really makes me want to continue game development! Thanks, griffpatch!
griffpatch, i have a problem with my nano sprite, for some reason it goes crazy around the map, it even goes like insanely tiny, it just slips around everywhere, can you help me with that?
At 9:36
Is it obligatory to use that [point in dir. (Camera DIR + atan of x / dv)] or rotation around?
I've been making a perfect doom edition an i needed help then I realized you an you helped, thanks
thanks very good, inspiring, educating and improving
Good Job Griffpatch!!! Keep up the awsome work
You are the best scratch helper ever thanks you for all of your help
how do you make it so colors on the walls are different, like as if there were shelves and things on them. how would I make that so?
Really delighted to see griffpatch again and I'll be able to study that even it's truly hard LOLđ
Help me :(
Nano is becoming tiny if i am far from it and much bigger when I am close to it.
Is there anything wrong?
SO easy to understand and is very coolđ
"hey, look at this cool 3d game I made!"
"Cool! How did you make it?"
"I have no idea."
i cant get it to work bc when doing the when i receive paint in the vx of entities part it wont let me select vx only vy
for some reason i cant see my vy varible in my of block what should i do?
I can't help liking it like mad
I'm trying to project the entity but it's just a small version of that sprite in the middle of the screen, how do you fix that?
Edit: Nvm I fixed it but he's moving when I'm moving unlike Griffpatch's nano, how to fix this Griffpatch?
i have an issue when i make a variable more specificly the height variable near the end of the video it wiont show up on the vairiables tab can someone please tell me how to fix this please?
hey idk whats wrong maybe someone does but when i do the tidy up after finish tidying and when i test the 3d world doesn't turn only the 2d map layout does hopefully someone knows how to fix it
Thanks for This series!
why is my hight variable at 20:45 isint showing up at the block list. I've reviewd the part many times it just issint showing.
This guy can explain better then my computer teacher teaching us how to make i fricing 2D catch game
Also if u dont mind me asking, when i hit the green flag my sprite wasn't infront of me so I had to turn left to see it unlike yours so I don't know what to do to fix it
I can't seem to do the "point in direction CAMERA DIR + atan (x/DV)" part. All that shows up is a blue background.
Bro, Griffphatch is so helpful
I have been doing this raycasting for while now
Geometry dash and Lemon invation failed, but not me
Im happy with Griffpatch's teaching
10:11 That is so cool! Nice Job!
When I tried to do the code at 7:53 (fixing the reverse fisheye) the width of my player's sight went down dramatically. Instead of being able to see 60 degrees in front of him, it's only about 10 XD What's the fix to that?
Whenever I replace the âset height to 4000/distance it makes my vision super wide and it takes forever to get to a single wall. Any known reason why?
đž thank you for this it really helped
Can somebody please help me because when I put in the dir script I cannot rotate the camera anymore, so I ended up getting rid of it but itâs required for most of this video⊠Iâm not sure if this is happening because I have coded the player to turn when I press q or e.