I Tried to Make Star Wars Battlefront II in JavaScript
Vložit
- čas přidán 13. 06. 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 - Věda a technologie
Help support me: www.patreon.com/simondevyt
Where did you get that space HDRI/cubemap?
no thanks
you need to do some Udemy course for JS games!
The current Udemy game selections are nothing like this. typically just bad side scrollers.
we need
It'd be one entire course just for all that physics black magic.
pleas take my money
second that
Id buy it too. You should really consider this.
This straight looks like the oldschool battlefront game, amazing. Take me back to the glory days Simon.
Your use of shaders is so spectacular. You do all this advanced texturing and noise without any node-based programming or other GUIs.
wowowoowowow
As they say, knowledge is power.
It's not much of a leap to go from node programming to code, if you're not dyslexic
Sometimes it isn't if you can, it's if you should, but you have my support anyway.
So keep doing everything in js is what I'm hearing?
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?
Learner here trying to understand- is there a reason why it shouldn't be done? Performance related reason?
@@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.
@@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.
Who wants a crossover with Sebastian Lague? SIMONDEV X CODING ADVENTURES
Please
That would be interesting 🧐
C# and JS, sounds hard
@@ivanraulsanchezdiaz7499 use wasm
oh it'll be cool
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
Any similar channels?
Sebastian Lague is great!
9:39 Underrated Futurama joke wasn’t expecting Elzar
I'm learning Web Dev and I think it's awesome to see all the cool stuff you can do with js.
Cool video 👍
9:22 "Noise is a great subsitute for actual art direction" :D
I like how smooth the movement is. Makes the actual game look like 100% lighting and particle-flare.
"I'm a leaf on the wind" made me cry a little, still got PTSD from that scene
Yeah that one really sticks with you.
@@simondev758 just like a harpoon would.
Zing!
Always so impressive. Thanks for sharing this with us!
This is so cool, I love when you make these videos 🙌🏽
I love your dedication, awesome work man!
I can't believe you made this in JavaScript. It's really good looking. Your very talented to be able to code this together.
4:07
I’m crapping out particle systems myself as I watch this
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!
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!
Sweet, thanks!
Keep on rocking js game dev, you are unique, talented, entertaining, awe inspiring
Very interesting to listen to how you go about making these JavaScript games!
Absolutely fantastic game! I loved the space battles in the now named 'Classic' Star Wars Battlefront 2
Exactly what I was looking for, thank you so much!
When you showed your full game, I instantly understood the UI of Freelancer games that highlighted enemy ships and where to aim
Looks really good, I think adding some not too bright light source reflecting from the planet would make it look even better
Amazing as always👍
10:52 tie fighter smashing into eachother
love your work
Actually really amazing. Simulates halo reach campaign misson and battlefront 2 amazingly great job
Wow!!! Looks great!
Would 100% buy a JS game dev course. Didn't even think this was possible. Stumbled on your videos I'm happy I did.
Man I'd go crazy trying to write this in JavaScript instead of TypeScript. Nice job.
I'm laughing/smiling watching this. especially when I saw the kid playing the game. wow!!!
Incredible Job. This reminds me of the old Rogue Squadron game.
Another amazing video
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
Surprised no “do a barrel roll!” At the end
Great work btw!
Really Amazing!!!!
awesome work
You make me second guess my life as a developer :) You are brilliant man. Keep up the good work.
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).
Ooh thanks, I'll give that a try. Didn't even know there was a python console.
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
Awesome video! WebGPU and Unreal engine 5 (web support) is coming soon, that would give so much power to web game devs.
really amazing job ❤️
please put a video where you tell how you know so much, your journey...
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.
Awesome inspiration, many thanks... and that Farscape reference in the game!! KUDOS!@#
Long Live MOYA!!
I miss that show.
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.
Yeah I was pleasantly surprised with how three.js integrated that.
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.
This is awesome
So uhh... turns out your a pretty good coder, this was fun to watch =)
KID: MY DAD MAKES VIDEO GAMES FOR ME , HE IS A LEGEND.
"I'm just gonna crap out some manual particle systems" damned amazing! You sir are an inspiration to say the least, subbed!
and again you did a great job :)
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.
Awesome, thanks!
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.
A gem on youtube , either I have not search enough or you are the only one doing this 🤭
you are such a cool guy!
Everything looks so simple when you compress it like this =) Thanks for awesome content! (Yes, Star Trek is better)
Hi! Really awesome work, as always. And you've made me smile even more this time with your comments and the kid.
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.
@@simondev758 Totally understand that. Thanks for the reply, man!
@@simondev758 tried to play it but opened and nothing showed???? why doesnt the index display
Awesome!
The legend is at it again
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!!!
Great ideas, there's so many ways to approach it.
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,
Very cool
Very cool 😁👍
I love three.js!
cool stuff!!!
Amazing!
You inspired me to get busy again. Thank you.
You're amazing😵
I laughed quite a bit about the blender comment, because I am the same exact way with it.
Epic again! Came for the coding, stayed for the comedy (too) :D
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..."
God it’s like Simon reads my mind when he makes new videos
You’re amazing.
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?
Laziness :(
@@simondev758 :(
3rd version next year!
@@simondev758 :>
This guy's JavaScript is on another level
That's so cool.
yoooo that's epic
haha, love the "Shut up Meg" x)
Just found your channel, happy to become a patron
Thank you so much!
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
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.
Sweet, useful for next time.
Great video man! Are you currently working on any official games, or just doing side projects right now?
Working on my house mostly (see Instagram), these videos are my side projects.
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.
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 :)
It’s unlikely that all the technology in Star Wars is standardized between planets, so cord compatibility must be a nightmare
It'd be like the old days of IBM pc vs macintosh
Can't wait to watch! 😁
I'm gonna give UE4 a shot, and see what I can do with it.
they've just released UE5. Mb looking into that instead might be a good idea
@@tomm.4447 fight the temptation for now. UE5 still has bugs where UE4 doesn’t. If you jump into learning UE4 now, by the time UE5 gets a full release you’ll be fully prepared to take advantage of what it has to offer, and learn the new features
@@tylerclinton3475 fair point. Well decide for yourself OP
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!
Epic !!!
Star conflict on minimals! but it's great
10:32 the gameplay there reminds me just of Star Fox free roam battle.
still wish for a Star Fox game for pc :D
Loving your videos. Have you used phaser js?
Its too good man. I made a space shooter in js but it's not nearly as cool as this!
please make whole course about it... I will pay any money for that!
Genius....!!
omg, a true genius
I wanna play it! I ordered a $10 controller a week or so ago
Crazy
Amazing
AWESOME!
"Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should."