How jalenng/dont-set-ca-on-fire works
Project Overview
• This is a game project created during SCEhacks 2021 that combines an interactive Unity-based trivia game with a Flask backend, which in turn communicates with an Azure SQL database. Its purpose is to educate players about the wildfire crisis through gameplay.
• The project includes a Unity game client (located in the DSCoF directory) with assets like animations, images, fonts, and game scripts written in C#, and a Flask application (in the flaskapp directory) that provides API endpoints for the game, handling database interactions.
Main Components
a. Unity Game Client:
• Managed under the DSCoF directory. It hosts assets (Animations, Images, Scenes, Scripts, etc.) and contains key C# scripts (such as ButtonController, FireController, GuyController, etc.) that control the game’s logic.
• Serves as the front-end interface, handling game display, player input, and in-game interactions.
b. Flask Backend Server:
• Found in the flaskapp directory, with files like __init__.py, routes.py, and sql_connection.py.
• Acts as the API layer that receives GET and POST requests from the Unity game, processes them (e.g., querying and updating data), and relays responses.
c. Azure SQL Database:
• Not directly shown in the file tree but referenced in the README. It is where game analytic data (such as player statistics and answers) are stored.
d. Art Assets/Sprite Tools:
• Additional directories like aseprite indicate the use of external tools (Aseprite for sprite creation) though they’re not part of runtime architecture. You may note these as part of the asset creation workflow.
Relationships & Data Flow
• The Unity client sends HTTP POST and GET requests to the Flask server. This is a key integration point where game events (such as submitting answers or requesting results) are transmitted.
• The Flask server then connects to the Azure SQL database by executing SQL queries via configured Python libraries, retrieves or updates the necessary data, and sends the response back to Unity.
• Internally within Unity, various game systems (controllers and managers such as QuestionManager, ResultManager, and StatsManager) process the data and update the game state.
• Overall data flow: User interaction in Unity → Unity triggers C# scripts → HTTP request to Flask server → Flask queries/updates Azure SQL → Flask returns data to Unity → Unity displays data and adjusts gameplay.