$ show opentibiabr/otclient
OTClient is a fully functional open-source alternative client for the MMORPG Tibia, implemented in C++20 and Lua. It is a cross-platform desktop application that renders a 2D tile-based game world using OpenGL, communicates with game servers via a custom TCP protocol (with encryption, compression, and version negotiation), and provides a rich Lua-scripted user interface built on a custom UI framework (OTML). The repository contains the complete client engine (graphics, networking, audio, input, platform abstraction), game-specific modules (action bars, minimap, market, NPC trade, skill wheel, etc.), and a significant set of bot/automation mods (cavebot, targetbot, loot system). The architecture follows a hybrid C++/Lua model where the core engine is in C++ and all game logic and UI are implemented in Lua, allowing extensive customization and module loading. While the codebase is generally well-structured with reusable components (event dispatcher, layout system, protocol abstraction), it also carries technical debt from accumulated version-specific conditionals, a large bot subsystem that may violate game terms of service, and some duplication between Lua modules.
The LLM identified 6 files worth highlighting for reuse:
Defines the base UILayout class and its derived AnchorLayout, HorizontalLayout, VerticalLayout, GridLayout. Implements a flexbox-like layout engine with absolute positioning, proportional sizing, and automatic anchoring. This is a self-contained layout system that could be extracted and reused in any Lua-scripted UI framework.
Provides a thread-safe event dispatcher that supports immediate, scheduled, cyclic, and deferred events. Uses a task group pattern to allow groups of events to be cancelled together. This is a generic, reusable event loop component that could power any C++ application needing asynchronous event scheduling.
Base class for all C++ objects exposed to Lua. Provides automatic lifetime management via Lua garbage collection, property getters/setters via a map table, and event signals (connect/disconnect). This pattern is fundamental to the entire Lua scripting layer and demonstrates a clean bidirectional C++/Lua binding approach.
Manages draw calls by grouping them into pools based on shader, texture, and state combinations. Uses a hash-based dirty-checking system to avoid redundant OpenGL state changes. This is a high-performance rendering abstraction that could be adapted for other 2D rendering engines.
Parses OTML, a custom XML-like markup language used for UI layouts, styles, and configuration files. Supports includes, variables, and device-specific overrides. This is a standalone parser that could be reused for any project needing a flexible declarative configuration format.
Abstract base class for network protocols with built-in XTEA encryption/decryption, checksums, and compression. Provides a protocol extension system for version-specific message handling. This pattern is reusable for implementing any game protocol with binary packet encryption.