Skip to content

Implementation of popular game at Unity programming environment. (project in progress)

License

Notifications You must be signed in to change notification settings

ArBom/UnityChessPLC

Repository files navigation

UnityChessPLC

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.

View of scene

View of pawn's promotion win

Used packages and files source:

Communication

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
View of squeres number View of PLC chessmans array

For example:
white knight at B1 ≙ 16#44 at DB1.Chessman[8]
squere B1 ≀column №1, row №01*8+0=8≀ ≙ 8th position at array
4416=6810=410+64104KNIGHT, 64White

    public enum Color
    {
        Black = 0,
        White = 64
    }
    public enum ChessmanType
    {
        EMPTY = 0,
        PAWN = 1,
        ROOK = 2,
        KNIGHT = 4,
        BISHOP = 8,
        QUEEN = 16,
        KING = 32,
    }

Counterpart at PLC

PLC chessman

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.

Chequer stack

Status of project:

In the course of implementation.

Most important To-Do:

  • moving chessmans
    • en passant to add
  • turn-based game system
  • counterpart at PLC
  • communication with PLC

About

Implementation of popular game at Unity programming environment. (project in progress)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published