Partially Functioning Chess! (Wiki for jjnitzan)

The maker of this topic would like to say that the words “my”, “I”, or “me” refer to @jjnitzan, NOT @vqnillaxx.

This will be updated once I stop being lazy and rebuild the block code guide since that had some massive changes.

To be clear, no codes shown within this Wiki work, and this Wiki is only to be edited by jjnitzan unless given explicit permission.

This is a work in progress, but is currently at the highest level of gimkit mechanics in my opinion, so it’s a good post to learn from.

The Board Itself

Source: Making a Chess Board by @NightEnd

  • First start of by making a 8 by 8 grid of light and dark colored tiles (2x2 floors) in a checkered pattern. The top left and bottom right tiles should be light, bottom left and top right dark.
  • Next create a text object and set the text size to 112, and the font to Rubik. Set the text to; A B C D E F G H, and make sure it’s on global.
  • Create another text object and set the text size to 112, and the font to Rubik.
    Text;
    8
    7
    6
    5
    4
    3
    2
    1

Picture of A-H and 1-9 (They should be centered with the tiles).


Dynamic Text

Sadly, due to the inability to create newlines with block code, we need 8 text object instead of 1 here.

  • Create a text object and center it along the bottom row of your board.
  • Set the text size to 102 and the font to Rubik
  • Add the block; When receiving on channel UpdateText.
  • Add the following code to the block.
  • Copy and paste the text object into each row. Make sure to go to the block code of each object and change the row number depending on the row the text is in.

Checkable Inputs (Part 1)

Warning: This part is EXTREMELY annoying to do, mainly due to needing to copy and paste so many buttons and counters.

  • Create a button. Change the button to be invisible to players and set the activation scope to players. Also make the button take no time to press.
    Screenshot 2024-02-15 111117
  • Set the button message and the transmit channel onto the square it’s on (A1, B1, etc.)
  • Set the activation and deactivation to P_[Square] (Activation), E_[Square] (Deactivation)
  • Copy and paste the button onto each of the 64 squares, and change the settings for each based on the square it’s on (same rules as above)

Counter setup:
Place a counter on each square with the following rules.

  • The starting value is 10/20/30/40/50/60/70/80 (Based on what coord A-H) + 0/1/2/3/4/5/6/7 (Based on coord 1-8). So each starting value looks like; A1 = 10, A2 = 11, B1 = 20, B2 = 21, etc.
  • The counter should NOT be visible in game, and have a scope of global.
  • The counter should update the property CurrentSelected, and not have a target.
  • For each counter, it should reset when it receives on the corresponding square (Counter on A1 resets when it recieves A1 for example)

There needs to be a counter on each square with the settings changed based on the corresponding square.


At this point

Congratulations, you have finished the first 5% or less of this guide/wiki! It only gets more complicated from here, but it’ll be worth it in the end :slight_smile: (hopefully).
Anyway, this is what your board should look like:


Properties

Each of the following properties should be global unless specifically stated otherwise, and should have a default of blank unless stated otherwise in the form of [Property Name] (Default Value).
- Text Properties
- Row1
- Row2
- Row3
- Row4
- Row5
- Row6
- Row7
- Row8
- Board
- Rw (♖)
- Nw (♘)
- Bw (♗)
- Kw (♔)
- Qw (♕)
- Pw (♙)
- Rb (♜)
- Nb (♞)
- Bb (♝)
- Kb (♚)
- Qb (♛)
- Pb (:chess_pawn:)
- Ee
- Spacer
- PieceTo
- OverlayPieceSelected (None)
- PieceTaken
- PieceLetterOn
- PieceLetterTo

- Number Properties
- UpdateBoardCounter
- Turn
- ButtonLoop
- CurrentSelected (-1) (Broadcasts on PieceSelected when value changes)
- BoardPieceTo
- BoardPieceOn
- MoveCheckRecursion (0)


Teams

You now have a choice to make. Do you want this to be one player, or two?

  • Note that I’ll merge these 2 eventually into the player choosing, but I’d recommend 2 player for now, since the AI will take me the longest.
  • Set up 2 number properties with a default of 0

    • Teams (Global)
    • TeamOn (Local)
      Screenshot 2024-02-15 114123
  • If you want, you can have a pregame spawner (which would be wherever your lobby would be. This is optional.)

  • Add a spawn pad that you spawn on when you start the game, and place a trigger wherever you’d like.
    Screenshot 2024-02-15 114315

  • The trigger is hidden and will be activated when it receives on GameStart:

This utilizes (sort-of) psuedo-teams, and we all know if it’s complex or uses quantum mechanics for gimkit, it’s going to be great :slight_smile:! Best of all, this uses both!

Anyway, back to the guide.


Updating the Board Dynamically

Here is where this starts to get complicated. If you had trouble with the previous steps, then reach out to me or @Blackhole927 (who’s also really good at this), and either one of us can help (though it’s @Blackhole927’s choice if they want to help).

Anyway, I’ll explain better in this section due to this being difficult (at least it will once this wiki/guide is finished, not necessarily now).
We created the global number property called UpdateBoardCounter if you remember. The purpose of this property is to loop through updating the board, setting a trackable limit and counter in recursion.

  • Add a lifecycle. Set it so it broadcasts the channel StartGame when the game begins.

  • Create a trigger and make it invisible in game.

  • Set it so it triggers when receiving the channel StartGame.

  • Add a when triggered block with the following block code.

The block code should be the following for this trigger:
Spacer=1 space
Ee=3 spaces
Board=RwNwBwQwKwBwNwRwPwPwPwPwPwPwPwPwEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEePbPbPbPbPbPbPbPbRbNbBbQbKbBbNbRb

  • Create another trigger that triggers when it receives on UpdateBoard1. Give it a when triggered block and put the following block-code in.
    The long text shown is: AABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHH

  • Copy and paste the trigger 8 times, changing the following:
    • The greater than or equals to by 16 more each time.
    • It triggers when it receives on UpdateBoard 1-8 (UpdateBoard1, UpdateBoard2, etc.)
    • Replace all Row property’s to the respective row number (Row1, Row2, etc.)
    • Change the 1 under broadcast on channel to the row number (1, 2, 3, etc.)
    • Change the UpdateBoard1 to UpdateBoard2 (Previous + 1) and UpdateBoard2 to UpdateBoard3 (Also previous + 1).

Now you have to change the 8th trigger!
The end of it should look like this:


What you have

Congrats! You now have a dynamic changeable board. You may have to mess around to get the text to line up perfectly in the center (I recommend the snap edit option), but you’ve actually done quite a bit.


Player Input Part 2

To begin, you need to make a new trigger. This trigger should trigger on the channel PieceSelected, and have the following block-code.

Now make an overlay with the following settings:

Make a when recieving on channel UpdateSelectedOverlay block for it.

Create another trigger that triggers when it recieves on EnableAllButtons.
Add a when triggered block to it.

The very long string is: ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH


Basic Move Algorithm

Create a new trigger that triggers when it receives on PieceMoved. Add a when triggered block.

Create a new trigger that runs on PieceMovedCheckTeam. Add a when triggered block.


Feedback via notifications

This is just basic feedback/reset for moves.
Make a setup that looks like this:
Screenshot 2024-02-29 122617

The wires always go from the counter to the trigger and notification, and triggers the trigger/sends the notification when the counter reaches the target value.

Both triggers have a target value of 1.

The counter on the left increments when it receives on MoveValid, and the one on the right when it recieves on MoveError.

MoveValid counter:

  • When target reached, broadcast on ResetCounterValid
  • Reset Counter when recieving on ResetCounterValid

MoveError counter:

  • When target reached, broadcast on ResetCounterError
  • Reset Counter when recieving on ResetCounterError

Notifcation (left side):

  • Title: Piece Moved
    If you go to all options, change the duration to 2 seconds and the type to a success.

Notifcation (right side):

  • Title: Invalid Move
    If you go to all options, change the duration to 2 seconds and the type to a error.

Trigger (left side):

Trigger (right side):


Pawn Movement Algorithm

Create a new trigger that triggers on PieceMovedCheckP1. Add a block to it.

Create a new trigger that triggers on PieceMovedCheckP2. Add a block to it.


Note that you can only move pawns right now successfully, due to the lack of rules for other pieces!

If you want to mess with the board, go to the StartGame trigger block-code and mess around with the string that the board gets set to.

Upcoming Sections:

  • Detecting Check (unknown timeline)

  • Detecting Checkmate (unknown timeline)

  • Creating the AI (probably a long time)

Current memory usage is 14%, will go to 21% (mostly block code) once updated.


Credit to @NightEnd for saving me some time in deciding on the board design.
Credit to @Blackhole927 for the emojis (who @NightEnd got them from).


I just want to say, always feel free to reach out to me for help!
Also, since this is a Wiki @vqnillaxx made for me (Thanks by the way @vqnillaxx).

Anyway, that’s all I have to say in this little guide/wiki of mine for now. If you have some cool idea that will work for this, reach out in the comments! This also took WAY too long to make.

Toodles! :slight_smile:

:sparkles:-- @jjnitzan:sparkles:

9 Likes

This is cool! Didn’t @getrithekd once try to make it?
Does this actually work tho?

1 Like

No idea who tried to make it lol. I know Blackhole is also working on chess right now.
This does in fact work (if you manage to read my little warnings and edits through it). I’ll have to repost the images to make it a bit easier but at this point I’ve been making this for the last 2 hours and have to actually get my schoolwork done.

What this actually does right now:

  • Creates the base chess board and system.
  • Allows dynamic updates of said board

I’m currently working on making moves work and making move rules.

5 Likes

I never tried to make it. Black hole is the one who’s currently making it.

5 Likes

I am concerned that I’m starting to lag in the editor while I’m only using 14% memory rn

3 Likes

I’m not currently making chess haha- I pushed it to the side to work on my secret project after I hit the property limit

3 Likes

Ahh, you’re old pfp through me off.

2 Likes

When did you hit the property limit?

2 Likes

When I was working on checkmate detection

1 Like

What do you mean?

1 Like

I see. What system did you try to use to detect checkmate?

You’re old pfp was chess, so I figured it was you because I vaguely remembered when I first joined that someone was making chess.

3 Likes

While I have ya’ll here rn, when does gimkit start to lag in creative? I hade to reload due to alt-tabbing too much, and now I’m lagging (I wasn’t before)

2 Likes

I don’t remember- I only ran into the property limit because I used 64 properties for board storage :skull:

3 Likes

Oh noes.
The other issue with that I see is that move and algorithm detection would be expensive. Like, really, really expensive. (rip the recursion)

2 Likes

Yeah, this is a HARD game to make. Especially because you have 64 spaces of the board. PROPERTY OVERLOAD. I literally tried to make it once; I ran out of properties, too. Then I deleted the map :sob:

2 Likes

Yeah, I think my main achievement here was doing it in 9

2 Likes

I used one for the entire board, then 8 for the row storage. This way I can check relative rows through math on the board, while doing the text through each row by looping 64 times (minimum lag)

2 Likes

I just checked, and my chess, with piece movement, capturing, movement rules, checks, etc is only 12%, so you should be fine. WAIT NO WRONG MPA

2 Likes

But I feel like I can find an easier way to do each side… There are 16 pieces for each side… 32 properties for each piece in my mind… 32 properties left… Then you have to do the tracking of movement… More properties… Maybe 5 for each type of piece on both sides… Don’t mind me… Then the movement… There’s like so much memory involved… A lot of triggers to check the property… Then something to store each space… Maybe you could use Pseudo-Properties with items…

1 Like