I Tried to Make Star Wars Battlefront II in JavaScript

Поділитися
Вставка
  • Опубліковано 13 чер 2021
  • Tried building a Starfighter Assault clone, all in JavaScript.
    Support me on:
    Patreon: / simondevyt
    Follow me on:
    Twitter: / iced_coffee_dev
    Instagram: / beer_and_code
    Github: github.com/simondevyoutube/
    Here I tried to build a 3D JavaScript game, mostly from scratch, using libraries like Three.js/Ammo.js. This was heavily inspired (very heavily) inspired from the Star Wars: Battlefront II: Starfighter Assault game, which looks way better, but c'mon, this is just one guy and JavaScript. The code could definitely serve as a starting point for a way cooler game.
    The goal of the project was to mash together a bunch of elements we've already seen, such as particle systems, third person cameras, player input controls, and introduce a few new things too such as the gamepad API and ammo.js physics support, and a bit of WebAudio through Three.js's API. Hopefully from this, you'll be able to understand how to integrate these various components to build out your own games.
    What I'll cover:
    * Basic game construction
    * Player input, particle systems
    * UI Components
    * GamePad API
    * Three.js and Ammo.js
    References:
    Inigo Quilez's site, lots of magic on noise and shaders, really the goto reference: iquilezles.org/
    Star Wars Battlefront II, very cool game, I assume from the trailers, haven't played it: / eastarwars
  • Наука та технологія

КОМЕНТАРІ • 412

  • @simondev758
    @simondev758  3 роки тому +40

    Help support me: www.patreon.com/simondevyt

  • @alyctro8158
    @alyctro8158 3 роки тому +57

    This straight looks like the oldschool battlefront game, amazing. Take me back to the glory days Simon.

  • @n8programs733
    @n8programs733 3 роки тому +109

    Your use of shaders is so spectacular. You do all this advanced texturing and noise without any node-based programming or other GUIs.

    • @n8dev
      @n8dev 3 роки тому

      wowowoowowow

    • @blackcitadel37
      @blackcitadel37 3 роки тому +4

      As they say, knowledge is power.

    • @aceman0000099
      @aceman0000099 3 роки тому +7

      It's not much of a leap to go from node programming to code, if you're not dyslexic

  • @AntonioCorrenti
    @AntonioCorrenti 3 роки тому +272

    Who wants a crossover with Sebastian Lague? SIMONDEV X CODING ADVENTURES

  • @mjs28s
    @mjs28s 3 роки тому +508

    you need to do some Udemy course for JS games!
    The current Udemy game selections are nothing like this. typically just bad side scrollers.

    • @geelemo
      @geelemo 3 роки тому +14

      we need

    • @blackcitadel37
      @blackcitadel37 3 роки тому +27

      It'd be one entire course just for all that physics black magic.

    • @dominiksmeda7203
      @dominiksmeda7203 3 роки тому +7

      pleas take my money

    • @UrielHK
      @UrielHK 3 роки тому +2

      second that

    • @theomegamale5335
      @theomegamale5335 3 роки тому

      Id buy it too. You should really consider this.

  • @almostthere6116
    @almostthere6116 3 роки тому +232

    Sometimes it isn't if you can, it's if you should, but you have my support anyway.

    • @simondev758
      @simondev758  3 роки тому +89

      So keep doing everything in js is what I'm hearing?

    • @Soremwar
      @Soremwar 3 роки тому +6

      In today's world where you can write the more demanding parts in C++/Rust and the rest of it in JS/typed JS why wouldn't you?

    • @jimmychoong3014
      @jimmychoong3014 3 роки тому +1

      Learner here trying to understand- is there a reason why it shouldn't be done? Performance related reason?

    • @simondev758
      @simondev758  3 роки тому +38

      @@jimmychoong3014 Historically JS has been a slow language, that's been turning around a lot thanks to work from teams like the V8 team. As mentioned, you can develop parts in other languages (like Rust/C++), or just do the whole thing in JS, or just use Unity at this point. Everything has it's tradeoffs. JS tends to be easier and more forgiving than something like C++, although not as performant. See one of my last videos for a bit of a comparison.
      If you're interested in my background, I was a game developer for about 10 years, often led optimization on major titles, and was hired at Google for optimization, all C++.
      These videos are fun because they break the mould a bit, showing that complex games can be built without much trouble in languages you thought weren't capable of it.
      Ultimately it's up to you to decide what tradeoffs you're willing to live with.

    • @Merthalophor
      @Merthalophor 3 роки тому +8

      @@simondev758 JS has one thing going for it that the others don't: It's going to be huge. I think it's pretty plausible that web technology are going to take over 99% of graphical applications. The industry as a whole is moving away from local workstations, and towards cloud based applications that work 100% in the browser. MS Office will become browser based. VS Code runs in Chromium. Discord rund in Chromium. Slack runs in Chromium. Three.js ist just the start of 3d, there will be more & better tools. WASM will bring performant code & a diverse set of compiler front ends to the platform - C, C++, Java, Haskell, OCaml just through llvm alone. And JavaScript will be at the center of it. Modern JavaScript is pretty nice to write with. Transpilers for jsx & reason bring gui features to js that most other languages are still far away from aquiring. There is actually a react port of three.js in fact, if you're interested, called react thee fiber. Blew my mind how well it works. Haven't decided on weather it's good for game programming yet, but at the very least it expands the design space for regular websites to the entire world of 3d. You can literally mix & match html & three.js as you wish, 3d positioning and projection all work the way you'd intuitively expect them to.
      I'm pretty sure 5, 10 years from now, Windows will be dead, everything will be linux or macosx, but no one will notice because you'll work exclusively from your cloud storage via a fully integrated web browser. File systems will be more intuitive, and most importantly: all front end code will be built using current web technologies.

  • @julianstorm7722
    @julianstorm7722 3 роки тому +141

    One of the most inspirational channels on this topic - if not the only one. Thanks for your work
    Edit: You might not consider yourself an artist but this is definitely a piece of art. Cheers

    • @Cal97g
      @Cal97g 3 роки тому +1

      Any similar channels?

    • @Bluepaccao
      @Bluepaccao 3 роки тому +1

      Sebastian Lague is great!

  • @kyou.rocher
    @kyou.rocher 3 роки тому +39

    "I'm a leaf on the wind" made me cry a little, still got PTSD from that scene

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

    9:22 "Noise is a great subsitute for actual art direction" :D

  • @LegoDinoMan
    @LegoDinoMan 2 роки тому +2

    9:39 Underrated Futurama joke wasn’t expecting Elzar

  • @ThunderstruckElectronix
    @ThunderstruckElectronix 3 роки тому +12

    I'm learning Web Dev and I think it's awesome to see all the cool stuff you can do with js.
    Cool video 👍

  • @stolensentience
    @stolensentience 3 роки тому +16

    4:07
    I’m crapping out particle systems myself as I watch this

  • @russiangravy3870
    @russiangravy3870 3 роки тому +2

    I like how smooth the movement is. Makes the actual game look like 100% lighting and particle-flare.

  • @gamershow5944
    @gamershow5944 2 роки тому +3

    I can't believe you made this in JavaScript. It's really good looking. Your very talented to be able to code this together.

  • @aunyks
    @aunyks 3 роки тому +1

    Always so impressive. Thanks for sharing this with us!

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

    When you showed your full game, I instantly understood the UI of Freelancer games that highlighted enemy ships and where to aim

  • @laja6108
    @laja6108 3 роки тому +2

    This is so cool, I love when you make these videos 🙌🏽

  • @Bluepaccao
    @Bluepaccao 3 роки тому +1

    I love your dedication, awesome work man!

  • @GiusePooP
    @GiusePooP 3 роки тому +16

    10:52 tie fighter smashing into eachother

  • @dempa3
    @dempa3 3 роки тому +1

    Very interesting to listen to how you go about making these JavaScript games!

  • @geelemo
    @geelemo 3 роки тому +7

    I'm laughing/smiling watching this. especially when I saw the kid playing the game. wow!!!

  • @danielzaiser
    @danielzaiser 3 роки тому +1

    Keep on rocking js game dev, you are unique, talented, entertaining, awe inspiring

  • @viktorjacobsson4006
    @viktorjacobsson4006 3 роки тому +13

    You can export metadata using the extras property in the gltf.
    According to the docs for the blender gltf exporter you should be able to check a box exporting custom properties as gltf extras.
    If I recall correctly, when loading the gltf the data ends up in userdata on the loaded model.

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

    Exactly what I was looking for, thank you so much!

  • @drdonalfons
    @drdonalfons 3 роки тому +1

    You can export custom properties from Blender to GLTF files like this:
    1. In Blender, go to the Settings panel. There, you want to use either the "Object" or "Material" settings (maybe "Mesh" works, too).
    2. In those settings, scroll all the way down to "Custom Properties". Click Add
    3. Add your custom property. You can add numbers or strings
    4. Go to the export GLTF dialog (File > Export > GLTF / GLB)
    5. In that window in the "Include" section, hit the checkbox "Custom Properties".
    6. When loading the model in ThreeJS, custom properties are available under the object / material (mesh?) in the "userData" property.
    Keep up the good work! I definitely enjoy your videos - both from the technical level and style!

  • @mobslayer211
    @mobslayer211 3 роки тому +4

    This is where the fun begins
    I found you through the BOTW inspired rpg earlier. You've seem to have grown a lot in the last 5 months!

  • @Skeffles
    @Skeffles 3 роки тому +1

    Absolutely fantastic game! I loved the space battles in the now named 'Classic' Star Wars Battlefront 2

  • @N_IndratejReddy
    @N_IndratejReddy 3 роки тому +5

    KID: MY DAD MAKES VIDEO GAMES FOR ME , HE IS A LEGEND.

  • @CesarFelipeLopez
    @CesarFelipeLopez 3 роки тому +1

    Amazing as always👍

  • @alvesvaren
    @alvesvaren 3 роки тому +1

    Looks really good, I think adding some not too bright light source reflecting from the planet would make it look even better

  • @stolensentience
    @stolensentience 3 роки тому +3

    Surprised no “do a barrel roll!” At the end
    Great work btw!

  • @jimmyrustle271
    @jimmyrustle271 3 роки тому +3

    Man I'd go crazy trying to write this in JavaScript instead of TypeScript. Nice job.

  • @francoisvermeulen706
    @francoisvermeulen706 3 роки тому +1

    love your work

  • @theFuzzyWarble
    @theFuzzyWarble 2 роки тому +1

    Awesome inspiration, many thanks... and that Farscape reference in the game!! KUDOS!@#
    Long Live MOYA!!

  • @drunkenpirate47x81
    @drunkenpirate47x81 3 роки тому

    Man the idea of a web game is just a pain in the ass, like imagine making a responsive game, just the thought of it makes head start hurting

  • @sebajsilva
    @sebajsilva 3 роки тому +1

    Wow!!! Looks great!

  • @IwanPieterse-iwanzbiz
    @IwanPieterse-iwanzbiz 2 роки тому

    Incredible Job. This reminds me of the old Rogue Squadron game.

  • @jet-pack-zombie2258
    @jet-pack-zombie2258 2 роки тому +1

    Actually really amazing. Simulates halo reach campaign misson and battlefront 2 amazingly great job

  • @americatoken3334
    @americatoken3334 2 роки тому

    A gem on youtube , either I have not search enough or you are the only one doing this 🤭

  • @highzenburger1829
    @highzenburger1829 3 роки тому +1

    Would 100% buy a JS game dev course. Didn't even think this was possible. Stumbled on your videos I'm happy I did.

  • @HereWasDede
    @HereWasDede 3 роки тому

    awesome work

  • @sanjaysinghbhandari3793
    @sanjaysinghbhandari3793 2 роки тому +1

    really amazing job ❤️
    please put a video where you tell how you know so much, your journey...

  • @daneilgreaves
    @daneilgreaves 3 роки тому +1

    Another amazing video

  • @dalelandry8787
    @dalelandry8787 5 місяців тому

    "I'm just gonna crap out some manual particle systems" damned amazing! You sir are an inspiration to say the least, subbed!

  • @infocyde2024
    @infocyde2024 3 роки тому

    You make me second guess my life as a developer :) You are brilliant man. Keep up the good work.

  • @marmont8005
    @marmont8005 2 роки тому +1

    you are such a cool guy!

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

    Really Amazing!!!!

  • @darialyphia
    @darialyphia 3 роки тому +1

    The legend is at it again

  • @felleg4737
    @felleg4737 3 роки тому +1

    Epic again! Came for the coding, stayed for the comedy (too) :D

  • @meepybeebaw4013
    @meepybeebaw4013 3 роки тому +1

    Not even into coding, still a super interesting video. And incredible how you did it.
    I'd give three thumbs up, if I had them.

  • @bunyslayer
    @bunyslayer 3 роки тому +2

    So uhh... turns out your a pretty good coder, this was fun to watch =)

  • @UnidayStudio
    @UnidayStudio 3 роки тому +2

    Amazing video! I have a small tip to help you on 7:06 of the video:
    You could simply select all the turrets in blender and then use this bpy code to return their locations:
    [list(obj.location) for obj in bpy.context.selected_objects]
    To run it, simply open a new blender tab and select the python console (or press shift + f4).

    • @simondev758
      @simondev758  3 роки тому

      Ooh thanks, I'll give that a try. Didn't even know there was a python console.

  • @andrewwoan
    @andrewwoan 3 роки тому +12

    yoooo that's epic

  • @chrisjames278
    @chrisjames278 2 роки тому +1

    This is awesome

  • @Jtatumlover0
    @Jtatumlover0 3 роки тому +9

    Lessgoo early gang pog

  • @JayanthBagare
    @JayanthBagare 2 роки тому

    Love your work and how you explain them. Just a suggestion, maybe you could cover 2d graphics also and some deep simulations such as fluid dynamics smoke etc.
    Would love to learn more from you

  • @krazybubbler
    @krazybubbler 3 роки тому +2

    I love your content. Awesome channel. I suggest you to check out react-three-fibre, maybe with use-cannon (physics) as this react stuff really makes game dev much easier IMO.

  • @matthewhigley1018
    @matthewhigley1018 3 роки тому +46

    Things I'll never be able to say:
    "I'm just gonna quickly crap out some particle systems..."
    "Then you gotta make a quicky crap AI for them..."
    Thing I have said:
    "Take the code and make this look less like crap..."

  • @SuperlativeCG
    @SuperlativeCG 3 роки тому +7

    It’s unlikely that all the technology in Star Wars is standardized between planets, so cord compatibility must be a nightmare

    • @simondev758
      @simondev758  3 роки тому +2

      It'd be like the old days of IBM pc vs macintosh

  • @esmailkhorchaniarts1142
    @esmailkhorchaniarts1142 3 роки тому +1

    This guy's JavaScript is on another level

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

    haha, love the "Shut up Meg" x)

  • @omgnowairly
    @omgnowairly 3 роки тому +1

    You inspired me to get busy again. Thank you.

  • @QuesterDesura
    @QuesterDesura 3 роки тому +1

    and again you did a great job :)

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

    I laughed quite a bit about the blender comment, because I am the same exact way with it.

  • @GhorthalonTheDragon
    @GhorthalonTheDragon 2 роки тому +2

    One of my favorite parts of this is that it uses web audio. And web audio by default uses HRTF for 3d positioning of sounds. So few games do this. I personally think all of them should at least have the option. Once you get used to actual 3d audio you never want to go back. Sound is extremely important. More game devs should be aware of this. Seriously put on some headphones and listen out for the explosions and how they move around. Web audio is epic. I'm very happy it exists. One of the most underappreciated things in web game dev I think.

    • @simondev758
      @simondev758  2 роки тому +1

      Yeah I was pleasantly surprised with how three.js integrated that.

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

      Sound design has always been disregarded in game design, erroneously I think. Look at every one of the most revered games in video game history, ALL of them, with almost no exceptions, have exceptional OST's, SFX, and ambient immersion.

  • @santozard
    @santozard 2 роки тому +1

    You’re amazing.

  • @michaelschlachter8865
    @michaelschlachter8865 3 роки тому +1

    You can export metadata into gltf from blender.. you add "custom properties" to the mesh...
    and then make sure Include->Data->Custom Properties is checked in the Exporter,

  • @kanpekiken2481
    @kanpekiken2481 3 роки тому +1

    God it’s like Simon reads my mind when he makes new videos

  • @CodingAbroad
    @CodingAbroad 2 роки тому +1

    Loving your videos. Have you used phaser js?

  • @victorisrael6191
    @victorisrael6191 2 роки тому

    You're amazing😵

  • @ademolaadenekan6869
    @ademolaadenekan6869 3 роки тому +1

    Awesome!

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

    Awesome video! WebGPU and Unreal engine 5 (web support) is coming soon, that would give so much power to web game devs.

  • @Ryan_Perrin
    @Ryan_Perrin 3 роки тому +1

    I love three.js!

  • @MyXNH
    @MyXNH 2 роки тому

    Thank you for your awesome work! Can you please explain the benefits of using sphere mesh and shader material for the skybox instead of just a scene's background property?
    P.S. Would definitely love to see more of your videos with shaders explanations

  • @blain20_
    @blain20_ 2 роки тому +1

    Very cool 😁👍

  • @cidadaodeatlas125
    @cidadaodeatlas125 2 роки тому +1

    omg, a true genius

  • @braedengaines5089
    @braedengaines5089 3 роки тому +1

    Great video man! Are you currently working on any official games, or just doing side projects right now?

    • @simondev758
      @simondev758  3 роки тому +1

      Working on my house mostly (see Instagram), these videos are my side projects.

  • @francisofthefilth8829
    @francisofthefilth8829 3 роки тому +1

    Yes you can export metadata in Blender/GLTF. Simply set it as a key/value pair in the object's properties area, then access as mesh.userData inside three.js.

  • @therealjtgill
    @therealjtgill 2 роки тому +1

    Just found your channel, happy to become a patron

  • @bennykell3
    @bennykell3 2 роки тому +2

    Very cool

  • @stef9019
    @stef9019 3 роки тому +3

    "Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should."

  • @keff_cb
    @keff_cb 3 роки тому +1

    cool stuff!!!

  • @SykoSilver
    @SykoSilver 3 роки тому +11

    This is fantastic. I was wondering, have you seen Sebastian Lague's channel? It's not JavaScript but if you ever want to go into procedural planet generation it might give you some ideas.

    • @simondev758
      @simondev758  3 роки тому +16

      His videos are awesome, love the quality of those videos. I have a series on procedural planets too. I kinda go in a slightly different direction than Sebastian, overall goal is to one day make a JS version of No Man's Sky, but I get sidetracked with other projects like this one :)

  • @cmcdonough2
    @cmcdonough2 3 роки тому +1

    That's so cool.

  • @ustymukhman613
    @ustymukhman613 3 роки тому +2

    Hi! Really awesome work, as always. And you've made me smile even more this time with your comments and the kid.

    • @simondev758
      @simondev758  3 роки тому +1

      Codes coming, I don't work much on these videos/projects so it's whenever I have a spare moment. I'll upload the code when I get a chance to clean it up a bit.

    • @ustymukhman613
      @ustymukhman613 3 роки тому

      @@simondev758 Totally understand that. Thanks for the reply, man!

    • @ASTERisk44946
      @ASTERisk44946 9 місяців тому

      @@simondev758 tried to play it but opened and nothing showed???? why doesnt the index display

  • @Nexzash
    @Nexzash 3 роки тому

    You friend is my new God.

  • @martinnel2810
    @martinnel2810 2 роки тому +1

    Really love your tutorials! Just a question, I'm looking for that explosion effect specifically... Is there anyway you can share just that 'ExplodeEffect' and 'ExplosionEffectEmitter' classes with me? It's around 3:04 in the video? Thank you very much and keep up the great work!

  • @buzbuz33-99
    @buzbuz33-99 2 роки тому +1

    On the Destroyer gun turrets you could create animated parts in Blender, load the model and animations into JS, and then manipulate the animations within the game to move the turrets. (I used that method to creating working parts on an aircraft - ailerons, rudder, etc. - and to create a full set of working cockpit gauges with little animated pointers.) But that took many days. Alternatively, you could have created simple 3D turrets in JS, and attached them at various points to the model you downloaded (in three.js you would make each turret a 3D object and make them part of a Group). But I suspect that whatever method you used is much much simpler. Well done!!!

    • @simondev758
      @simondev758  2 роки тому

      Great ideas, there's so many ways to approach it.

  • @jeremycoleman3282
    @jeremycoleman3282 3 роки тому +1

    I wanna play it! I ordered a $10 controller a week or so ago

  • @UrielHK
    @UrielHK 3 роки тому +1

    Amazing!

  • @ThePirateHistory
    @ThePirateHistory 3 роки тому +1

    Star conflict on minimals! but it's great

  • @nttn3666
    @nttn3666 3 роки тому +5

    Can you make a series on game development fundamentals, that would be very useful.
    You mindblowing me with your skills, keep up the good work

  • @michakrecisz5100
    @michakrecisz5100 3 роки тому +1

    please make whole course about it... I will pay any money for that!

  • @xherdos400
    @xherdos400 3 роки тому +2

    10:32 the gameplay there reminds me just of Star Fox free roam battle.
    still wish for a Star Fox game for pc :D

  • @hc3d
    @hc3d 3 роки тому +1

    I've been using JS for about 10 years now. Right now I'm working on a mobile app which uses WebViews for the UI.
    I was using some modern syntax such as the Let syntax as well as For-of. But I completely overlooked that classes are now supported by modern JS engines. I also see you using imports?
    If this could improve the scalability of the language, then javascript and html would really be the way to go when it comes to UI's (web and mobile).

  • @pist5343
    @pist5343 3 роки тому +2

    Awesome work! Great beta testers! Can't wait for the third edition a year from now 😁
    Btw simple way to make a space game look cooler is to add bloom. Its a pretty easy setup in 3js, wondering why didnt you go for it?

  • @davidconnelly
    @davidconnelly 3 роки тому

    Holy smokes! I saw the video title and thought it was a joke. That is staggering!

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

    fyi custom property blocks of blender objects (think python dict or js obj) get exported to userData on gltf exported from blender and imported with threejs gltfloader

  • @DavidHernly
    @DavidHernly 2 роки тому

    Great work Simon! Will this be on your github at some point?

    • @simondev758
      @simondev758  2 роки тому +1

      Yeah I keep forgetting to upload it, anytime I sit down I have all these ideas and forget about stuff like that.

  • @jombones3324
    @jombones3324 3 роки тому +1

    LEXX references are rare to an extreme degree.

    • @simondev758
      @simondev758  3 роки тому

      Hah was wondering if anybody would catch those.