♟️ Chess Special Moves – Castling & Promotion – 2/3 [Unity tutorial 2021][C#]

We use the code structure made last episode to process chess special moves in order to create a Castling mechanic, and a promotion mechanic on both the king and the pawn

Link to the Chess Assets, by my friend Z3nder (affiliate) :

– – – – –
0:00 Preview
1:24 Pre Castling
12:28 Post Castling
19:18 Pre Promotion
23:00 Post Promotion
29:32 Test
– – – – –

►♟️ Learn how to make a Online Multiplayer Chess Game (on Youtube!)

► ⚔️ FREE Top Down RPG Course (on Youtube!):

► Develop a FULL Mobile Game with the help of my Udemy Course :

► Want to help the EpitomeGames project? You can show your support with an membership!

► Want the files? You can find everything on the website!
► Need help? Join our discord community!

Discord 👊
Website 📡
Email me! 📧 [email protected]

Personal channel 🇨🇦

Social Media 🤳

#multiplayer #gameDev #unity #unityTutorial #n3k #epitome


  1. One could combine black and white into the same checks and simplifying avoid all the team checks by saving the resulting Y value at the top.

    int ourY = (team == 0) ? 0 : 7;

    Then we can do these things:
    Vector2Int[] kingMove = moveList.Find(m => m[0].x == 4 && m[0].y == ourY);
    board[3, ourY] == null && board[2, ourY] == null && board[1, ourY] == null)

  2. was castling though check mate covered at all i been through a couple times did i miss it?

  3. did not work for me. Movelist does not seem to work

  4. I want to point out three things:

    1. you cannot castle, if the king cannot safely travel to the target position. This means, if any enemy piece attacks any tile the king must travel (including starting and end position) he simply cannot castle

    2. To get the starting position right, just remember, that the white queen must be placed on a white tile. The same is true for the black queen.

    3. Thank you for taking the time to make these videos. They really help me out a lot. Thank you

  5. Hey, I'm loving the content you're putting out for free. You're clear and explain what and why you're doing the things you do, making it very easy to follow and learn.

    I do have a question, though. You mentioned that you don't use explicit types usually, and I was curious as to why? Is it preference, performance, or just something else?

    Cheers, and thanks again for creating amazing videos!

  6. actually there's a reason to under promote to a knight maybe if you promote to queen it will be stalemate draw

  7. Great video, i followed the tutorials until 3/3 and checked real quick the part 4 but i cant find where you make promotion instead of queening. Have you made it?

  8. Mamamia😫 🤌🤌! That's some spaghetti code! Ight g I gotcha. Here is the special move function on roids:

    public override SpecialMoves GetSpecialMoves(ref ChessPiece[,] board, ref List<Vector2Int[]> moveList, ref List<Vector2Int> availableMoves)


        SpecialMoves r = SpecialMoves.None;

        int row = (team == 1) ? 0 : 7;

        if (currentX == 4 && moveList.Find(m => m[0].x == 4 && m[0].y == row) == null) 


            Vector2Int[] leftRookMove = moveList.Find(m => m[0].x == 0 && m[0].y == row);

            Vector2Int[] rightRookMove = moveList.Find(m => m[0].x == 7 && m[0].y == row);

            if (leftRookMove == null && board[0, row].type == ChessPieceType.Rook && board[0, row].team == team && board[3, row] == null && board[2, row] == null)


                availableMoves.Add(new Vector2Int(2, row));

                r = SpecialMoves.Castling;


            else if (rightRookMove == null && board[7, row].type == ChessPieceType.Rook && board[7, row].team == team && board[5, row] == null && board[6, row] == null)


                availableMoves.Add(new Vector2Int(6, row));

                r = SpecialMoves.Castling;



        return r;


Leave a Reply

Your email address will not be published.