Тёмный

3 Ways to Make a Sniper Scope in the Godot Game Engine! 

Chaff Games
Подписаться 7 тыс.
Просмотров 6 тыс.
50% 1

Support the Channel: patreon.com/ChaffGames
Check My New Course : www.udemy.com/course/building...
Get the FPS Template Here: chaffgames.com/fps-game-templ...
The Guns I use:
A few weeks ago I was inspired by Garbaj to do a full investigation into the different techniques to make a Sniper Scope in the Godot Game Engine. These are the three that I eventually settled on.
1. Overlay. This sniper scope is a simple UI overlay that sits over the screen and the camera just zooms in.
2. Picture in Picture. Using Godot's Viewport feature. We can render a viewport texture to a mesh acting as a Lens on our Sniper Scop.
3. FOV. We can use a optical illusion to make it seem like the gun is sitting right in front of the PLayers Face, when in reality, it's actually furhter away.
I'll go over all 3 different ways to make a Sniper scope for the Godot Game Engine.
Gabaj's Video: • I Have No Idea What's ...
Mysterious Purple Cat's Video: • How does Apex Legends ...
Please like and Subscribe! It's truly appreciated
#GameDevelopment #GameDevTutorial #Godot
Links to my Socials
Instagram: / chaff.dev
Twitter: / chaffdev
Itch.io: chafmere.itch.io
Website: chaffgames.com/
00:00 Intro
01:40 Basic Animation and Code
03:45 Overlay Scope
05:55 Picture in Picture Scope
11:03 FOV Scope
13:20 Outro

Игры

Опубликовано:

 

15 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 31   
@sammydoodlew
@sammydoodlew Год назад
14:00 This can be avoided by animating the gun camera backward instead of animating the gun model forward. I'm pretty sure that's how most FPS games do that method.
@Chaff_Games
@Chaff_Games Год назад
That makes sense. I was wondering how people got around that.
@thomasamathew4058
@thomasamathew4058 2 года назад
I think I commented this on your channel before. But you've seen display panel that a gun has to show ammo, I guess. A tutorial on that would be amazing. Thanks for your videos. You are an asset to the Godot community.
@Chaff_Games
@Chaff_Games 2 года назад
Like in Halo? I think I remember that. I'll write it down so I don't forget
@thomasamathew4058
@thomasamathew4058 2 года назад
@@Chaff_Games I don't know about Halo, but check out devlogs from David RB(Unreal Engine). The game he is working on, Arcadian Rift, has guns with Ammo display on them.
@nxidplease
@nxidplease Месяц назад
If anyone is having a problem where they've used MOUSE_MODE_CAPTURED, before adding the ZoomOverlay(CanvasLayer -> Control -> TextureRect) and after adding it it stops working this is due to a setting on the root control node(Hud in the video), go to Mouse -> Filter and select any option other than "Stop" which is selected by default
@epiccomediz474
@epiccomediz474 2 года назад
This is really cool finally a tutorial on this topic
@ViktorsJournal
@ViktorsJournal Год назад
For the 2nd options, instead of script you can probably just use RemoteTransform3D node to update the position? Btw, there are no cast shadows wit hthe 2nd scope on the enemies? Or are they hidden below?
@DejaimeNeto
@DejaimeNeto 2 года назад
yes
@jyanjohn7837
@jyanjohn7837 2 года назад
Please create a tutorial about bullets
@Chaff_Games
@Chaff_Games 2 года назад
Good idea, I've only done hitscan weapons so far, so there aren't any bullets in these weapons, technically. Maybe time to add a projectile weapons 🤔.
@CROXoDyLE
@CROXoDyLE Год назад
perhaps an issue only with my implementation but I noticed when using the first method, if I swap weapons when zoomed in the canvas layer remains fully modulated, because in my implementation the weapon gets removed when swapping weapons so it cant reset the animation. If anyone knows a work around please let me know.
@ViktorsJournal
@ViktorsJournal Год назад
I'm not sure if I understand your description completely but before you swap reset it back, it doesn't matter if you play the whole thing while the node is hidden or not since it will still play. Sounds like a good use for an exit method on a state machine when switching guns. :)
@cesiupro123
@cesiupro123 2 года назад
When I use the picture in picture method, sometimes it works, sometimes it doesn't, and I do it exactly the same way every time. And even if it works, it stops working after I close and reopen the project. The texture isn't loading, the mesh is pitch black. People say it's because both the mesh and the material with the texture have to be set to local. I have both set to local, and the mesh is still black.
@Chaff_Games
@Chaff_Games 2 года назад
I have had this issue a few times. The only way I've fixed it, is deleting the nodes and making the viewport again. That and, everytime you bring your picture in picture gun into a new scene, you need to set the viewport up again by making the gun "editable" and resetting the viewport texture. It's really fiddly in godot tbh.
@cesiupro123
@cesiupro123 2 года назад
@@Chaff_Games Yesterday I tried to make it work again, and as usually, it only works until I close the project, then it goes black. Deleting the node works, and what's interesting, the new node has to have a different name from the one I just deleted. Unfortunately, it only works until... you know what. I've been trying for quite some time, and I only found one thing that doesn't stop working after close the project. It's the script that assigns the viewport texture to the mesh, but it has issues. I don't know how to center the texture on the lens so it actually shows what I'm looking at, and not like a bottom right corner only because the texture is bigger than the lens. Also, I need it to work for 2 players (I'm making a split screen game), and when I do that, Player1 sees the zoom camera of Player 2 in the scope, which is quite funny but that's not what I was trying to achieve. Do you know if there is another method? Ways 1 and 3 don't fit my project :/ Thanks for the good tutorial tho
@Chaff_Games
@Chaff_Games 2 года назад
Definitely sounds like it has something to do with the way resources are handled in Godot. I'm not sure I have a solution for that, sorry.
@atomica0914
@atomica0914 2 года назад
Woop, woop I'm quite early
@lukabrasi001
@lukabrasi001 Год назад
hey, i see you're using viewports for weapons, were you able to make the guns in the viewport receive lights and shadows from the main scene? this is the main reason i ditched viewport weapons man and i can't even find a proper solution to this problem
@Chaff_Games
@Chaff_Games Год назад
Works in 3.5 right now, but not in 4. In 4 the shadows don’t transfer over. The trick is to put the world environment in the scene and not in the cameras.
@lukabrasi001
@lukabrasi001 Год назад
@@Chaff_Games i had it set up like that, but the gun still didn't receive lights from light sources in 4.0, i don't know why it happened though but it made me ditch the whole viewport thing altogether
@Chaff_Games
@Chaff_Games Год назад
The lights need to be on the visual instance as the view model. But like I was saying before, shadows don’t transfer through, so it’s a deal breaker either way.
@lukabrasi001
@lukabrasi001 Год назад
@@Chaff_Games so the best bet would be using a shader for the weapons that act similarly to viewports
@Chaff_Games
@Chaff_Games Год назад
@@lukabrasi001 most likely. i'm hopeful that this gets fixed soon.
@bnkm07
@bnkm07 Год назад
how to make the sniper rifle itself?
@Chaff_Games
@Chaff_Games Год назад
For me, this is just a simple hitscan weapon. So no range or fall. you could follow this video here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-xTjMRkDg4Bs.html. if you need range and fall then I'm not sure.
@bnkm07
@bnkm07 Год назад
@@Chaff_Games thank u
@MajatekYT
@MajatekYT 2 года назад
Wouldn't a picture-in-picture scope method be doable without any performance hit by simply setting the main viewport render target to a texture, use that texture as the main view, then render the rifle and scope on top with a second viewport and have the scope reference the texture that you already rendered to? That way you're only rendering the whole scene once, really. I'm sure you can avoid making it pixelated by animating the field of view to be lower while scoped in instead of just stretching the texture (or having the scope close to the camera and as a result shows the texture stretched to be bigger due to perspectives). But yeah, thank you for the easy to follow tutorial!
@Chaff_Games
@Chaff_Games 2 года назад
I thought that too but never ended up trying it because I assumed it would be pixelated. 🤔 Maybe I'll give it a go.
@MajatekYT
@MajatekYT 2 года назад
@@Chaff_Games Now that I had a chance to think about (I made my comment while slightly sleep deprived), it probably won't work as it'd zoom in the view of what's behind the scope as well. Oh well. 😅
@Chaff_Games
@Chaff_Games 2 года назад
I was having the opposite thought 🤣 I'll have to have a go and see what I come up with.
Далее
Вопрос Ребром: Сергей Бурунов 2
1:03:47
다리에 힘이 풀려버린 슈슈 (NG Ver.)
00:11
Просмотров 2,4 млн
1 vs 1000 guitar picks (5000 picks/second)
15:32
Просмотров 2 млн
How To Make A Game Alone
16:44
Просмотров 227 тыс.
Games Where You're NOT the Main Character
14:52
Просмотров 2 млн
Assault Rifle (Godot FPS Tutorial)
6:41
Просмотров 73 тыс.
I Optimised My Game Engine Up To 12000 FPS
11:58
Просмотров 587 тыс.
Path Based Mesh Generation in Godot 4
7:27
Просмотров 25 тыс.
I Never Would Have Thought Of This On My Own
3:01
Просмотров 486 тыс.
Winning My First Ever Game Jam? | Godot Devlog
10:25
Просмотров 288 тыс.
ХУДШЕЕ ОРУЖИЕ ИЗ ДРОПА
19:34
Просмотров 180 тыс.