How to Code Button Controls for the Sega Genesis & Mega Drive - Beginners Dev Tutorials

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

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

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

    UPDATE: Please note that SGDK has been updated since this video was created. If you are using a version of SGDK newer than 1.7, then please write "SPR_init();" instead of "SPR_init(0, 0, 0);" and it should compile fine :)

  • @PigsysRetroGameDevTutorials
    @PigsysRetroGameDevTutorials  2 года назад +11

    Another big tutorial today with lots to digest! I've caught up with the tutorial schedule I set at the beginning now, so it will be back to once every two weeks again after today.
    RUclips took a long time to approve this for some reason, so it's now late here and time for bed :)
    Enjoy!

  • @amerikaOnFire
    @amerikaOnFire 2 года назад +4

    Man, this was so good. I really appreciate you doing all of this. These videos will help people for so many years to come in regards to keep new games being made for these wonderful old systems. I do wish there was a similar SDK/effort for the SNES as it was my childhood favorite. But, as an adult, I've grown to love the Gen/MD so much and what it is capable of is just nuts in the right hands.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      SGDK is a pretty mature development kit at this point, so there shouldn't be any major changes, meaning that these tutorials will (hopefully) continue to be useful for years to come. Maybe we'll get a similar thing for the SNES one day

  • @lancelnce
    @lancelnce 2 года назад +4

    I'll save all these tutorials for later, great work.

  • @rustymixer2886
    @rustymixer2886 2 года назад +3

    Awesome info for future Doom Genesis makers 😆

  • @ThatOldTV
    @ThatOldTV 2 года назад +1

    I haven't had the opportunity to try out this tutorial. I work at a University and classes have started. However, hopefully I get to try later this week.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      No need to rush, take your time. The next one won't be for another two weeks and it will be a pretty small one (this one took a lot of effort to make in comparison)

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

    Just want to let you know that I'm really digging the tutorial and so far things are going very well for me. Thanks again! I look forward to each lesson. T

  • @aphoticknight
    @aphoticknight 18 дней назад

    For anyone that's curious about assigning an emulator for these projects:
    In "Visual Studio Code," navigate to your "Extensions," then to the "Genesis Code" extension. Click the gear that says "Manage," and choose "Extension Settings." Once there, find the "Gens: Path" setting that says "Set the Gens Emulator command path" and use this section to designate your chosen emulator's file path.
    In Windows 10, you can right-click your preferred emulator's executable file and choose "Copy as path" then paste it into the "Gens: Path" setting's text field box. Delete the quotes around the file path you've just pasted and test a "Compile and Run" to make sure Genesis Code starts running the emulator you want. This is how I got Visual Studio Code/Genesis Code to use my preferred emulator.
    Hope this helps anyone struggling.

  • @di4352
    @di4352 2 года назад +2

    Wow Pigsy, another tutorial out already? Way to go man. I just finished the previous one can't wait to learn more.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      The next one won't be for another couple of weeks, so take your time with this one, it's a big one.

  • @Genesis814
    @Genesis814 2 года назад +3

    Great, Pigsy. Thank you so much for your videos.

  • @DougLopes
    @DougLopes 2 года назад +3

    That was really helpfull! Great explanation.

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

    I hope you make more videos on this stuff it's awesome . Also make one about collision detection if you can

  • @brunch1572
    @brunch1572 2 года назад +1

    Just fantastic man. You deserve way more views, I don't get it. I'm looking forward to the eventual lesson on collision, but whatever order you teach things is fine with me. Keep up the good work!

  • @ThatOldTV
    @ThatOldTV 2 года назад +3

    Thanks!

  • @GreyMatterShades
    @GreyMatterShades 2 года назад +1

    Another great lesson. I'm curious about a couple things:
    If you wanted to have different attacks with different timings, would you just enter code into each attack to change the value of "attack_duration" to the appropriate value for that attack when it's initiated?
    Also, how would you make pressing buttons during certain timing windows (like during an attack) have unique results, like starting a different attack after the current attack animation (say for making a single button combo in a beat-em-up)? Here's my best guess:
    - Make some sort of variable like combo_attack_number set to 0
    - Make another variable (boolean?), something like trigger_next_attack set to FALSE
    - Make functions for each attack in the combo including: set trigger_next_attack to FALSE, set the appropriate value for attack_duration, play the attack animation,
    and increment combo_attack_number up by 1
    - Add an "if" statement to the attack button code so that if attack_timer == 0, it triggers the first attack
    - Add an "else if" statement to the attack button code that would set trigger_next_attack to TRUE
    - Add an "else if" statement to attack_function so that when attack_timer == attack duration, it checks whether trigger_next_attack == TRUE and if it does, reset attack_timer, and trigger
    the appropriate attack based on the combo_attack_number(?)
    - Update the "else" statement in "attack_function" to also reset combo_attack_number to 0 (so that if trigger_next_attack == FALSE at the end of any attack, it would reset the combo)
    Is this anywhere close to correct? Sorry if it's hard to follow. I'm not quite up to the point where I could write proper code or even pseudo code.
    Keep up the awesome work! Can't wait to see more of this stuff. I hope you go all the way up to really advanced lessons!

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      I think you're on the right track with timers to track when buttons are pressed. Give it a try - don't worry, it won't make your console explode! Failure can even be fun when it produces unexpected effects. Eventually I'll do more complex control lessons. Have fun!

    • @GreyMatterShades
      @GreyMatterShades 2 года назад

      @@PigsysRetroGameDevTutorials I'm definitely going to give it a shot, but I just started actually working my way through the tutorials (before I'd just been watching along). It's going well so far, and I should be at a place where I could try it out soon. I'll let you know if it works, or harass you for help if it doesn't 😉
      Thanks for the reply!

  • @igodreamer7096
    @igodreamer7096 2 года назад +3

    Awesome!

  • @miguelgonzalezmonje1432
    @miguelgonzalezmonje1432 2 года назад

    Extraordinary work! Do you will continue with this kind of tutorials for complete a stage of a game? Thank you

  • @ThatOldTV
    @ThatOldTV 2 года назад +2

    OMGosh! I hated this lesson. I made a number of mistakes; case sensitive and spelling. It took me forever to figure it out. I capitalized the "S"in static and typed "change" instead of "changed". So, nothing was working. For a second, I was jumping for joy!!! I thought you were going to teach us a charge attack when you were showing us the Mystic Defender clip. It was only a trick :)! How does one hold a direction plus a button to execute an animation/Move? For example: Hold up and hit the fire button. And for the music tutorial; I'm sure you'll show us how to play a track, followed by another track back to back but... How does one disrupt a playing VGM music with another VGM file? For example:VGM Music is playing, one picks up a power-up, a jingle plays (another VGM file), and then it returns to the music.

    • @GreyMatterShades
      @GreyMatterShades 2 года назад +1

      I'm also interested in how to make combinations of buttons/d-pad inputs make unique moves (like holding Up and hitting a button).
      There are probably multiple ways to handle these sorts of things. If I had to guess (and I do because I don't currently have a project going), I'd think you'd use && to check if both the d-pad direction was being held and the button was pressed, and trigger the different move/animation if they are.
      Curious to see what the actual answer is to your question.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      Haha, that's why I decided to not edit out that bit where I did the typos writing out the code in the middle of the video - as a warning to others! Luckily I caught it pretty much right away, but it can cause issues when you don't notice. Glad you worked through it.
      Looking at my old GG Shinobi code where I had to do the control where the pnk ninja clings to the ceiling when you press up and jump at the same time it looks like I did this:
      if ( (value & BUTTON_C) && (value & BUTTON_UP) && currentShinobi == PINK_SHINOBI )
      Hope that gives you an idea. I'll do more complex control lessons at some point in the future.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад +1

      @@GreyMatterShades See the answer I just gave to That Old TV

  • @samaeldrakul4191
    @samaeldrakul4191 2 года назад +3

    huzzah! 😁😁

  • @RetroRic79
    @RetroRic79 7 месяцев назад

    Hi Pigsy, Great tutorial series matey. Been following along nicely and really enjoying it.
    Quick question if you can answer? Is there a simple way to set the animation speed for each animation instead of the global speed in the resources file? Currently the only way I can work around this is to add duplicate frames for animations that I want to be slower than others. There must be a more elegant way to make single frames hold for a specific number of screen updates?
    Also, I'm a member of the RGDS Podcast (www.youtube.com/@RGDSPodcast-qw6mw/videos), and am planning to do an episode on the Mega Drive homebrew scene, wondered if you'd be interested in coming on for a short interview about your projects and the scene in general?
    Cheers dude

  • @AVS-xk3lc
    @AVS-xk3lc Год назад

    How do you create a jump button without it wanting to fight with the attack function?

  • @Tiptup300
    @Tiptup300 2 года назад +1

    Please push on more good programming practices like separate concerns or SRP.
    Put the input logic in a separate class so the whole games isn't just in one giant file.
    Like Player.c or PlayerInput.cs, depending on how granular you want to go.

    • @Tiptup300
      @Tiptup300 2 года назад

      Also think it would be great if you shared GitHub repositories of each of these lessons.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад +1

      I'm keeping things as simple as possible to begin with

    • @Tiptup300
      @Tiptup300 2 года назад

      @@PigsysRetroGameDevTutorials
      That makes sense, thank you for the reply

  • @The-E-Base
    @The-E-Base Год назад

    For some reason, none of the input scripts I tried worked... they did nothing.

  • @Don_Miguel
    @Don_Miguel 2 года назад

    Errrr... u could use a single joyEvent func for everything.

    • @PigsysRetroGameDevTutorials
      @PigsysRetroGameDevTutorials  2 года назад

      There are ways you can get everything working within a single control function and I did do it, but apparently there is a good reason why it was split like this in SGDK so I don't want to mess with it

    • @Don_Miguel
      @Don_Miguel 2 года назад

      @@PigsysRetroGameDevTutorials right 😇