-
Notifications
You must be signed in to change notification settings - Fork 54
Game
Cheng20010201 edited this page Apr 13, 2020
·
7 revisions
In coordination with https://github.com/source-academy/cadet-frontend/pull/1058, this project aims to extend the cadet backend to allow storage of game data in backend.
Improvent: Enable the cadet backend to store users' game data.
Achieved by:
-
Using migration to extend the field of table "user" by one additional column. Namely "game_states".
- game_states, being a new attribute of the table "user", is a map. Inside the map, there are another map called "collectibles" and an array of strings called completed_quests.
- collectibles is a map, this is for the convenience of frontend. A collectible is a picture in frontend. The picture has a nick_name, which we would like to call in the process of game developing. The nick_name is the key of the map. The picture has a real name, which is the name of the picture source file in the assets server. The real name is the value of the map. Designing collectibles as a map can alleviate the work load of game developers.
- completed_quests is an array of strings. The purpose of this is to better fit the game process. When the user play the game, an action sequence, which is an array of strings, is generated to represent the user's state inside the game. To save users' game data, we call it by the name "completed quests"
-
Added functionality for the backend to retrieve, update, reset users' game_states.
-
Properly adjust other parts of the backend to fit the new functionality.
-
Modified