Sprite Stacking in Python and Pygame

Поделиться
HTML-код
  • Опубликовано: 1 июл 2024
  • Sprite Stacking Pygame Tutorial on Creating a Pseudo 3D Game Engine in Python.
    Assets:
    drive.google.com/file/d/1hphi...
    All code from video:
    drive.google.com/file/d/1jyYs...
    Github (with collision and shooting)
    github.com/StanislavPetrovV/S...
    MagicaVoxel:
    ephtracy.github.io/
    Editor for SpriteStacking (found on github):
    github.com/antopilo/SpriteSta...
    00:00 Intro
    01:52 Initial Setup
    03:09 Sprite Stacking
    09:36 Caching System
    13:37 Player
    19:26 Scene
    21:19 Y-sorting
    23:37 Outline
    25:30 Entities and Animation
    29:38 Transparency
    #coderspace #pygame #spritestacking

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

  • @redfloat5163
    @redfloat5163 Год назад +28

    This channel is so underrated

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

    You quickly gained my sub! Wow what a video! Kept me entertained, focused, it was clear cut. That was pure magic!

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

    Amazing stuff, i love sprite stacking graphics and i'm definitely gonna use this for a game! Your channel is a fantastic source for python game developers, keep it up!!

  • @AntonioLatronicoDeveloper
    @AntonioLatronicoDeveloper Год назад +9

    Really, really incredible tutorial! Keep up the awesome stuff!

  • @sg4644
    @sg4644 Год назад +16

    I've shared your videos with my computer graphics professor and he was impressed, especially dealing with niche topics like these. Great stuff, man. Keep it coming.

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

    This video is 🔥 heat🔥 keep up the great work

  • @Eric-ms7hc
    @Eric-ms7hc Год назад +1

    Dude, you are great! I am glad i just found your channel :)

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

    Thanks for the video. Nice 3D effect 👍and thanks for sharing the code 👌👍💪

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

    Incredible work. You are talented!

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

    Very Impressive! Good work

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

    hey, I just found this hidden gems, thanks for making this channel, keep it up !!!

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

    This is incredible, thanks for sharing

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

    omg this channel is so great, very helpful

  • @asenvelkov301
    @asenvelkov301 Год назад +6

    I'm literally studying Python Fundamentals, (and basic stuff) and I looked up alot of your videos, and I'm like: How much dedication and discipline does this man have to know and do all of this.
    Like you've also been in Hello World and to reach stuff like this must feel really nice. But sadly i barely understand most of the code, like when there are some 3D or Open GL stuff, is it really hardcore math and formulas behind the scenes, how are you not getting confused at some point, like how is all of this learned xd, anyway thanks for making these!

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

    You are amazing! Tnx man

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

    Man, this video is awesome!!!

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

    man you are my hero

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

    It looks very nice!!

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

    spasiba brat, siljna pomogaet

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

    This is an amazing technique to me, I find pseudo-3D to be something very interesting, reminds me of the hacks and techniques used for old 2.5d games like doom and duke nukem

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

    great video

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

    I have been have been learning and experimenting with Python and Pygame myself and these videos are great! I would like to suggest a video on 2D lighting and sprites with normal maps which is similiar in being a 2.5D kinda look. One place where i saw this was the application Sprite Lamp and i think it would be cool if you could implement in Python/Pygame. Thank you for the great videos/info.

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

    So Nice .

  • @user-lo2qv8wz8f
    @user-lo2qv8wz8f Год назад +3

    this video opens my dog eyes

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

    Super Amazingggggg

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

    Amazing!!!

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

    Really hot stuff man! But is there anyway to input enemy AI into the dancing kitty entity?

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

    oh serius its genius!

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

    This is cool AF but it'd be even cooler if there was a human voice

  • @vnkslv
    @vnkslv Год назад +10

    Very cool job, thank you! Author, do you think it's possible through PyGame (or another Python library) to make a game in the spirit of The Final Station and put it out for commercial use?

    • @CoderSpaceChannel
      @CoderSpaceChannel  Год назад +6

      yes Pygame is quite suitable for such 2d games

    • @Gawain-hi5pd
      @Gawain-hi5pd 11 месяцев назад

      why do so many people say pygame is bad for creating games

  • @2spooky2play66
    @2spooky2play66 Год назад

    I really like this video, but I wish you went over collision. this video is really cool regardless!

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

    Cool!

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

    Super

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

    damn i wantt to go back to python now

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

    That looks incredible, but I can definitely see myself getting a headache after half an hour.

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

    i don't understand python at all, in fact my first programming language is java, and now i am a flutter enthusiast. I dont prefer dynamic lang, confusing to me, really hard to read, what this function return, what data type you get from this variable, what about null safety, ..etc. BUT, i love the math and logic behind your vid. is amazing. i will rewrite it in dart for sure. in the end syntax dont matter right? math always wins. thanks for the video, great work. keep it up

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

    This game is insane. Looks like pokemon in gameboy

  • @grzegorzkozinski2308
    @grzegorzkozinski2308 Год назад +4

    First of all, great work! I had no idea there is so many different ways of making 2D games pretend to be 3D!
    Second: Are there some commercially available games using this Sprite Stacking method?

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

      marketplace.yoyogames.com/assets/7494/lucid-engine-pseudo-3d

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

      @@CoderSpaceChannel thanks, but how about real games made in this way, that we can play, on Steam or any other platform, are there any?

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

      @@grzegorzkozinski2308 I have not researched the market, I am interested in the technology itself and the resulting graphic effect. But there certainly are such games.

  • @yajneshskandhan2756
    @yajneshskandhan2756 Год назад +3

    nice vid bro, you are a genius,
    can you do a video about 3d procedural generation using opengl and noise

    • @CoderSpaceChannel
      @CoderSpaceChannel  Год назад +3

      Yes, I was planning to make a video about it in the future.

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

    How would one go about animating spritestacks? Implementing magicavoxel animations to things such as trees and maybe player and entities.

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

    Amazing, I love it when a new vid comes out.
    One question: how... How could I add shadows?
    I had the thought of baking a dark alpha texture to the bottom image and depending on if there was anything above setting the alpha. However, this means that the light appears to always be above it and so:
    I was wondering if there was a way to have some sort of source lighting effect?

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

      The most straightforward approach is to draw a shadow as the bottom layer for each sprite. Then the shadow will rotate at the same time as the world

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

      @@CoderSpaceChannel yeah, that's what I thought about, but I was wondering if there was a way that it could be projected out at all in real time?

    • @CoderSpaceChannel
      @CoderSpaceChannel  Год назад +3

      @@icotwilight Then for this it is better to use GPU acceleration, for example, the Pyglet or Arcade module

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

    As a beginner coder, with rusty math skills, I'm struggling to understand the logic of this code (couple of my vars named different but same logic):
    discrete_angle = -math.degrees(self.player.angle) // self.viewing_angle + self.rot
    self.angle_key = int(discrete_angle % NUM_ANGLES)
    ...What I don't get is why the negative in the math.degrees conversion? After some laborious study I can only think of the different signs put in front of the mod operator. if discrete_angle is increasing from zero, the angle_key increases from zero; OTOH if discrete_angle is decreasing from 0 (increasing in negative direction), then angle_key starts at 0, jumps to the last element (NUM_ANGLES - 1) then decreases from there (NUM_ANGLES - 2, ...). What I'm struggling with is coding this logic and how it translates to the screen.
    Wrapping my head around angles in pygame is a little frustrating ngl!
    Also I note that python truncates the int operation toward negative infinity; does this have something to do with the logic? For example, at a small angle, 0.0165 rads, using the negative is the difference between outputting 0 and outputting -1. Anyways, thanks if OP or anybody can assist this rusty brain of mine.

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

    Can you make an tutorial for an Racing game with AI racers, cop chases and an campaign aka career?

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

    It's so cool. Can I know your PC specifications?

  • @Hassan-Sabah
    @Hassan-Sabah Год назад

    I like you

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

    When I ran the code at 6:38, I got the error "TypeError: can't multiply sequence by non-int of type 'pygame.math.Vector2'". Can anyone help because I followed the tutorial very closely, I don't think I'm missing anything and, I've wasted a good amount of time now.

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

    how to get y_offset for everry sprite?

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

    hi, thank you.. btw how pygame those days i heard its no longer support or something

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

      Pygame is fine. Although another development branch appeared - Pygame-CE

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

    Would it perform better if the sprite rendering part was written in python opengl? Then I guess there would be no need to use caching

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

      yes it will be better, but then you will have to abandon all the functionality of Pygame, except for Opengl initialization, keyboard event handling and sound

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

    Hey, how would I save the sprites to the disk?

  • @user-ni7sp1cp2b
    @user-ni7sp1cp2b Год назад

    Hey Coder Space! How can i texture the floor in ray casting? i very need that.

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

      you can use the technique from mode 7 video but you need to find the correct formula to calculate the FOV

    • @user-ni7sp1cp2b
      @user-ni7sp1cp2b Год назад

      @@CoderSpaceChannel thanks coder space

  • @artistic.autist
    @artistic.autist Год назад +2

    Loved this Tutorial ! Followed & Added quite a bit: ruclips.net/video/GvqRD7GCnQQ/видео.html
    Modified the code & then extended it - first *caching* (needed), multi-channel audio with f/x , collisions w/animations triggered on target, interactions & other action triggers, other action/adv type game logic. Thanks so much for posting your excellent work "Coder Space"!

  • @user-dc9zo7ek5j
    @user-dc9zo7ek5j Год назад +1

    Question, is diablo 2 made the same way?

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

    May I follow this tutorial for my commercial use game?

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

    What's the IDE name