How matissavadogo/spotthedifference works
Project Type & Purpose
• This is a full-stack, multiplayer mobile game.
• The Android client (built with Java/Kotlin and XML layouts in Android Studio) provides the interactive “Spot the Difference” gameplay.
• The backend (implemented in C# with ASP.NET Core and structured into controllers, business logic, data access, and tests) supports game sessions, player management, image handling, and the real-time game logic.
• Communication between the app and server includes standard RESTful API endpoints (via Retrofit) and WebSocket/SignalR based interactions for real-time updates.
Main Components
• Mobile Client (Android App):
◦ UI Layer: Activities and layouts (evident from the “ui/activities” and “res/layout” folders).
◦ Networking/API Layer: API service classes (located under “api” packages using Retrofit).
◦ Real-Time Communication: WebSocket and SignalR client components (in “WebSocket” package).
◦ Models & Config: Data models (in “models”), and configuration classes (e.g., “ServerConfig.java”).
◦ Utility and Test Packages: Utility classes (such as “ScreenUtils.java”) and test files under “src/test”.
• Backend Server (API7D):
◦ API/Controllers: HTTP endpoints for game sessions, image management, and difference checking (see Controllers folder).
◦ Business Logic/Services: Core game logic and helper classes (in “Metier” and “Services”), including SignalR Hub implementation (e.g., GameSessionHub.cs).
◦ Data Layer: Data access objects/interfaces and SQL scripts (inside “DATA” and “Database”) managing persistence and schema.
◦ Objects/Domain Models: Domain object definitions (in “objet”).
◦ Configuration & Settings: app settings (json configuration files) and certificates.
◦ Testing: Separate unit testing projects (TestsUnitaires) covering controllers, business logic, etc.
Relationships & Interactions
• The mobile client interacts with the server using:
◦ RESTful calls via Retrofit for typical API operations (e.g., joining a game, image retrieval).
◦ WebSocket/SignalR connections for real-time event notifications, game updates, and ensuring synchronization among players.
• On the backend, the controllers receive client calls, pass the requests onto service layers/business logic, and interact with the data layer (either through SQL databases or file-based storage, as suggested by the Database folder).
• Data flows from the Android UI to the API layer, then to backend controllers, and back to the client using both request/response and push-notification patterns.
Important Architectural Patterns & Technologies
• Separation of Concerns – the project clearly divides responsibilities between UI, API communication, and backend logic.
• MVC/MVVM (on the Android client, the activities and util classes can be viewed through the lens of user-driven events while the backend strictly separates controllers, business logic, and data access).
• Real-Time Communication via SignalR (WebSocket integration on the client and server).
• Dependency Injections and interface-based designs are visible (look at interfaces in the “models” and “api” folders).
• Use of Gradle for build automation and Visual Studio for backend development.