How to Code Chess in Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

ความคิดเห็น • 147

  • @the__jive
    @the__jive ปีที่แล้ว +27

    Thank you for the excellent tutorial! Your guidance has not only introduced me to new programming concepts but has also shown me how to break down complex game development tasks into smaller, manageable steps. You're amazing. Keep up the great work! ❤❤❤

    • @RyiSnow
      @RyiSnow  ปีที่แล้ว +3

      Thank you for the support! Glad to hear that my videos could help your learning :)

    • @javedsultan4830
      @javedsultan4830 ปีที่แล้ว

      @@RyiSnow
      are you using itellij idea?

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

    • @student9997
      @student9997 7 หลายเดือนก่อน

      bro i am not displaying the chess pieces,please help.I am at the first 26:00 of the video

    • @sushantkumar3111
      @sushantkumar3111 3 หลายเดือนก่อน

      can anyone share the code please

  • @64_bit_coding
    @64_bit_coding ปีที่แล้ว +59

    It's great how the projects are started from scratch and that you don't use any sort of engine or library. And it's also great that you show what everything does, for the beginners. Well done, and keep it up! :) 👍

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

    • @64_bit_coding
      @64_bit_coding 11 หลายเดือนก่อน

      @@nehdiekTap what error do you have?

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      @@64_bit_coding the pawn itself doesn't move diagonally when eats the pieces but it eats (disappear) it instead then you have to make another move more like it can only move vertically,

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      @@64_bit_coding can u help me bro

    • @64_bit_coding
      @64_bit_coding 11 หลายเดือนก่อน

      ​@@nehdiekTapcan you showe the code that you have for the pawn canMove method?

  • @OneLatteComingRightUp
    @OneLatteComingRightUp 10 หลายเดือนก่อน +9

    Hi ryisnow, You are probably my favourite youtuber and the most underrated, you have helped me in guiding my programming journey for java, I wish you the best time!!
    -Your #1 fan

    • @sushantkumar3111
      @sushantkumar3111 3 หลายเดือนก่อน

      can anyone share the code please i am facing error ,it will be very helpful

  • @awaririawa4238
    @awaririawa4238 ปีที่แล้ว +3

    Thank you for keeping the tutorials!

    • @RyiSnow
      @RyiSnow  ปีที่แล้ว +1

      My pleasure!

    • @student9997
      @student9997 7 หลายเดือนก่อน

      bro i am not displaying the chess pieces,please help.I am at the first 26:00 of the video

  • @current_goliath
    @current_goliath ปีที่แล้ว +3

    You've become one of the few youtubers whose uploads I will always click on when I see a new video on my feed. Your tutorials are awesome and really stand out to me, they're way easier to understand than quite a few other channels I've come across. It's always obvious you put a lot of time into planning and creating these videos.
    While I'm terrible at actually playing chess, learning about the logic behind the inner workings of how the game is created is too interesting of an opportunity to pass up. Thank you for sharing your knowledge!

    • @RyiSnow
      @RyiSnow  ปีที่แล้ว +1

      Thank you for the kind words. The editing took a while so receiving a comment like this makes me feel the effort was worth doing.

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @3bood_kr
    @3bood_kr 11 หลายเดือนก่อน +3

    It's nice to see you building java games again. Your 2d adventure game really helped me five months ago 🙂

    • @sushantkumar3111
      @sushantkumar3111 3 หลายเดือนก่อน

      can anyone share the code please i am facing error ,it will be very helpful

  • @RamdomOfInternet
    @RamdomOfInternet ปีที่แล้ว +4

    I've been following you for 1 month, and I can't believe that now there is a chess code :D, I'm really glad because I thought I'd stick with the Tetris tutorial hehehe

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

    • @user-g7y2v
      @user-g7y2v 3 หลายเดือนก่อน

      @@nehdiekTap if you cannot fix it the code wont work lol

  • @Poopc92914
    @Poopc92914 9 หลายเดือนก่อน +3

    Thank you so much for making these videos. I hope you'll continue making more. Again, thank you! ❤

    • @sushantkumar3111
      @sushantkumar3111 3 หลายเดือนก่อน

      can anyone share the code please i am facing error ,it will be very helpful

  • @Kazuboi
    @Kazuboi 5 หลายเดือนก่อน

    I've been following you ever since the 2D Adventure series! Followed through the Tetris one and now this! Thank you for sharing your knowledge in these videos! There's always something to learn.

  • @marcmailly8176
    @marcmailly8176 8 หลายเดือนก่อน +5

    For drawing the chess board, I propose this syntax, based on testing the (row + col) % 2 modulus and using Color.decode() method :
    public void draw(Graphics2D graphics2D){
    for (int row = 0; row < MAX_ROW; row++){
    for (int col = 0; col < MAX_COL; col++){
    if ((row + col) % 2 == 0){
    graphics2D.setColor(Color.decode("#FFFACD"));}
    else {
    graphics2D.setColor(Color.decode("#593E1A"));}
    graphics2D.fillRect(col * SQUARE_SIZE, row * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);}}}

    • @student9997
      @student9997 7 หลายเดือนก่อน +1

      bro i am not displaying the chess pieces,please help.I am at the first 26:00 of the video

    • @lazyGoliath
      @lazyGoliath 4 หลายเดือนก่อน

      @@student9997 i faced the same issue so I insted of using getResourceAsStream() method I used :
      image = ImageIO.read(new FileInputStream(imagePath));
      I presume that the reason of the prob is a difference in the IDE in use

  • @yaetrna9740
    @yaetrna9740 ปีที่แล้ว

    Thank you for this wonderful tutorial, I'm currently watching your Tetris-Video and I am really enjoying it at the moment. As a chess player myself I am very delighted to see this. Keep going!

    • @RyiSnow
      @RyiSnow  ปีที่แล้ว

      I also play chess from time to time although I'm not that good. Coding this kind of board game is pretty fun :)

  • @Headon2580
    @Headon2580 7 หลายเดือนก่อน +1

    Thank you so much for making these videos. I hope you'll continue making more.

    • @student9997
      @student9997 7 หลายเดือนก่อน +1

      bro for me it is not displaying the chess pieces,please help.I am at the first 26:00 of the video

    • @Headon2580
      @Headon2580 7 หลายเดือนก่อน +1

      @@student9997 bro check the gamepanel we will find the point😊

  • @Dara-p3i
    @Dara-p3i 2 หลายเดือนก่อน

    Keep it up bro. I really love how you explain every lines

  • @Hellohaveaniceday
    @Hellohaveaniceday 10 หลายเดือนก่อน

    you probably won't see this but I just subbed and have been watching your vids for quite while and I just picked up coding but i've learn't so much from your vids and you're my fav youtuber

    • @RyiSnow
      @RyiSnow  10 หลายเดือนก่อน

      Glad to hear that and thank you for the sub :)

  • @orangomango
    @orangomango ปีที่แล้ว

    Great video as always. I've been watching all your rpg series too and I always get more impressed, your work is amazing!

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

    • @orangomango
      @orangomango 11 หลายเดือนก่อน

      @@nehdiekTap You mean his chess code (I guess it's available on github)? because I have done one too.

  • @nefhrit
    @nefhrit 7 หลายเดือนก่อน

    Thank you for the Tutorial, I finished it within half of the day.

    • @Mb-ir2es
      @Mb-ir2es 6 หลายเดือนก่อน

      Hello can you please help me with the code in Pawn piece , i dont know why it doesnt work for me . I would be so greatful if u take some of your time to respond me

  • @KevinMogere-y4w
    @KevinMogere-y4w 10 หลายเดือนก่อน +1

    Stalemate or draw can happen with blocked pawns. Basically, it happens when the only option you have is to move the King but there is no safe place to move it apart from the box it is in.

    • @RyiSnow
      @RyiSnow  10 หลายเดือนก่อน

      Ah, you're right. I totally forgot those situations 😅😆

    • @llッ-v5b
      @llッ-v5b 8 หลายเดือนก่อน

      how do you fix that? Could you tell me the solution @@@

  • @stefanalexandruzica2160
    @stefanalexandruzica2160 3 หลายเดือนก่อน +1

    Stalemate happens when you have no legal moves left, but you also are not in check. That means that you can be in a stalemate situation where you have multiple PAWNS on the board that are blocked by the opponents pieces and your king has no legal moves left, but you are not in check, which would be a stalemate. Also when the 2 kings remain alone on the board it is a stalemate as well.

  • @asilbekabdurashidov5195
    @asilbekabdurashidov5195 ปีที่แล้ว

    great man keep going. you have the best tutorial playlist

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @xdgopenzip
    @xdgopenzip 8 หลายเดือนก่อน +1

    thank you so much for sharing your knowledge!

  • @godx5487
    @godx5487 26 วันที่ผ่านมา

    Sir 46:40 - it is showing the exception in thread(null pointer exception) when we move kings position further and not reseting it!... Can you help me sir?

  • @snapakattvevo
    @snapakattvevo 7 หลายเดือนก่อน +2

    can someone help ? im at 1:10:10 and when i click on any piece i get spam errors in console while running the project the project runs perfectly till i click any piece

    • @skibidigamingfromohio
      @skibidigamingfromohio 5 วันที่ผ่านมา

      I think you've already moved on but the most often occurence for me was when activeP isn't correctly updated, so when you click on a piece activeP is still null

  • @albertyork5835
    @albertyork5835 11 หลายเดือนก่อน

    Thank you very much for your video. It helped me to understand java a little bit better.

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @bestranjit2339
    @bestranjit2339 2 หลายเดือนก่อน +1

    I got some error in ur game if we try to check diagonally even if there is a pawn front of the king it would act as a check would u resolve this?

  • @Leon_TaB
    @Leon_TaB 16 วันที่ผ่านมา

    In the pawn section, when I use the pawn to capture a piece, the code does not update the pawn's position after the capture. I hope somebody or RyiSnow will take a look and help me with this issue soon.

  • @ianlulu
    @ianlulu ปีที่แล้ว

    As always, thank you for these tutorials!
    Im still wondering how you code these on your own. It wouldve taken me forever to figure this out

  • @iKiwo
    @iKiwo ปีที่แล้ว +1

    Bro creates another series of a 2D video game with new mechanics or another style ❤

  • @student9997
    @student9997 7 หลายเดือนก่อน +1

    bro for me it is not displaying the chess pieces,please help.I am at the first 26:00 of the video

    • @Mb-ir2es
      @Mb-ir2es 7 หลายเดือนก่อน +1

      Did you find out how its done . If yes please share it
      Have the same error

  • @sufiyan_asim
    @sufiyan_asim 6 หลายเดือนก่อน +1

    Great respect to you man not only u r giving tutorial how to build this game but u r actually defining how to and why are we implementing this or that logic including when and where with explanation, may ALLAH bless you brother. One request kindly upload ur tutorials and games (codes) on the github as well and also mention your email id to contact you like I was having issue in importing classes but I sorted it out because I ended up in wasting my 3 same tried useless projects and then again I started from the beginning and also basically all 3 times gpt 4o ruined my project. ❤❤❤

    • @nizamuddinkhan7408
      @nizamuddinkhan7408 5 หลายเดือนก่อน +1

      can you provide me the code i am getting few errors ! Thankyou!

    • @sufiyan_asim
      @sufiyan_asim 5 หลายเดือนก่อน

      @@nizamuddinkhan7408 yeah i guess

    • @sufiyan_asim
      @sufiyan_asim 5 หลายเดือนก่อน

      Which class's code you want

    • @احمدالنيال-ض6ج
      @احمدالنيال-ض6ج 15 วันที่ผ่านมา

      اشتي ربط حق الكود مقدرش اكتب

  • @nehdiekTap
    @nehdiekTap 11 หลายเดือนก่อน +2

    hello can you give me the code? i have an error i cannot fix it😭😭😭

  • @artsmit9545
    @artsmit9545 10 หลายเดือนก่อน

    7:13 what is double drawInterval =1000000000/FPS? And System.nenoTime(); and what is delta please explain more In detail

    • @RyiSnow
      @RyiSnow  10 หลายเดือนก่อน

      Check my game loop video for the details!
      th-cam.com/video/VpH33Uw-_0E/w-d-xo.html

  • @printlnPrints
    @printlnPrints ปีที่แล้ว

    the king is back

  • @1cakeYT
    @1cakeYT ปีที่แล้ว +1

    @ReiSnow ure best programer😚

  • @JRC.40.31
    @JRC.40.31 2 หลายเดือนก่อน

    thank you , for making this tutorial ...it taught me many things and i m thankful

  • @HABIBMUHD92
    @HABIBMUHD92 ปีที่แล้ว

    thank you as always!

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @sonnystoyanov1884
    @sonnystoyanov1884 11 หลายเดือนก่อน

    hey i've been folowing your rpg game tutorial but i ran into an issue with the collosions i typed the code exactly like you did in the tutorial but my character is able to move only on the left side and when he hits a tree or something it dont stop can you please help me fix the issue i'll be very thankfull

  • @fumano2679
    @fumano2679 5 หลายเดือนก่อน

    (row + col) % 2 == 1 to check if it is a white or black square

  • @thepublicviews
    @thepublicviews ปีที่แล้ว +1

    Hello rysnow, do you do c#?

  • @T1_Kewa
    @T1_Kewa 6 หลายเดือนก่อน

    Hello i am having touble loading the pieces the java project folder has a red exclamation mark i know it has something to do whith my bild path but am having trouble solving it i am useing eclipse

    • @nouamaneab2303
      @nouamaneab2303 3 หลายเดือนก่อน

      JUST PUT THE PIECE FOLDER DOWNLOWDED IN THE SIMPLECHESS FOLDER ON YOUR PC

  • @robtai8080
    @robtai8080 11 หลายเดือนก่อน

    great video! I love it. Can you make a retro game like space invader?

  • @islamictutorialzr4917
    @islamictutorialzr4917 5 หลายเดือนก่อน

    after 0.7 and 1 ? what is it? what is the sign called?

  • @irichx
    @irichx 11 หลายเดือนก่อน

    good job bro, weed a FAQ vid about you like your age and where you from and what you studied in university

  • @benezer5155
    @benezer5155 ปีที่แล้ว

    do u know where i can find documentation for making 2d games with java

  • @ricardoalvarez770
    @ricardoalvarez770 10 หลายเดือนก่อน

    Could you show how the entire GamePanel turned out? In the end, I get errors and I don't know where.

  • @aarushbasak4941
    @aarushbasak4941 ปีที่แล้ว

    when i go to draw the chess board its black no chess board shows up please help.

    • @64_bit_coding
      @64_bit_coding 11 หลายเดือนก่อน

      the image probably didn't load

  • @notbelial
    @notbelial ปีที่แล้ว

    I hope you'll notice this message. The game you created the 2D Adventure on part 1, my GamePanel gamePanel; is error, why? I followed all the steps

  • @artsmit9545
    @artsmit9545 9 หลายเดือนก่อน

    I have dought how the fps thing work I mean how it controll the frame rate because while loop not work with time?

  • @Hiraichi
    @Hiraichi 9 หลายเดือนก่อน

    No joke, i literally start a project for chess and i have just putting trash on a fire pit, thanks a lot

  • @youyoujimWithoutV
    @youyoujimWithoutV 11 หลายเดือนก่อน +1

    Hello RyiSnow, you should make a 3D isometric game !

  • @apro8723
    @apro8723 ปีที่แล้ว

    hey, RyiSnow i neeed help with the 2D game. I keep having glitches on the screen..... I commented here because you don't execpt comments on other games anymore. (they are black glitches which means that the tiles are not moving right anymore. they started when I made the first object in the game.

  • @artsmit9545
    @artsmit9545 9 หลายเดือนก่อน

    By the way, what is possible career options in java?

  • @Stormix-080
    @Stormix-080 ปีที่แล้ว +1

    Nice video

  • @tranucaiphat2178
    @tranucaiphat2178 9 หลายเดือนก่อน

    Hi RyiSnow, I have some MP3 files and I'm trying to convert all of them to WAV. I'm not sure if I should use MP3 files or not. Can you give me some advice? 😊

    • @RyiSnow
      @RyiSnow  9 หลายเดือนก่อน +1

      Either way works but default Java classes don't support MP3 so if you want to use MP3 files, you'll need to add some libraries such as javazoom.

  • @giuliozen5663
    @giuliozen5663 8 หลายเดือนก่อน

    Hi, i tried to ricreate the game followng your tutorial, but i think somethig went wrong with my code , because pawn doesn't go diagonally after capturig a piece and without changing turn after diagonally capturing. Then pieces can be captured allora in simulate mode. Coud I send you my code, in order to understand what's worn with my code? Otherwise could you give us the source code?😊

    • @Mb-ir2es
      @Mb-ir2es 7 หลายเดือนก่อน

      Hello , can you please tell me how did you put the images becouse for me it keeps giving exepctiond and I did it all like in the tutorial . Thank you

  • @blackbasha3
    @blackbasha3 6 หลายเดือนก่อน

    hey hope your doing well, can you make a card fighting game? i tried so hard to find one but couldnt find any on java

    • @RyiSnow
      @RyiSnow  6 หลายเดือนก่อน +2

      Sorry I've been pretty busy at work and have no time to make videos atm 🥲

  • @krishprajapati5900
    @krishprajapati5900 ปีที่แล้ว

    the videos are woww thxxxxx

  • @melkor1177
    @melkor1177 8 หลายเดือนก่อน

    Can we get more android games also

  • @robtai6225
    @robtai6225 11 หลายเดือนก่อน

    awesome tutorial. can you make more 2d platformer game, like megaman?

  • @JilSharma
    @JilSharma 4 หลายเดือนก่อน

    thank you

  • @Merkuse
    @Merkuse 9 หลายเดือนก่อน

    This is cool.

  • @darkpaladin.
    @darkpaladin. ปีที่แล้ว

    Nice video man but I don't know how to play chess but I definitively would be nice for creating checkers

  • @tomlev1592
    @tomlev1592 11 หลายเดือนก่อน

    first , fire tutorial thank you man . really!.
    second I want to change the black pieces to be played by AI by creating a function that analyzed the board then returns the best move.
    can you upload a video or reply to me somehow , on how can I .
    thanks :)

  • @PixelVearn
    @PixelVearn ปีที่แล้ว

    Greatt job

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @samg5183
    @samg5183 ปีที่แล้ว

    thank you so much!! maybe 2d platformer soon??

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

  • @hpforthewin469
    @hpforthewin469 11 หลายเดือนก่อน

    3:57

  • @sertansensei
    @sertansensei 7 หลายเดือนก่อน

    the thicc japanese accent really makes me feel welcome 😂❤

  • @saschapolaschek4347
    @saschapolaschek4347 ปีที่แล้ว

    Long time no see.

  • @thornadotrigger3073
    @thornadotrigger3073 9 หลายเดือนก่อน

    Hi ryisnow can you create a game called Checkers most people know English Drafts .👍

  • @retrovoid75
    @retrovoid75 4 หลายเดือนก่อน

    There is no tutorial in java on this but make a tutorial video on The Oregon Trail

  • @HungamTuan-du6bv
    @HungamTuan-du6bv 7 หลายเดือนก่อน

    how to make two player

  • @SumaParveen-s4i
    @SumaParveen-s4i 3 หลายเดือนก่อน

    Wilkinson Forges

  • @MichaelLlanos-z6s
    @MichaelLlanos-z6s 3 หลายเดือนก่อน

    Turner Freeway

  • @ArtemAndreew-j6p
    @ArtemAndreew-j6p 2 หลายเดือนก่อน

    Can you code a football game?

  • @BinaryDuo
    @BinaryDuo ปีที่แล้ว +3

    I would code if i knew how to play chess xd

  • @DanielRuff-n9x
    @DanielRuff-n9x 3 หลายเดือนก่อน

    Reynolds Union

  • @DuncanHelen-k3b
    @DuncanHelen-k3b 3 หลายเดือนก่อน

    Rowe Neck

  • @matchey1300
    @matchey1300 11 หลายเดือนก่อน

    similar to how i made it a long time ago

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      bro can you give me the code? i have an error i cannot fix

    • @matchey1300
      @matchey1300 11 หลายเดือนก่อน

      @@nehdiekTap whats the error? for the code in this video or the (bad) code that i made 9 months ago. if its for this video then i might not be able to solve it but tell me anyway and if its for my own code then i definitely wont be able to solve it but tell me anyway 😭

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      @@matchey1300 the pawn itself doesn't move diagonally when eats the pieces but it eats (disappear) it instead then you have to make another move more like it can only move vertically,

    • @matchey1300
      @matchey1300 11 หลายเดือนก่อน

      @@nehdiekTap interesting, did you follow the tutorial completely to the end? it might be a problem with the legal move generation or not including a line of code to switch turns when taking

    • @nehdiekTap
      @nehdiekTap 11 หลายเดือนก่อน

      @@matchey1300 yes but I can't find my error

  • @Adilraytrends
    @Adilraytrends 8 หลายเดือนก่อน

    #chessconstructor #chess

  • @StephenDouglass-f5j
    @StephenDouglass-f5j 3 หลายเดือนก่อน

    Boehm Pass

  • @tunguyenhoang8579
    @tunguyenhoang8579 3 หลายเดือนก่อน

    this sucks. lack features, bad oop habit, poor optimizing, almost no possible quick fix for improvements unless total revamp

    • @sirmad2222
      @sirmad2222 2 หลายเดือนก่อน

      Tell us a better code then

  • @sepehrbaher8413
    @sepehrbaher8413 2 หลายเดือนก่อน

    Exception in thread "main" java.lang.IllegalArgumentException: input == null!
    at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1356)
    at SimpleChess/piece.Piece.getImage(Piece.java:35)
    at SimpleChess/piece.Pawn.(Pawn.java:10)
    at SimpleChess/main.GamePanel.setPieces(GamePanel.java:54)
    at SimpleChess/main.GamePanel.(GamePanel.java:43)
    at SimpleChess/main.Main.main(Main.java:14)
    Excuse me can sombody help me with this error?!plzzz

    • @shikhargangwar6006
      @shikhargangwar6006 20 วันที่ผ่านมา

      in the piece class getImage method.... use this
      image = ImageIO.read(getClass().getClassLoader().getResourceAsStream(imagePath));

    • @sepehrbaher8413
      @sepehrbaher8413 20 วันที่ผ่านมา

      Thanks man I fixed that now I have problem of the logic of the game Check and check mate and enpassante and how pawn capture and promotion… gosh it’s too much