How to make PIXEL PERFECT 2D Games with Unreal Engine 5

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 84

  • @CobraCode
    @CobraCode  Год назад +2

    Get my 12 hour course on how to make 2D games with Unreal Engine:
    tinyurl.com/Ultimate2D
    Get the Pixel Perfect Plugin, Samples and much more on Patreon:
    tinyurl.com/PixelPerfectTools

  • @HavekAttacketh
    @HavekAttacketh Год назад +20

    If anyone is looking to learn games seriously, this course is very low cost, but more importantly, it is literally the best one I have ever seen. I have used it and I freaking love it! It's super easy to follow! I highly suggest getting it if you wanna learn 2d or 2d 3d game making.

  • @thomasbuffler6041
    @thomasbuffler6041 11 месяцев назад +3

    You have earned a subscriber, First person to actually show me how to do this properly, thank you

    • @CobraCode
      @CobraCode  11 месяцев назад

      Glad it was helpful :D
      Thank you

  • @bitteryuki
    @bitteryuki 6 месяцев назад +2

    just bought your online course with a 86% discount. for sure i will use it!

  • @AngelsNeverFade
    @AngelsNeverFade Год назад +2

    this is so useful! I saw a reddit post just the other week asking for exactly this kind of a tutorial!

  • @HavekAttacketh
    @HavekAttacketh Год назад +2

    So I would love it if you made another course or maybe some mini courses that follow some of your views desires. Meaning like specific thing. The way you show efficiency is awesome, and I want to make a game that allows random rolled armor and weapon stats and things like that. I mean I have already purchased your first course and absolutely love and and I would gladly buy new ones. You are by far my favorite teacher in this field!

    • @CobraCode
      @CobraCode  Год назад

      Thank you so much :D
      I was prototyping a course about Beat Em Up creation, but it's on hold for now since I hit a lot of roadblocks when it came to the art assets.
      I am now 80% done prototyping and planning out a mega man style action adventure course though and that will be the next one to release.
      I do also plan on making a JRPG course and many more, however these do take a lot of time and work and my plan is to release one new course every 6 to 8 months.

    • @HavekAttacketh
      @HavekAttacketh Год назад

      @CobraCode oh I will be buying everyone! That make me so excited!

  • @antoniolattanzio8212
    @antoniolattanzio8212 3 месяца назад

    Great video! Btw I think that you you could fix the camera by just snapping the new position to the grid. Then you can keep using it without problems and with camera lag enabled too

  • @LegendaryNeurotoxin
    @LegendaryNeurotoxin 4 месяца назад

    Good stuff! I'd have to see how I can go from here to supporting 1-2 characters who go from a merged camera to split-screen when they get too far from each other. Split screen would be easy since they'd just have their own cameras, but I would need something that probably doesn't reside in the character BP to manage two shared with a camera that can move.

  • @marcozedler505
    @marcozedler505 10 месяцев назад +1

    Thank you! It helps to eliminate annoying jittery, but at the expense of smoothness, as it always snaps to the grid. Do you also show other solutions in your courses?

    • @CobraCode
      @CobraCode  10 месяцев назад +1

      Hey!
      No this is the best solution we've come up with so far.
      Don't think anybody has found a solution to make it smoother yet and it might take a while for the community to figure it out.

    • @marcozedler505
      @marcozedler505 10 месяцев назад +1

      @@CobraCode Solutions can be found, but they usually require direct intervention in the render pipeline, sometimes even changing the engine. I haven't found much for Unreal so far, actually only what you have already found. I think for most people it's enough to at least have a grid-sync camera with a lag factor.

  • @brandonjacksoon
    @brandonjacksoon Год назад +1

    Thanks mate! Always best information and tutorials!

  • @Snottle1
    @Snottle1 4 месяца назад +2

    Excellent tutorial, but I ran into a small issue. After setting my pixels per unit to .25, the background sprite I drew to use as a backdrop for my fixed camera arcade game has become much smaller and out of proportion with the player's sprite. I don't want to just scale it up in the play area, because I am pretty sure that would make it no longer pixel perfect. Can anyone help me out?

  • @FallenAshes-DaGamer
    @FallenAshes-DaGamer Месяц назад

    On scratch this is rlly easy; just have a forever loop that sets the position to a variable ‘x’ and ‘y’, then before you set position, use 2 ‘floor of’ blocks with those in and then set position to it.

  • @davidgonzalez-hg5bs
    @davidgonzalez-hg5bs 9 месяцев назад +1

    Hi Cobra! Loves your courses!
    I have a cuestion about screenshakes. I have the grid and solve the jittering, but when the screenshakes plays the jittering comes again, how can i solve this problem? Many thanks 😊
    Sorry for my English 😅

    • @CobraCode
      @CobraCode  9 месяцев назад +1

      Hey, thank you!
      Sadly with this solution there is currently a limitation of not being able to use the built in screenshake since it doesn't respect the pixel perfect system.
      You'd have to somehow hook into a tick that happens AFTER the screenshake is applied and make sure everything is aligned to the grid.
      There might be something like 'AfterUpdate' in the camera manager to do that.
      Or you'll have to create a screen shake system from scratch, which is a bit more involved.

  • @thomasbuffler6041
    @thomasbuffler6041 11 месяцев назад +2

    Legendary!

  • @FullMoonGame
    @FullMoonGame 7 месяцев назад +1

    Thank you, great video!
    Do you have any tips to achieve pixel perfect UI as well?

    • @CobraCode
      @CobraCode  7 месяцев назад +1

      Haven't gone down that rabbit hole yet, but I think for all things where you can use materials instead of just textures, you'll be able to use the same thing we did in the sprite material to align things to a grid.
      For fonts, buttons and such this will probably be hard though.

  • @hobbyist_bharatsuthar430
    @hobbyist_bharatsuthar430 11 месяцев назад +1

    I AM IN 😃 UR COURSE ,THANKS

  • @shivasouza6718
    @shivasouza6718 5 месяцев назад

    Thank you for this tutorial!
    Is there any way to keep the camera with sub-pixel movement, but stop the jittery look? I feel like this could be the best of both worlds. I have heard that it may be possible if you render the game with a 10-20px buffer to all sides, and then do some sort of secondary camera motion over the pre-rendered screen. But I'm not too sure on how to do this!

  • @RockyMulletGamedev
    @RockyMulletGamedev Год назад +1

    Great suff ! I probably should do that 😃

  • @k-ul4sm
    @k-ul4sm 6 месяцев назад

    Help! The jitter didnt't Stop for me. What should i do?

  • @Voudoo1
    @Voudoo1 10 месяцев назад +1

    Do you know any solutions, or links, for a custom made "camera lag" function ?

    • @CobraCode
      @CobraCode  10 месяцев назад +1

      That's actually something which is covered in my second course:
      tinyurl.com/2DActionPlatformer
      We set the spring arm to absolute location and then on tick interpolate it manually to the target location.
      In that case we don't apply the pixel perfect solution though and you'd have to add a bit to it to make the movement respect the pixel grid.

    • @Voudoo1
      @Voudoo1 10 месяцев назад +1

      @@CobraCode Thanks! I've just signed up for your course!

    • @CobraCode
      @CobraCode  10 месяцев назад

      @@Voudoo1 Thank you :)

  • @theofficialamt6626
    @theofficialamt6626 4 месяца назад

    Do you think you could make a tutorial on like a super mario world style game. Ive been wanting to make one for years now and wanna learn. Love the videos man! Keeo it up!

    • @CobraCode
      @CobraCode  4 месяца назад

      Hey, that's a bit too specific.
      If you just mean a platformer, than yeah I do have a couple of courses and videos on that.
      You would then have to apply what you learned to make it closer to mario world.

  • @mnkeybaker3861
    @mnkeybaker3861 Год назад

    Can you do a tutorial on 2d platformer enemies and level traps like spikes and saws etc

  • @daze8410
    @daze8410 10 месяцев назад +1

    Content is great keep it up

    • @CobraCode
      @CobraCode  10 месяцев назад

      Thanks, will do!

  • @Yntoxicboy.
    @Yntoxicboy. Год назад

    Hi, Amazing tutorial! I can see that the Jittering is fixed but the ground is Jittering IT seems blurry.
    IT happend when you run fast 🤔

    • @LudvikKoutnyArt
      @LudvikKoutnyArt Год назад +2

      Make sure you also disable motion blur in project settings or postprocess volume.

    • @Yntoxicboy.
      @Yntoxicboy. Год назад

      ​​​@@LudvikKoutnyArtI did all of that but maybe IT is something else. also you can see in this video at the end that IT happend to Cobracode's game. in minute 15:10

    • @CobraCode
      @CobraCode  Год назад +2

      Hey. The blurryness is probably just youtube compressing the video.
      But yeah, now that you say it, it does feel a little bit jittery when going diagonal.
      Would have to look more into how this looks in actual retro games, but I think they probably have the same issue because they are also just snapping the camera on the grid.

  • @Sou7Death
    @Sou7Death Год назад +1

    Please make another course, for example with such genres as jRpg, Adventure of easy roguelike game. Yes, I know what is more difficult to make, but you can show something basic, like with a platformer. For example, a 2D city and merchants and turn-based battles with monsters.

    • @CobraCode
      @CobraCode  Год назад

      Thanks for the suggestion.
      Already on my TODO list

  • @MoshiMoshiDoppio
    @MoshiMoshiDoppio Год назад +2

    Im sure you're very busy but it would be awesome if you could make tutorials for Top down 2d games, and more specifically custom AI navigation ( Since as far as I know Navmesh doesnt really work for 2d )
    Or if you know of any good ways to learn about that it would be very appreciated!

    • @swinny_
      @swinny_ Год назад

      Theres no reason navmesh wouldnt work for top down.
      source: I am using nav mesh for my isometric top down 2D chars

    • @MoshiMoshiDoppio
      @MoshiMoshiDoppio Год назад

      @@swinny_ there’s no floor for my game though, all the character are using the flying movement mode because I’m using the X and Z axis instead of X and Y

    • @CobraCode
      @CobraCode  Год назад +1

      That's a very specific case then and me making a general tutorial also wouldn't cover that.
      For flying you might need to look into 6DOF navigation.
      www.unrealengine.com/marketplace/ja/product/don-s-3d-pathfinding-flying-ai?sessionInvalidated=true
      But you only mention 2 axis, so you might be able to somehow crate a fake floor and use the regular navigation system.

    • @MoshiMoshiDoppio
      @MoshiMoshiDoppio Год назад +1

      Thank you for the reply, Ill look into this a bit more. Thank you for the link as well.@@CobraCode

  • @Neuromindart
    @Neuromindart 3 месяца назад

    After following the tutorial and double checking everything is set up correctly, I'm still experiencing a jitter when jumping diagonally. Is there a setting or something I need to change in my game?

    • @CobraCode
      @CobraCode  3 месяца назад +1

      Hey, sorry about not making that clear, but that is the one limitation I wasn't able to solve in time for the video.
      All of the other pixel perfect projects I saw side stepped that by having a fixed camera or only allowing camera movement sideways, so I thought there was still value to sharing this regardless, but the diagonal movement is still an issue.
      I believe this happens because we are handling the X and Y separately and it then jitters around if they are updated independently.
      Maybe there is a way to solve it by somehow rounding out the movement and making sure X and Y scroll at the same time.
      But I've also seen some Godot videos only use pixel perfection for snapping the sprites, but allow smooth camera movement instead of doing the snapping we applied.
      That way you get the best of both worlds and that's an approach I also want to try in Unreal... once I get around to it.

    • @Neuromindart
      @Neuromindart 3 месяца назад

      @@CobraCode no worries! We really appreciate all the work you're putting in to convert all this information from the other engines over to Unreal. 🙂
      I wonder if we can use a bool that checks if you're moving diagonal and breaks the pixel perfect during that time? I'm still new so that probably wouldn't work and comes with a host of other problems.
      I've been ignoring pixel perfect for now so I can use camera lag but now I'm trying to tackle the sub-pixel waviness that happens when the camera is catching up to the player. Have you found anything to solve this yet? There's a lot of material for unity/godot but I can't find much for Unreal. Even the Pixel2d plugin has the waviness/jittering with the camera lag.

    • @CobraCode
      @CobraCode  3 месяца назад +1

      @@Neuromindart Yeah, sadly camera lag is another one of those areas I haven't had the time to look deeply into yet.
      Would take some time to do the research and really figure it out.

  • @tempest2490
    @tempest2490 11 месяцев назад

    Very good tutorial!
    But i have one question, when i package my 2d game all the textures are blurry, why is that so? is there a fix?

    • @CobraCode
      @CobraCode  11 месяцев назад +1

      Hey that's a bug with the texture settings.
      'Apply Paper 2D Texture settings' sets the texture filtering to Default (from Texture Group), however when packaging a game it needs to be set to 'Nearest'

    • @tempest2490
      @tempest2490 11 месяцев назад

      @@CobraCodeokay thank you!
      Im sorry, im really new to UE, but where can i find it? When im searching in the Project settings for it, i cant find it. The only thing i can find is "Defaul Sprite Texture Group", and that is set to "2D Pixels"

    • @CobraCode
      @CobraCode  11 месяцев назад +1

      @@tempest2490
      Hey, it's not in the project settings, but in the settings of each texture you import.
      You can double click it and search for filter on the right side, that's where you can set it.
      Editing them one by one is very cumbersome though, so you can select all of them, right click, asset actions and bulk edit.
      docs.unrealengine.com/5.3/en-US/property-matrix-in-unreal-engine/

  • @WeredDev
    @WeredDev 9 месяцев назад

    Hey great videos! :) I also bought ultimate course and did it in 3 days - great job!
    I have a question about pixel perfect. Can I in >_UnlitPixelPerfectMaterial change Blend Mode from Masked to Translucent? So I can still manage visibility by translucency sort priority?

    • @CobraCode
      @CobraCode  9 месяцев назад +1

      Hey, yeah both masked and translucent should work with a pixel perfect set up.

    • @WeredDev
      @WeredDev 9 месяцев назад

      @@CobraCode Great thank you very much for fast response! :) I'm also wonder if you found some solution for jittering when moving diagonal?

    • @CobraCode
      @CobraCode  9 месяцев назад

      @@WeredDev
      Sadly I have not found a solution for that quite yet :(

  • @evogarciagaming6791
    @evogarciagaming6791 Год назад +1

    Works perfectly :)

  • @PorkChopSuey
    @PorkChopSuey Год назад

    A great tutorial as always. I've been learning a lot from your 2D/2.5D tutorials! However, one issue I've noticed for the unreal editor and packaged game builds on windows is that the Unreal editor and packaged Unreal games don't seem to display the GPU usage directly in their own processes under windows task manager. I was wondering if you have experience with this issue?

    • @CobraCode
      @CobraCode  Год назад

      Hey, sorry but I actually didn't know about that and don't have any advice to give on that.
      If you want to optimize things, it's probably better to look into the profiler into the engine itself.
      Of course there's gonna be some performance differences between running the game in the editor and as an executable.

    • @PorkChopSuey
      @PorkChopSuey Год назад

      @@CobraCodeHey thanks for the response! I've actually been using the profiler for the builds and general stats in the editor. The builds and in editor are all fairly performant, including the GPU usage. I've just been a bit confused that the GPU usage isn't directly displayed in the task manager though, but I suppose it's not a huge concern for now.

  • @hasanshafy_
    @hasanshafy_ 11 месяцев назад

    Do all the sprites need to be 0.25 PPU for visuals to look consistent? For Instance, I have my enemy sprites around 0.5 PPU. Will this be an issue?

    • @CobraCode
      @CobraCode  11 месяцев назад

      They will all have to have the same PPU.
      But even if you're not aiming for a Pixel Perfect look, mixing PPU is something you should avoid since it leads to 'mixels' and makes the game look inconsistent.

    • @hasanshafy_
      @hasanshafy_ 11 месяцев назад

      @@CobraCode I've been going back and forth with this. Some of my Sprites are 8x8 while others are 16x16. If I put all my Sprites to 0.25, the size varies. Any idea on how to solve this? Or should I just stick to the same sprite size?

    • @CobraCode
      @CobraCode  11 месяцев назад +1

      @@hasanshafy_ I would stick with the same sprite size from the get go for a consistent art style

  • @stefaniebollen2167
    @stefaniebollen2167 10 месяцев назад

    I know you're super busy, but I can't seem to get my pixel size to stay consistent - some always look slightly too wide or too tall compared to others. Pixels per unit are 0.25 like yours, camera ortho width 1024. Nothing seems to work :( Would love your thoughts on how you got them to look so perfect

    • @MrKubson1
      @MrKubson1 6 месяцев назад

      I have same issue, but didnt found good solution for this. I guess, problem comes from layers separation but never confirmed this. If you scroll close to Your map You'll see that each layer is seprarated, form Translucency Sort Priority. You can try to separate them manualy by Your pixel per unit ratio (incase of video it is 4) sometimes this helps. Also for map You can try padding textures but this is horrible solution and is irreversible so MAKE A BACKUP.
      Now question comes, what sprites size You use. For 32x32 pixels this seems to not exist so You can try to export bigger sprites. For 16x16 pixels this is bad and seems to be even worse for 8x8 pixels.
      From what i remember Cobra Codes sprites are 32x32, but i guess He must confirm this...

  • @ariiqwicaksana5944
    @ariiqwicaksana5944 Год назад

    Can you make tutorial about 2d ragdoll in unreal please🙏

    • @CobraCode
      @CobraCode  Год назад

      I don't think there's support for anything like that in UE.
      You'd probably have to code a plugin from scratch :(
      That does sound really cool though.

  • @ZimMabu_GameDev.
    @ZimMabu_GameDev. 10 месяцев назад

    Hey Cobra Thanks Mate for the informations ^^
    (it destroys my game because i need more EXP with unreal .... be careful make maybe a copy of ya project just a tipp :)

    • @CobraCode
      @CobraCode  10 месяцев назад +1

      Hey, yeah like I explained in the video, you have to be careful to not miss a step or things can get messed up.
      Please double check that you didn't skip anything.

    • @ZimMabu_GameDev.
      @ZimMabu_GameDev. 10 месяцев назад

      yes everything is fine cobra code thank you very much you can't help it that I'm still too inexperienced
      But the fact that you as a teacher are trying to earn money and thus help other people deserves a blessing :)@@CobraCode

    • @ZimMabu_GameDev.
      @ZimMabu_GameDev. 10 месяцев назад +1

      @@CobraCode
      yes everything is fine cobra code thank you very much you can't help it that I'm still too inexperienced
      But the fact that you as a teacher are trying to earn money and thus help other people deserves a blessing :)

  • @Punisher1992
    @Punisher1992 9 месяцев назад

    tbh, i worked with ue2d since early ue4, and i have to say, if you dont wanna use something special that unreal offers... switch to another engine. I recommend godot. As much as i love unreal, its just to big for 2d. I hoped they added a seperat 2d fork while i was waiting for years, but that was not the case.

    • @latef3663
      @latef3663 8 месяцев назад +1

      Hi! Out of pure curiosity, whats wrong with the “too big”? Would that make the game run slower? Or its just very hard to use

    • @Punisher1992
      @Punisher1992 8 месяцев назад

      @@latef3663 its not like "out of the box" 2d, you have to fiddle around, what you can achieve in second in godot. You can buy 2d plugins like paperzd, but its money spend not wise. Also gdscript is ez af and easy to learn. Its fast and lightwheight. Unreal the minimum space is 150 mb or something unlike godot which is 5 mb. Unreal uses the 3d engine for 2d, and godot has a seperate 2d engine and 3d engine to choose from.

  • @AlecInColor
    @AlecInColor Год назад +1

    Noice

  • @sorenspunkt5374
    @sorenspunkt5374 2 месяца назад

    Here's how you do it: use another engine.
    Nobody should use Unreal for a 2D game. Except you sell courses

    • @CobraCode
      @CobraCode  2 месяца назад

      Tell that to the creator of ender lilies who made over 20 million dollars using UE4 to make 2D games.
      You might want to read through this full list:
      cobracode.notion.site/2D-Games-made-with-Unreal-Engine-8817410208bd4fa68f26bc660e7bb0ad

  • @k-ul4sm
    @k-ul4sm 6 месяцев назад

    Help! The jitter didnt't Stop for me. What should i do?