I Tried Making an FPS Game in JavaScript

Поділитися
Вставка
  • Опубліковано 21 лип 2022
  • GLSL Course: simondev.teachable.com/p/glsl...
    Support me on Patreon: / simondevyt
    Follow me on:
    Twitter: / iced_coffee_dev
    Instagram: / beer_and_code
    Here I tried making a 3D first person shooter, all in JavaScript and Three.js. I took some code from a couple of my other tutorials, like first person camera controls and ammo.js stuff, bolted on a few free things from places like Sketchfab, and added some shooter gameplay. The code could totally be used as a starting point for somebody else wanting to make a little browser FPS.
    Basically, I tried to code up a first person shooter skeleton in a few days, using nothing more than JavaScript and the browser. All the elements, HUD, etc. are in there and in workable states. There's tonnes more you could do obviously, but I think this can help you understand how you might structure things and use something like Three.js to get started on these types of projects. Making a basic first person shooter, even in JavaScript, isn't too difficult.
    Droid Thing from Quaternius: quaternius.com/
    "Anubis Bust" (skfb.ly/6RwNp) by lucasthx88 is licensed under Creative Commons Attribution (creativecommons.org/licenses/b....
    "K-VRC | Love, Death + Robots" (skfb.ly/6XCCo) by ArbitraryCanary is licensed under Creative Commons Attribution (creativecommons.org/licenses/b....
    "Buddha" (skfb.ly/QGxw) by hullo is licensed under Creative Commons Attribution (creativecommons.org/licenses/b....
    "Human Skull" (skfb.ly/6RsWT) by Sergey Egelsky is licensed under Creative Commons Attribution (creativecommons.org/licenses/b....
    "Heavy Assault Rifle" (skfb.ly/6RGPy) by pixelgrapher is licensed under Creative Commons Attribution (creativecommons.org/licenses/b....
  • Наука та технологія

КОМЕНТАРІ • 263

  • @simondev758
    @simondev758  Рік тому +43

    Everything in the video, the effects, even the graphs and animations, were all done with GLSL shaders. Learn how to do them yourself with my course: simondev.teachable.com/p/glsl-shaders-from-scratch
    Support me on Patreon: www.patreon.com/simondevyt

    • @crowbr
      @crowbr Рік тому +1

      nice!

    • @c0nsumption
      @c0nsumption Рік тому +2

      Would you be willing to make a course around this? I’m interested in the GLSL course as well but crafting all this FPS project with an in-depth tutorial is most def something in extremely interested in. Willing to pay and all.
      You’re literally the only person I’m finding whose documenting three.JS experiments this in depth 🥺

    • @simondev758
      @simondev758  Рік тому +5

      @@c0nsumption Yep, really depends on interest. I'd be happy to make a multi-hour version available.

    • @c0nsumption
      @c0nsumption Рік тому +1

      @@simondev758 👏🏽 awesome. If you end up going for it please make an announcement as I’m for sure signing up!!!

    • @katsurakotaro
      @katsurakotaro Рік тому

      voice sounds like text to speech

  • @Retrofire-47
    @Retrofire-47 Рік тому +461

    this guy makes me feel like the label "beginner" is far too generous for my current skill level

    • @socio637
      @socio637 Рік тому +25

      yeah hes a wizard. dont be dejected though, you could be too

    • @somefin3322
      @somefin3322 Рік тому +24

      Do be reminded that this is probably all in many days of work, we don't see his actual process of studying to get something working. We see the process of it WORKING, not fully being worked on.

  • @programmingjobesch7291
    @programmingjobesch7291 Рік тому +29

    You have me fully convinced I can build a "quicky" game engine from scratch in javascript to rival unreal- and I just learned how arrays work...😂

  • @SuperPicolin0
    @SuperPicolin0 Рік тому +125

    I'm amazed once again, why are you making this look so easy, like others mentioned, I would definitely pay for a detailed course on all this with threejs. Do I have to separately learn game development and threejs because the info on making games with three is very limited?

    • @simondev758
      @simondev758  Рік тому +23

      Possibly. Game development is it's own thing, and three.js is a nice little 3d graphics library, but if you have 3d experience, then learning three.js specifically isn't required.

    • @SuperPicolin0
      @SuperPicolin0 Рік тому +14

      @@simondev758 I almost figured from the wiki pages you're looking up sometimes, I should leave threejs alone for a bit and focus on actual game dev concepts first, thank you for replying and the good content you're creating for us.

    • @Desopolis
      @Desopolis Рік тому +7

      I’d say use a more solid, game focused engine for a bit to learn and understand the fundamentals.
      It’s like learning to be a racing driver…
      you can go out and get a focused team and pre-built car and focus on driving, or you can buy a kit car online and build it in your garage..
      Threejs serves a super wide set of use cases, so i needs to be a flexible as possible, where a game engine knows a lot of the core requirements before you’ve even start.
      I’d push yourself beyond any cordless game ends, “gamemaker” type things, and try at least Unity.
      If you want a less intense engine there’s stuff like Godot (which has more code requirements)
      There are good web based game engines too, Pixi and phaser will make EXCELENT 2d games and have a strong legacy and community.
      For 3D there’s PlayCanvas which is a game engine built on three, it does a lot of the heavy lifting for you but I’m not sure how I feel about it yet..
      Lastly there’s BabylonJS which wasn’t burdened by all the outdated shit three has so support and is honestly a pretty great rendering engine.
      They have an excellent Node system and a good community, although pretty isolated from the rest of the JS world…
      TLDR: get Unity, buy the stuff you can’t figure out, and go deeper on game #2, or 3 or 4 etc…

    • @werrutkyupnext
      @werrutkyupnext Рік тому

      damn I wanna learn javascript this is like really really hard?

    • @anomiedesign5030
      @anomiedesign5030 9 днів тому

      @@werrutkyupnext how is it going?

  • @baguette2652
    @baguette2652 Рік тому +9

    Ever since I discovered your channel, I became super motivated by your creations. Thank you for bringing such awesome content to us! 🔥

  • @Ecrios
    @Ecrios 9 місяців тому +8

    This is one of the few of the most impressive game design videos I've ever seen! Please, carry on! You. Are. Amazing!

  • @PotatoGodzilla
    @PotatoGodzilla Рік тому +3

    I love those three js videos keep it up dude you're awesome! :)

  • @paulo1940
    @paulo1940 Місяць тому

    I was quite hesitant on the artistic choice of placing random bleak large blocks on the map until you added those effects, dang those were cool!

  • @chonkydog6262
    @chonkydog6262 Рік тому +3

    Wow! This is so cool! I would love to use this codebase as a beginning for a multiplayer FPS game. Running around and destroying people online would be so cool

  • @chamonmath7688
    @chamonmath7688 Рік тому +2

    Simon dev always has great explanation while going through his process, and I always get a good laugh at some of his dialogue. Lol, stay awesome

  • @hamsteroncoffee
    @hamsteroncoffee Рік тому +2

    Woowww, this looks amazing 😍! Wish I had those skills or at least half of them 😅 - you make complicated things look so easy

  • @oaksBFL
    @oaksBFL Рік тому +2

    This tutorial is amazing and you are really good at teaching !! great job sir !

    • @oaksBFL
      @oaksBFL Рік тому +1

      hackers in my acc i did not comment this sorry bro

  • @cmcdonough2
    @cmcdonough2 Рік тому +1

    Amazing content. Thanks for sharing your knowledge.

  • @jchaloupka007
    @jchaloupka007 Рік тому +5

    Damn, that’s amazing, love it!

  • @kosa-tv
    @kosa-tv Рік тому +5

    Great idea dude. Like always, not disappointing content.

  • @IxZOMBxI
    @IxZOMBxI Рік тому +1

    You are very good at explaining things. keep it up thank u

  • @nurazizalimustofa5087
    @nurazizalimustofa5087 Рік тому +1

    Thank you man for sharing this stuff

  • @LikezYou
    @LikezYou Рік тому +1

    Love your videos, keep it up! :D

  • @loun.exXe3
    @loun.exXe3 Рік тому +2

    Awesome video! Thank you!

  • @ViciousViscount
    @ViciousViscount Рік тому +4

    That's pretty much Quake III Arena. I LOVE it.

  • @TurtleFul
    @TurtleFul Рік тому +5

    Love your videos! Keep up the good work. Your experements are always interesting to watch.
    I would love to see a video about the performance difference between a JS/web based game like this and an in engine one like in Gdot or Unity.

  • @Skeffles
    @Skeffles Рік тому +1

    Looks fantastic!

  • @covenantersoldier9165
    @covenantersoldier9165 Рік тому +1

    Tip of the hat top you, truly. well done. you truly are a great online tutor.

  • @crowbr
    @crowbr Рік тому +2

    Nice!! Amazing work, pls make a video about customize characters, like put armor or clothes in character.

  • @cabelogold6687
    @cabelogold6687 Рік тому +2

    Very well explained!

  • @minayoussef5730
    @minayoussef5730 Рік тому +1

    works, keep up the good work man

  • @TheAwesomeTrunk
    @TheAwesomeTrunk Рік тому +2

    How cool! Good job.

  • @spaceymen
    @spaceymen Рік тому +1

    Excellent stuff

  • @Di4Fourr
    @Di4Fourr Рік тому +2

    hanks lot Sir.. You helping us..

  • @giorgijankhoteli5803
    @giorgijankhoteli5803 Рік тому +1

    damn that sky looks so amazing great job with that

  • @Mohta69
    @Mohta69 Рік тому +3

    That's dope dude

  • @KamranWali
    @KamranWali Рік тому +4

    This is super kool. Really like how you made the game and never knew using Javascript and Browser would give such detailed game. The movement looks good. The shader is spot on. Also the UI are on point. This looks like a really good game. keep it up! :)

  • @LuisCassih
    @LuisCassih Рік тому +1

    Every time you do something it's like those Minecraft videos when they said "I did some mining off camera" and comes with an entirely new scene.
    Anyways, amazing video, I would like to see a more detail explanation on the skybox, looks really good.

  • @mulualemtekle6094
    @mulualemtekle6094 Рік тому +2

    much respect as always, :)

  • @wesleytiago4121
    @wesleytiago4121 Рік тому

    Worked smoothly, tysm

  • @swoorp
    @swoorp Рік тому +4

    Yay it's finally out!

  • @ionutrosca6326
    @ionutrosca6326 Рік тому +2

    TNice tutorials comnt from you is legendary. Uncomplicated like your video!!!

  • @kasali2739
    @kasali2739 Рік тому +5

    impressiv!
    Those spiders brought me to fresh idea for next tutorial, how is about coding on skeletal meshes? (procedural animation, equipment using local matrices of bones for position etc.)
    This thing can be found for unity but there is nothing for threjs out there

  • @billcolak5253
    @billcolak5253 Рік тому +2

    absolutely unreal!

  • @bruniomhars
    @bruniomhars Рік тому +3

    Man tNice tutorials is on of the best tutorial in general on youtube. Clear, simple, constant, good to listen. Thank you for sharing.

  • @srsherman7
    @srsherman7 10 місяців тому

    Im going to point out and draw focus to how he canadianly says deckulls for decals... only because im jealous of how casual he makes this whole thing feel.. for real though I love watching your dev progress it's next level

  • @tutosrivegamerTRG
    @tutosrivegamerTRG Рік тому +1

    thank you so much , it worked

  • @ibrahimgaming3587
    @ibrahimgaming3587 Рік тому +2

    Will stay tuned to your channal! Cheers!

  • @unicornsteroids
    @unicornsteroids Рік тому +5

    The shaders on this video makes your course my next purchase.
    Amazing video!

  • @Fallen_Ninja
    @Fallen_Ninja Рік тому +2

    Missed you bro

  • @d0c_dev
    @d0c_dev Рік тому +3

    Wow you make this look easy even though it is not, got no idea how to write JS though

  • @amestresys9175
    @amestresys9175 Рік тому +2

    WHAAAT A SKILL ... incredible

  • @mohsinrahman8391
    @mohsinrahman8391 5 місяців тому +1

    Incredible

  • @Okyo01
    @Okyo01 Рік тому +1

    thank u helped me a lot

  • @godbibo
    @godbibo Рік тому +2

    wow what a nice video !

  • @saberwulf6857
    @saberwulf6857 Рік тому

    ITS WORK, its really helpful

  • @rajsonu3156
    @rajsonu3156 Рік тому

    Oh.. these are really good

  • @GregoryTheGr8ster
    @GregoryTheGr8ster Рік тому +2

    Also, I really dig your tutorials. The only downside is that I learn how far behind I am in algorithms and whatnot. That has been my problem in game development since I started.

    • @simondev758
      @simondev758  Рік тому

      Game development takes a lonngggg time to because of the breadth of knowledge required. The nice thing is, it makes it fun to learn all of it.

    • @GregoryTheGr8ster
      @GregoryTheGr8ster Рік тому

      @@simondev758 Oh yes, modern 3D games are so much more complex than when I first started in 1989. Those games are now known as "pixel art" games. How funny!

    • @GregoryTheGr8ster
      @GregoryTheGr8ster Рік тому

      @@simondev758 Also, did you ever see Ultima Underworld? It was the first.

  • @yresze2885
    @yresze2885 Рік тому +2

    So perfect

  • @mikaelprevitera9552
    @mikaelprevitera9552 Рік тому

    this is going to be great!

  • @rizoscreativosofficial8
    @rizoscreativosofficial8 Рік тому +1

    It's just awesome

  • @julianeprado9691
    @julianeprado9691 Рік тому

    I hope you post a video with all the adobe cracks. As always, you are the best, the crack works great

  • @NaiyoGames
    @NaiyoGames Рік тому +4

    Everything sucks event me. *proceeds to create a masterpiece.*

  • @wirten69
    @wirten69 Рік тому

    working fine thank you

  • @atharvkumar2564
    @atharvkumar2564 Рік тому +2

    It's cool as hell

  • @rodrigofernandes6449
    @rodrigofernandes6449 Рік тому +4

    Wow. Can you make a full tutorial on this?

  • @g_a_b_b_o-gabbopower5134
    @g_a_b_b_o-gabbopower5134 Рік тому

    willing to learn. Unless you already understand setups, then I gues sit's gonna be easier, but as a classically trained pianist I was blown

  • @Variapolis
    @Variapolis Рік тому +5

    More and more engines and frameworks for games seem to be slowly moving to CSS and HTML for UI. It's pretty neat IMO.
    Some examples include:
    CS:GO
    Source 2 Engine
    Unity's Upcoming UI Toolkit (UXML)
    S&Box
    Escape from Tarkov

  • @MegalithicEnt
    @MegalithicEnt Рік тому +1

    NICE!

  • @robertocarlosfarfansanchez6111

    where I’d record one track of the soft and than use a second Edison to record scrubbing through the soft to mimic a wave table.

  • @eftifeev
    @eftifeev Рік тому +2

    very good

  • @maximumcockage6503
    @maximumcockage6503 8 місяців тому +1

    Babylon just implemented Havok physics, and tests show it's got way better performance than ammo. Have you considered giving it a try? Might be fun for something like a Gary's Mod styled sandbox since Half Life 2 (the game Gary's Mod is modded from) uses Havok physics.

  • @danielfirminovillaverde7794
    @danielfirminovillaverde7794 Рік тому +1

    Works good, tnx

  • @baoleizhao4614
    @baoleizhao4614 Рік тому +1

    amazing

  • @ibingeyt6077
    @ibingeyt6077 Рік тому +2

    I would title the video “I Tried Making an FPS Game in Java script”

  • @jasonl9266
    @jasonl9266 Місяць тому

    With javascript you can make an online multiplayer , since it's for the web ,I'm sure it would be like a native language for such workload . Cool tutorial though!

  • @stadnikds
    @stadnikds Місяць тому +1

    "The nice thing about JS is that I can do this all in HTML and CSS" - says noone and never :D

  • @drawmaster77
    @drawmaster77 Рік тому +1

    incredible.

  • @dre4085
    @dre4085 Рік тому

    Hey simon, nice work!! where can we find the repo?

  • @MartinAlix
    @MartinAlix Рік тому +2

    Great video as usual!
    Have you tried Rapier and React-three-fiber?

  • @cyrusguest4975
    @cyrusguest4975 Рік тому +3

    the way you pronounced decal makes me want to cry

  • @guccidevel
    @guccidevel Рік тому +2

    bro my ass is still making black scenes with cubes 💀

  • @emreonal8221
    @emreonal8221 Рік тому

    thx work

  • @FaislQurishi
    @FaislQurishi 2 місяці тому

    I still await the "I make a third person shooter" lol, miss your videos Simon hope life isnt getting too busy

  • @Nubbley
    @Nubbley Рік тому +1

    im sooo thankful for blueprints lol.

    • @simondev758
      @simondev758  Рік тому +1

      I dabbled in UE4 a bit. Blueprints are nice but man it takes forever to do anything with them.

  • @FPdesignfab
    @FPdesignfab Рік тому

    Awesome. Can you do this with a Rally Car Racing game? Where the player can actually control 4 wheel drive power slides around corners?

  • @martinemanuel8239
    @martinemanuel8239 Рік тому +2

    It's f#$- awesome!!!

  • @nikkossta
    @nikkossta Рік тому +1

    "I'm not a violent guy" "I used Doom Ethernal as inspiration". Nice

  • @josh_can_annimate3108
    @josh_can_annimate3108 Рік тому +1

    You deserve much more recognition. Great video

  • @anonymoussloth6687
    @anonymoussloth6687 Рік тому +1

    Hi, how can we add wall banging functionality to this or in general any fps that uses raycasts for shooting?
    Also, when we shoot, i imagine raycasts are instantaneous calculations. Then how do you get the effect of the bullet firing and taking a fraction of a sec to hit?
    The motivation for both these questions is valorant when you can wall bang and when u shoot a gun, you can see the trail and it doesn't hit the instance you shoot (the player can sometimes move out of the way and dodge)

    • @yaboirairai
      @yaboirairai Рік тому

      I’m a web dev not a game dev but I am guessing the way it works is that the client is always Raycasting a cone in the direction the camera is looking. Then when you fire the shot you already know what you’re looking at, so you can invoke different animations depending on what material or entity you are currently aiming at.
      Some clues that support this is the fact that there is hit detection just looking at an enemy, if I aim at an enemy they appear on radar.
      Also I vaguely recall in CS there were commands you could use to see these vision lines

    • @simondev758
      @simondev758  Рік тому +1

      If I had to guess, I'd say that you spawn a bullet that travels forward at X velocity every frame, doing a limited raycast on that line segment.

    • @yaboirairai
      @yaboirairai Рік тому

      @@simondev758 I think it’s a cone because of radar detection as well as flashbangs etc

    • @anonymoussloth6687
      @anonymoussloth6687 Рік тому

      @@yaboirairai i just saw a video of tenz playing with noobs and it that the spectators had enabled vision lines which were constant raycasts out from the gun's nozzle.
      Can you explain why it is a cone? I saw your other comment regarding this but didn't quite understand it
      PS. The video i am referring to is "which pro can kill more noobs?..." If you watch this, u can clearly see the raycasts enabled constantly so u were right about that

  • @SchweinchenHorst
    @SchweinchenHorst 4 місяці тому +1

    Wow!

  • @rakshitshetty6958
    @rakshitshetty6958 Рік тому

    Hi Simon, in this project are you using 'FirstPersonControls' or
    'PerspectiveCamera' and then listening to keyboard and mouse inputs.

    • @simondev758
      @simondev758  Рік тому

      It's using the first person controls I built in my tutorial.

    • @rakshitshetty6958
      @rakshitshetty6958 Рік тому

      @@simondev758 okay, got it 😁

  • @andrewpozenel2931
    @andrewpozenel2931 Рік тому +2

    Where can i get this "little colored cubes changing colors" shader?? I'd like to use it in Godot and Unity

    • @simondev758
      @simondev758  Рік тому +2

      I'll post the whole thing to Github at some point, I typically announce it on Twitter once I've had a chance to go through and do any cleanups.

    • @andrewpozenel2931
      @andrewpozenel2931 Рік тому +1

      @@simondev758 Ok, thanks. will check you out on Twitter and GitHub.

  • @boot-strapper
    @boot-strapper 8 місяців тому

    do you think I could make a low poly multiplayer game with js? I want to recreate an old game I used to love.

  • @andrewallbright658
    @andrewallbright658 Рік тому +2

    Finite state machines... The every man's crude game entity AI.

  • @WalmartVaxei
    @WalmartVaxei Рік тому +2

    grandpa of gamedev

  • @AwgustRushOfficial
    @AwgustRushOfficial Рік тому +1

    You probably get this all the time but…… You did a great job for JavaScript mate well done 5⭐️

  • @Cos3D
    @Cos3D 10 місяців тому

    would this game only work in a browser or also natively on pc ?

  • @realfl495
    @realfl495 4 місяці тому

    Let's do a game in javascript
    >proceeds to write shader code

  • @VirSpectabilis
    @VirSpectabilis 7 місяців тому

    "The doc suck, the example suck, everythings sucks..." Haha) This is how I felt when I was working with React Native)

  • @morganwilson9115
    @morganwilson9115 Рік тому

    Do you do any work with React and three.js? R3F in your course?

    • @simondev758
      @simondev758  Рік тому

      The course is on shaders. Whether you use R3F or Three.js directly, neither replaces writing shaders.

  • @ITR
    @ITR Рік тому

    Did you try checking how many enemies shooting you could have at once? I feel like javascript would have huge performance issues in fpses since the collision checks tend to stack up, so it'd be interesting to see how well the engine does.

    • @simondev758
      @simondev758  Рік тому

      I didn't check, but I kinda doubt it'd be a big issue. The physics engine is compiled from C++ to wasm, so "most" of the speed is theoretically retained. After that, calling raycast from JS a bunch of times shouldn't be that costly.

    • @ITR
      @ITR Рік тому

      @@simondev758 Makes sense

  • @Ralster
    @Ralster 29 днів тому

    How did you go from having a single main.js file handling mostly everything in the first two minutes, then suddenly have an entire tree of controllers and stuff like that !?!?

  • @jorgeenriquelayibanez814
    @jorgeenriquelayibanez814 Рік тому

    how do i add a i downloaded to my soft soft so i can resetup it?

  • @skkylimits
    @skkylimits Рік тому +1

    Sensei Simon. Do you have the link to the codebase? My blind eyes can't seem to find it somehow. I would love to take a look at the codebase

    • @simondev758
      @simondev758  Рік тому +3

      Sorry, I've been procrastinating with cleaning that up. I'll get it posted eventually, I always do, just takes me time to make myself sit down and do it. Look for me to announce on twitter.

    • @skkylimits
      @skkylimits Рік тому

      @@simondev758 I know you will. You always deliver. Studying your code has taken my javascript to the next level and I am forever gratefull. I mean that! You are a huge inspiration. I will wait patiently for updates on your twitter ;))

    • @NomarRH
      @NomarRH Рік тому

      @@simondev758 No importa que no este limpio, nosotros lo podemos mejorar.