How rico-knots/p2pchess works
This repository is a graphical chess application with a separate socket-server prototype and networking client code. The visible main loop initializes a window, creates a new game state, then repeatedly draws it until shutdown. The engine provides board representation and game initialization; UI rendering and asset loading form a separate layer. Networking defines packet formats and serialization, while the server accepts connections and deserializes received packets. UI internals and client protocol usage are only partially evidenced, so their detailed call relationships are omitted.
Main entry points: main.c Game Loop · asset_manager.c Asset Manager · server.c Socket Server · window.c Window
Components 17
Application
- Game Loop
src/main.c
Chess Engine
- Game State
src/engine/chess.c - Bitboards
src/engine/bitboard.c - Move Generation
src/engine/movegen.c
Graphical UI
- Window
src/ui/window.c - Renderer
src/ui/renderer.c - Asset Manager
src/ui/asset_manager.c - Image Decoder
src/include/stb/stb_image.h - OpenGL Loader
src/include/glad/gl.h - OpenGL API
src/gl.c - Quad Shaders
src/shaders/quad.vert
Networking
- Network Client
src/networking/client.c - Packet Protocol
src/networking/protocol.c - Packet Types
src/networking/packets.h - Socket Server
src/networking/server.c
Other components
- Player
- Remote Peer
Connections 9
- Player → Game Loop: plays
- Game Loop → Window: runs loop
src/main.c - Game Loop → Game State: creates state
src/main.c - Game Loop → Window: draws state
src/main.c - Asset Manager → Image Decoder: decodes images
src/ui/asset_manager.c - Asset Manager → OpenGL Loader: uses API
- Socket Server → Packet Protocol: deserializes packets
src/networking/server.c - Network Client → Remote Peer: communicates
- Socket Server → Remote Peer: accepts connections
src/networking/server.c