Connect4
Made In : Lua and love2D
Structure :
The whole game is divided into three main parts
- Initialize : Load the sprites and initialize the game variables,flags.
- Update : Called every frame , contains the game logic.
- Draw : Renders the changes on the screen , called every frame.
Game Logic :
Internally , the state of the Connect4 board is stored as an matrix (2D array) using three elements '0','1'and '2'
'0' : Empty Slot
'1' : Player 1 dice
'2' : Player 2 dice
Examples :
All the winning conditions are checked using the matrix and the Renderer simply draws the equivalent of the internal matrix , hence any change in the matrix is immediately reflected on the screen.
All the networking is implemented using direct UDP connections on local network.
Click here for source code for Connect4 with Networking.