How To Make a 3D Space Shooter Game in Unity - Tutorial

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 137

  • @tomiczdarko
    @tomiczdarko 9 місяців тому +12

    This is the tutorial that Starfield devs watched :)

  • @faryanblender8946
    @faryanblender8946 10 місяців тому +7

    We had our presentation today for our 3d space-shooter school project, and they loved the space dust particle effect. You helped us alot, thanks again !!!

  • @peter_gagliardi
    @peter_gagliardi Рік тому +6

    Just finished this tutorial and can't wait for the rest. It's extremely well done.
    I've been writing music for an old space shooter called Freespace 2 for a while, and love the idea of learning to create a space shooter myself. I'll eventually be able to use this to showcase / test some adaptive music 😊

  • @lee1davis1
    @lee1davis1 6 місяців тому +2

    I made my own physics controller for my spaceships years ago. Yours is way better.

  • @SlveMonteiro
    @SlveMonteiro 2 роки тому +4

    Thank you for this tutorial! As a complete beginner to Unity, without any prior experience, this was a great introduction! Your explanations were clear, the pace was good, and the scope was nice and manageable. I will definitely be checking out more of your content!

  • @vequne-he2cb
    @vequne-he2cb Рік тому +1

    This is a great video and I greatly appreciate its existence. For the first time in over a decade I felt the need to log in just to comment (and like and sub).

  • @AleksandarTrimchevski
    @AleksandarTrimchevski 6 місяців тому +1

    Thanks a lot. I was searching for a Unity tutorial that’s go through whole process for my free educational game and your expertise and clear explanation made a huge difference. ♥

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

    Your coding practices are on a fairly high quality level and your naming conventions are just perfect (i am using the same naming conventions since a few decades 😀). I'm impressed 👍
    This is the coding level i expect from a teacher, very good job so far. Your voice is clear and easy to understand, also the pacing is just perfect 👍
    You outperform easily many many other teachers on Udemy for example, by far.

  • @Aliismail3D
    @Aliismail3D 2 роки тому +4

    Great tutorial Greg, very happy to see that the Hi-Rez spaceships managed to find their way here!

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

      Thanks!!!

    • @lunar_order
      @lunar_order 8 місяців тому

      I use that in specific and I really hope you can make a tutorial on how to make it a 3d game that involves flying but also walking around

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

    saw you on the game dev discord loving your tutorials Thank you

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

    Thank you for this tutorial!

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

    Awesome! Have started with Unity so I have some knowledge and with this tutorial was perfect and short enought to follow through! Thanks again!

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

    This is pure gold! OMG thank you so much!

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

    Thank you for this great tutorial series. Just found your channel and it is a real hidden gem here =) Very good content and easy to follow. Think this channel deservs alot more subscribers! Keep it up and lets help grow this awsome space.

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

      Thanks so much Tomas. I hope you find the tutorials helpful.

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

      @@midniteoilsoftware Super helpful. Changed the thruster with +1,0,-1 values. Added also side and up thrust. Using A+D for side thrust and R+F for up/down thrust. Feels very good to fly =) Idea is to have a space shooter, where you can enter and leave ship. Walk around in the ship hopefully. But I think that can be tricky. I will go though your tutorial first and I think I will learn alot. Only reached part 2 so far.

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

      @@dronkarian Very nice. Yeah, the series is really intended to lay the groundwork for the necessary components for a space shooter. The type of game you make with those components is really up to you.

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

      @@midniteoilsoftware I loved to make the joystick move. I duplicated the joystick and now have 2 of them, one on left side and one on right side. Left controlling thrusters up, down, left, right, side to side. And the right is pitch, roll and yaw. Works very well and could easily do this based on your material. I added an object in space (sphere) that i can move around and test the movement. Works like a charm. I am curious what next episodes will have. I done the two virtual cameras now also.

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

      @@dronkarian Sounds awesome!

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

    Fun watch, the input manager script was kinda cool enjoyed how you did that

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

    I Really Like Your in " Depth Tutorials " , Thank you

  • @ASouza-ut9kb
    @ASouza-ut9kb Рік тому +2

    Thanks for the tutorial!

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

    Thanks, subscribed..I found your channel on Andrew's discord. I'll go through your videos when I get time 🎉

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

    I've been half assing my way through a space shooter (because whilst making a game is a dream, being a developer is not) since the start of the pandemic so please finish this :D
    Some things I would love to see :
    1) a single player level
    2) bot multiplayer (or even human pvp if you're feeling brave)
    3) shields or upgrades
    4) full screen map
    5) comms between ships
    6) third / first person (dunno if you are already doing this or not yet)

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

      Define finished-lol. What would you like to see in the game?

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

      @@midniteoilsoftware :) fair point.

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

    Thanks.
    Look forward to more.

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

      Glad you like it. If there’s something specific you’d like me to add let me know.

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

    Im, having trouble with my game scenes where y play my game and it doesnt show the 3d model, it just shows the background 31:31 this part right here im having troubles with

  • @RetroSteve0
    @RetroSteve0 3 місяці тому +1

    Heheheh, I was waiting at 1:28:00 to see if you realized you needed to click in the game window for it to hide the cursor ;)

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

    Love the tutorial so far, its really helped me understand unity better. But im stuck on 37:23 where you create a boxGroup. I get the following error: "The type or namespace name 'BoxGroup' could not be found". From what i can find online its because i dont have the Odin Inspector, is there a way to achieve the same goal without having Odin?

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

      Unfortunately no. Your options are either to exclude the Odin attributes (you don't need them, things just won't be laid out as nice in the inspector) or get a trial version of Odin. I also believe that Odin provides a dll that you can include that will prevent you from getting compilation errors even if you don't have Odin but I don't know off the top-of-my-head what it's called or where to get it.

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

      BTW, because of this issue I removed Odin from the project later on in the series.

  • @TheCHAT-
    @TheCHAT- Рік тому +1

    I'm stuck at the point where you add the player ship because when i look in the game view the ship doesn't show up

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

      Join my discord and paste a screen shot of what you see for the PlayerShip in the inspector.
      I'd also check your camera settings and make sure everything is on the correct layer.
      discord.gg/wrdqXPtw9y

    • @andreaturchet7888
      @andreaturchet7888 3 місяці тому

      i have the same issue... did u got it working?

    • @eshagond5818
      @eshagond5818 3 місяці тому

      ​@@andreaturchet7888 If u see the settings box for the main Camera, there's an option to change the value of "Depth", make it 0. Also change the layer to default.

  • @bernienepper
    @bernienepper 3 місяці тому +1

    I like your style - I played Q-bert - and coded in 8-bit assembly. Georgia Tech EE 1971 - sorry

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

    What would you advise If I wanted to add a drifting mechanism to the spaceship?

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

      Explain what you mean by a drifting mechanism.

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

      @@midniteoilsoftware When yawing or pitching the aircraft there would be some kind of a slide/drift to the aircraft movement

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

      You mean strafing?@@newsystem3667

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

    I know I'm in late, but it's cool and maybe I will remake the Freelancer game! 😁🤟

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

    Great tutorial. But I am a little bit blocked, because i'm not able to move my ship forward (thrust) Roll and pitch is ok.
    This cause my problem: "public override float ThrustAmount => Input.GetAxis("Vertical");"
    Is there a way to use W and S?

    • @midniteoilsoftware
      @midniteoilsoftware  9 місяців тому +1

      Are you using the old unity input system or the new unity input system. In the old unity input system. WASD are used for the Vertical and Horizontal axis. If you're using the new system you can peek ahead at the most recent video where I show how to use it.

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

      Well, I ihink that I'm using the old input system. When checking Project Settings it shows me under Name: Vertical and under Alt Neg, Button: s and under Alt Pos. Buttom w.

    • @midniteoilsoftware
      @midniteoilsoftware  9 місяців тому +1

      that is what I would expect to see. If you press w, than Input.GetAxis("Vertical") return return a value between 0 and 1 and if you press s it should be between -1 and 0. docs.unity3d.com/ScriptReference/Input.GetAxis.html@@PierrotMeurisse

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

      First of all I want to thank you for your support, but I'm not able to move forward. I check the settings in the input manager. For me these parameters should be ok, but no changes in the game. What else can it be? ☹Makes me really sad.

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

      I would start simple. Create an empty game object and add script that in Update just calls Debug.Log($"vertical input = {Input.GetAxis("Vertical"}));@@PierrotMeurisse
      Run the game and see what you see in the console when you press w/s.

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

    I followed along up till 16:59, but couldn't download Odin Inspector Package, because it's not free. [edit] Was reading the comments, and came across, where you said you removed Odin, later on in the project, so maybe I can keep following along without Odin?

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

      There’s a link to a free DLL in the video description that will let it compile without errors but without the Odin benefits.

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

      @@midniteoilsoftware I found it, in your github, where do I put the dll?

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

      @@haroldmcbroom7807 The same folder it's in on github:
      Assets\Plugins\Sirenex\Assemblies

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

    I've started following your tutorial and I have and issue. I got a different ship model and i can use it to do everything shown. but when I apply trust to the ship it starts to shake and it get so dramatic that the prefab its self starts to destruct... any ideas?

    • @midniteoilsoftware
      @midniteoilsoftware  10 місяців тому +1

      Does it start to shake immediately or only after you've traveled a long distance? There is a known floating point precision error in Unity where physics based movement starts to "jitter" when you get far from the origin point.
      You can play around with the Interpolate property on the Rigidbody. This article goes into great detail about that
      blog.terresquall.com/2020/08/unity-rigidbodys-interpolate-property

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

    hello, my background is not moving when going in the play mode at the end. can you please suggest some solution?

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

      Sure, I'd love to help. Did you attach the MatchRotation script? For more detailed help, be sure to join my discord channel where you can post screen shots and code snippets.
      discord.gg/wrdqXPtw9y

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

    Great project, actually on my 4th rendition and hoping for some direction with: Using Cinemachine (where my project crumbles and dies lol) - the reason that I am on the 4th rendition.
    I do have other projects that call Using Cinemachine and do so without any problems, so not understanding where the issue comes in
    The latest attempt: updated Cinemachine to the most current version - reworked the tutorial, but still getting namespace error - loaded dlls which made VS happy, but did nothing for the Unity error

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

      I'm sorry you're having issues. I'd like to try to help. Maybe post some screenshots of there error your getting on my discord and I can take a look.
      discord.gg/QMZuxfWA
      If you pull the latest from github do you still get the errors?
      github.com/gbradburn/3D-Space-Shooter-Tutorial.git
      I'm wondering if you're having issues because of the assembly definition file. If you're following along, early in the series I was using an assembly definition file and you'd have to be sure to add an assembly reference for cinemachine. But, later in the series I removed the assembly definition file because it caused more issues than it solved for me.

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

      @@midniteoilsoftware Thank you - somehow missed the removal of the assembly

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

      @@BillSoutherland We all miss things. So it's working now?

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

      @@midniteoilsoftware well I believe so - because I had missed the assembly removal, a number of my scripts didn't like what you were doing so my scripts didn't always align with yours. I'm back to tutorial 5 now - anxious to get the AI back up and running - I miss the show I was watching about a ship maneuvering through an asteroid field (yes, my wife wonders about me too)

  • @dontfeedthetroll7224
    @dontfeedthetroll7224 6 місяців тому

    How do you archive the UI of Unity going green if you start the game?

    • @midniteoilsoftware
      @midniteoilsoftware  6 місяців тому +1

      ua-cam.com/video/Ujay8-n1XHs/v-deo.html

    • @dontfeedthetroll7224
      @dontfeedthetroll7224 6 місяців тому

      @midniteoilsoftware thanks for the tip. I messed up my scenes so often. Your videos are just great. I followed your tutorial today. Although the URP shader does not really work with the HiREZ ships (textures are a bit broken and need manual rework and camera also does not have the clean option. But the basic ideas are great.

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

    Is it possible to make this game with 2022.3.20f1 unity editor?

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

      Absolutely! If you run into any problems you can post on my discord and I'll try to help you out.

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

    Im stuck at the very start .. idk if its some kind of bug or what it is , i cant bind c# script to camera object :/ i hope ill get over this so i can continue , great tutorial btw :D !

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

      Hard to know without seeing your code. It won’t let you attach a script if there are compilation errors.
      Edit: You can also grab my code from the GitHub link in the description.

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

    Great tutorial! Question: what is the purpose of multiplying forces by fixedDeltaTime? Seems it just makes you to scale up your configurable forces. Thanks!

    • @midniteoilsoftware
      @midniteoilsoftware  9 місяців тому +1

      It makes it frame rate independent. Different machines will run at different speeds and you want the same behavior on all of them.

    • @midniteoilsoftware
      @midniteoilsoftware  9 місяців тому +1

      docs.unity3d.com/Manual/TimeFrameManagement.html

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

    Hey, I'm having trouble with the SkyboxSetter script. I couldn't get mine to generate the skybox materials section. I don't see any errors in my code looking over it, seems exactly the same, and there are no errors reported at the bottom of Visual Studio 2020. It says no issues found. However, I detached my script then tried reattaching it, but now Unity says theirs compile errors. Best I can tell, elements like [Required] and [SerializedField], didn't prepopulate for me as I was typing them, so I'm thinking I'm missing some package or something??? Sirenix OdenInspector didn't change colors or prepopulate either.

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

      Ah. In later videos I removed all the Odin attributes because of issues like this. You have 2 choices: install Odin Inspector (they have a free trial) or remove the Odin attributes.

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

      There’s also a DLL that Sirenia provides that fixes the compilation errors but doesn’t give you the inspector functionality.

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

      @@midniteoilsoftware What's the implication for not having the oden functionality? It's an inspector, so I wouldn't be able to attatch certain elements???

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

      @@midniteoilsoftware Awesome, I did catch at the very beginning, when you pointed out the Oden aspect but I just didn't quite get it. I felt like that must have been what was missing.

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

      @@midniteoilsoftware I went and checked out the the site for the 90 day trail. Feels like if I rip out those elements that would really mess up the code. Not a small workaround. Oh duh, you just said you removed it in later videos. I'll just grab the code and move along. Thanks for the reply.

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

    Does anyone know why at 21:06 I can't find the material part.

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

      Are you saying that the material property isn't on the _skybox member?

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

      @@midniteoilsoftware yes

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

      @@midniteoilsoftware never mind I've managed to fix it seems like I wasn't paying attention to the video.

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

      did you declare it as a Skybox? Also, are you using the standard (built-in) render pipeline or URP pipeline? Both of those support the Skybox component. Only HDRP doesn't.
      docs.unity3d.com/ScriptReference/Skybox-material.html

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

      Glad you got it working. BTW, you can also post questions to my discord channel and even paste code snippets and screen shots.
      discord.gg/wrdqXPtw9y

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

    Could I pretty much do this same thing but with 2D sprites like in Wing Commander?

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

      Perhaps but it would be a lot of unnecessary work, specifically around rendering the enemy ships to show the correct perspective distance/position relative to the player. In 3D the engine handles all this for you.

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

      @@midniteoilsoftware Do you know where I could find a tutorial that covers a topic like that? I haven't been able to find anything about making a game like that. I'm going to follow your tutorial soon though to get a better understanding of Unity.

    • @midniteoilsoftware
      @midniteoilsoftware  9 місяців тому +1

      No. All the 2D space combat tutorials I've seen are top-down. If you want an example of that, my Starcastle tutorial would be good. But honestly, I don't know why you wouldn't just want to make it 3D. @@NotHere2SellCookies

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

      @@midniteoilsoftware i'm more interested in the older 2D and pseudo 3D games of the 80s and 90s.

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

      My Beamrider tutorial sort of fits that category.@@NotHere2SellCookies

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

    bor u didnt Provided Cinemachine Link??

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

      Cinemachine is provided by Unity. In package manager it’s either under Built-in or Unity Registry. I forget which.

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

      I also found finding Cinemachine very tricky. It's not in the asset store, there's a $25 version there, but not the free one. For the free one, you have to got the "Asset Management" and at the top there, in the dropdowns, chose the registry or one of them, that's not "my project", then search for "cinemachine".

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

    can u write little code for joystick controller (for yawamount) lpls give me little example ty

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

      I show how to add Joystick support in my Joust tutorial.

    • @mehmetklc5472
      @mehmetklc5472 10 місяців тому +1

      @@midniteoilsoftware Thank you master xd

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

      My most recent video adds Gamepad/XBox controller support using the new Unity input system @mehmetklc5472

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

    Invalid expression term '>='

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

      If you’re asking for help with that error that’s not nearly enough to go on. Make a post in the support channel on my discord server and include code snippets and screen shots and I’ll take a look

  • @bernienepper
    @bernienepper 3 місяці тому

    free-free-free-free -- Oden=$50(your crutch) -bye

    • @midniteoilsoftware
      @midniteoilsoftware  3 місяці тому

      If you don't want to pay for Odin, you can download their free dll from the GitHub link above so the code in this tutorial will compile but without the benefits Odin provides.

  • @hungrygrimalkin5610
    @hungrygrimalkin5610 8 місяців тому

    I don't know what your deal is with that ridiculous method of setting the skyboxes. You wrote an entire script for it? The problem is you don't explain what your design roadmap is. Are you going to use just one scene and just use scripts to replace skyboxes, enemies and objects?

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

      The idea was to be able to programmatically change the skybox. I never got that into the game. I'm curious as to what exactly your objection is. Setting the skybox material via script is a common and valid approach in Unity, especially in situations where you want to change the skybox dynamically based on game events or player interactions.

    • @hungrygrimalkin5610
      @hungrygrimalkin5610 8 місяців тому

      @@midniteoilsoftware It made me quite uneasy the way it interacted with the flight controls themselves. You had to take extra steps there to make sure it aligned properly with the ships rotations. Also in my mind, different skybox is different scene but I could see your method being useful in a cutscene context.

    • @midniteoilsoftware
      @midniteoilsoftware  8 місяців тому +2

      @@hungrygrimalkin5610 I'm not sure what you mean. I didn't do anything special to "align" the skybox. The only thing I did was match the background camera rotation to the main camera's rotation. That has nothing to do with whether the skybox was set programmatically or not.
      I guess I could have had the main camera render the background layer. There are several reasons you'd want to do this (although I never got to it in the series):
      Performance optimization (the bg camera can have a lower depth, ensuring it renders first and potentially reducing the complexity of the main scene's rendering., Layering: You can use different layers for the background and the main scene objects. This allows you to apply different effects, such as post-processing effects, to each layer independently.
      Parallax Effect: If you want to create a parallax effect where the background moves at a different speed than the main scene, using a separate camera can simplify this effect.
      Skybox Control: Using a separate camera gives you more control over the skybox, allowing you to animate it or change its properties independently of the main scene. This would mainly be useful for day/night cycles.