{"id":28307324,"url":"https://github.com/redneath/asumeohr-save-system-poc","last_synced_at":"2025-08-20T15:37:48.235Z","repository":{"id":181323057,"uuid":"665726759","full_name":"RedNeath/asumeohr-save-system-poc","owner":"RedNeath","description":"Designing the two saving solutions considered for the Asumeohr video game ❤️","archived":false,"fork":false,"pushed_at":"2023-08-04T10:21:24.000Z","size":4377,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T00:25:57.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedNeath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-12T21:29:04.000Z","updated_at":"2023-07-14T23:04:07.000Z","dependencies_parsed_at":"2023-07-15T00:22:49.848Z","dependency_job_id":"ea189a59-43e0-4b91-b212-e4b8fab17054","html_url":"https://github.com/RedNeath/asumeohr-save-system-poc","commit_stats":null,"previous_names":["redneath/asumeohr-save-system-poc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RedNeath/asumeohr-save-system-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedNeath%2Fasumeohr-save-system-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedNeath%2Fasumeohr-save-system-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedNeath%2Fasumeohr-save-system-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedNeath%2Fasumeohr-save-system-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedNeath","download_url":"https://codeload.github.com/RedNeath/asumeohr-save-system-poc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedNeath%2Fasumeohr-save-system-poc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260944593,"owners_count":23086841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-24T05:11:50.021Z","updated_at":"2025-08-20T15:37:48.215Z","avatar_url":"https://github.com/RedNeath.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asumeohr save system POC\nDesigning the two saving solutions considered for the Asumeohr video game ❤️\n\nThe two options considered are the following ones (I'll detail them later on).\n- A SQLite database;\n- Separate JSON files.\n\nTo demonstrate both systems, here's a brief explanation of what the piece of\nsoftware will do. At startup, it'll ask the user what type of save system to use\nand it will load the \"game\" by creating the required instances via that system.\nOnce loaded, it will output all it has loaded and terminate. \n\n### SQLite database implementation\nOn this implementation, the user data, as well as the game assets are saved into\na one-file database. The call to the interface method `LoadDataAndAssets()` will\npull everything out of the database, making no distinction between both.  \nAll the data gathered will be stored in the cache, except global variables that\nwill be instantiated as singletons.\n\n### JSON serialization implementation\nHere, the user data and the assets will be clearly separated, each in different\nsub-folders. Of course, both will be loaded when calling `LoadDataAndAssets()`\nmethod, though the separation will be way clearer when it comes to the\nimplementation. The use of a cache system may be discussed in this implementation,\nbut to make the code easier to compare with the previous implementation, it will\nbe used as well to manage the memory. In a real implementation, we could simply\nload what is required at the very moment when starting the game, and continuously\nkeep loading things following the user's movements and actions.\n\n## Infrastructure \u0026 prototype details\nOf course, to make the tests interesting, we need to gather some data to load\nand store. And to gather this data, we have to create classes. Here's what this\nPOC will come up with:\n- a `Player` class, with attributes such as the current map, its x and y axis\npositions, ...\n- a `Map` class, with its dimensions, its sprite, ...\n- an `Item` class, with 2 sub-classes: `Weapon` and `Equipment`\n- a `Skill` class, with a name, an icon, a description, ...\nThe global variables will be stored in the main class.\n\n### Total amount of data to load\n- JSON: 1.4MB\n- SQLITE: 1.4MB (size of the database, so probably a bit less).\n\n## Actions available once loaded\nOnce all the data from the desired save is loaded, the application turns into a\nconsole, letting you enter commands to change the data and act onto it. Here's\nthe list of commands, with a brief description and the details of their arguments.\n\u003e **NOTE:** The actions you may perform won't be saved automatically. You need\n\u003e to use saving commands to serve that purpose.\n\n\u003e **NOTE:** The creation of new saves is not supported yet. Saving an already\n\u003e created save to another name is possible though.\n\n| Command              | Description                                                                                                                                                                                                                                                                                                                                                                                                                          | Arguments                                   |\n|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|\n| `save`               | This command will save the game currently loaded. Without arguments, it will save it into the same save it was loaded from. Specifying a `savename` allows to save it as another save. Of course, when the save is new, the `savename` becomes mandatory.                                                                                                                                                                            | `[savename:string]`                         |\n| `save_exit`          | This command simply stops the programme immediately after saving. All other specificities are the same as the previous one.                                                                                                                                                                                                                                                                                                          | `[savename:string]`                         |\n| `exit`               | This command allows exiting the programme in a clean way.                                                                                                                                                                                                                                                                                                                                                                            | N/A                                         |\n| `give`               | Adds an item to the user's inventory. The item can be a weapon or an equipment as well. The item id must be specified, but the quantity is optional (defaults at 1)                                                                                                                                                                                                                                                                  | `\u003citem_id:int\u003e [quantity:int]`              |\n| `drop`               | Removes an item from the user's inventory. The item cannot be an equipped weapon or equipment. Unlike the `give` command, it won't be identified via its id, but via the 1-based inventory index (1 for the first slot, n for the nth ...). It is also possible to specify a quantity to drop, but the command will be rejected if it is too high.                                                                                   | `\u003cinventory_slot:int\u003e [quantity:int]`       |\n| `equip`              | Equips a weapon or an equipment that is in the user's inventory. If the user is already equipped with a weapon, the command will fail. However there is no restriction for equipments.                                                                                                                                                                                                                                               | `\u003cinventory_slot:int\u003e`                      |\n| `unequip`            | Un-equips a weapon or an equipment. Without arguments, this command will un-equip the user's weapon. The `equipment_slot` argument allows selecting the equipment to remove. Un-equipped items will be added to the user's inventory.                                                                                                                                                                                                | `[equipment_slot:int]`                      |\n| `learn`              | Learns the user a **new** skill. The skill will be identified via its id.                                                                                                                                                                                                                                                                                                                                                            | `\u003cskill_id:int\u003e`                            |\n| `forget`             | Lets the user forget about a skill they previously learned. The skill will be identified via its 1-based user skill index (1 for the first skill, n for the nth ...).                                                                                                                                                                                                                                                                | `\u003cskill_slot:int\u003e`                          |\n| `move`               | Moves the player in the given direction. The `direction` argument may be one of `[\"up\" ; \"right\" ; \"down\" ; \"left\"]`. By default, the amount of squares traveled will be 1, but it is specifiable. It is also possible to specify `\"max\"` instead of an actual value, to move in the same direction until we reach the map border. If the given value is too high, the command will fail and the player will stay at the same place. | `\u003cdirection:string\u003e [amount:int\\|\"max\"]`    |\n| `teleport`           | Teleports the player to the given destination. Of course, the destination may be another map, identified via its asset name. X and Y coordinates have to be specified, and correct, otherwise the teleportation will be cancelled.                                                                                                                                                                                                   | `[map_name:string] \u003cpos_x:int\u003e \u003cpos_y:int\u003e` |\n| `set_difficulty`     | Modifies the game difficulty. Possible values ranges from Easy (`0`), Hard (`1`), Extremely hard (`2`) and Hell (`3`)                                                                                                                                                                                                                                                                                                                | `\u003cdifficulty:int\u003e`                          |\n| `toggle_chose_class` | Toggles the value of the `ChoseClass` global variable. You may use the display commands to check its value.                                                                                                                                                                                                                                                                                                                          | N/A                                         |\n| `progress`           | Edits the progress variables states. Possible states value ranges from Not yet (`0`), Ongoing (`1`) and Done (`2`)                                                                                                                                                                                                                                                                                                                   | `\u003cvariable_name:string\u003e \u003cstate:int\u003e`        |\n| `display`            | Prints the entire game object to the terminal. (this is what is done at startup, once every asset and data are loaded).                                                                                                                                                                                                                                                                                                              | N/A                                         |\n| `display_player`     | Prints the entire player object to the terminal.                                                                                                                                                                                                                                                                                                                                                                                     | N/A                                         |\n| `display_map_cache`  | Prints the entire map cache.                                                                                                                                                                                                                                                                                                                                                                                                         | N/A                                         |\n| `display_weapon`     | Prints the player's current weapon.                                                                                                                                                                                                                                                                                                                                                                                                  | N/A                                         |\n| `display_equipments` | Prints the player's current equipments.                                                                                                                                                                                                                                                                                                                                                                                              | N/A                                         |\n| `display_inventory`  | Prints the player's current inventory.                                                                                                                                                                                                                                                                                                                                                                                               | N/A                                         |\n| `display_skills`     | Prints the player's current skills.                                                                                                                                                                                                                                                                                                                                                                                                  | N/A                                         |\n| `display_map`        | Prints the player's current map.                                                                                                                                                                                                                                                                                                                                                                                                     | N/A                                         |\n\n### Version notes:\nSQLite: 3.31.1 (released on 2020-01-27)  \ng++: 9.4.0 (released in 2019)  \nnlohmann/json: 3.11.2 (released on 2022-08-12)  \nlibmagick++-dev: 6.9.10.23 (released on 2023-03-15)  \nsqlite_modern_cpp: latest (cloned from the repo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredneath%2Fasumeohr-save-system-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredneath%2Fasumeohr-save-system-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredneath%2Fasumeohr-save-system-poc/lists"}