Implementation of popular game at Unity programming environment. The project aims to familiarize one with the Unity environment and to teach one the simple communication between PLC and C# program.
-
Unity Assets:
-
Font:
-
PLC communication .cs file:
-
Noises:
It's work at thin-client architecture. State of game, rules, etc. are implemented and stored in PC. At this moment possible is sending data of disposition. Every square of the chessboard have unique number (It's shown below). After chessman's move update of chessboard array is send to PLC (DB1).
Squares of the chessboard with unique numbers | Fragment of Array of chessmans at PLC |
---|---|
For example:
white knight at B1 ≙ 16#44 at DB1.Chessman[8]
squere B1 ≀column №1, row №0 → 1*8+0=8≀ ≙ 8th position at array
4416=6810=410+6410 ≀4≙KNIGHT, 64≙White≀
public enum Color
{
Black = 0,
White = 64
}
public enum ChessmanType
{
EMPTY = 0,
PAWN = 1,
ROOK = 2,
KNIGHT = 4,
BISHOP = 8,
QUEEN = 16,
KING = 32,
}
PLC program is implemented in SCL. Data of chessman are Chessboard could be rotated, depended on actual player turn. In case of rotate of chessboard the list of chessmans is reversed, letters and numbers on board are replaced with an other ones. LastClicked tag is periodically checking by C# app in time of waiting on PLC-game-player move. After read new value of LastClicked tag (after HMI click) it's set on default value, from outside <0; 63> interval.
In the course of implementation.
moving chessmansen passant to add
turn-based game systemcounterpart at PLC- communication with PLC