GSoC Final Evaluation Part2: Adding support for JSON format in the serialization system

Reporter: FaresAtef1  |  Status: open  |  Last Modified: November 12, 2023, 12:07:31 am

Final GSoC Part2 Update

Closes #2326.
This pull request contains updates for my Google Summer of Code (GSoC) project at the Final evaluation stage.

First PR (Midterm Evaluation Part): Changing the way the serialize, serialize_into and deserialize functions work
Second PR (Final Evaluation Part1): Implementing (de)serialization routines for generic data types

Feature Implementation

  • Implementing serialize_into for all the types.
  • Implementing deserialize for all the types.
  • Implementing serialization functions for lua_table.
  • Implementing serialization functions for var.
  • Implementing serialization functions for Object_Tiers.
  • Implementing serialization functions for enigma::Background.
  • Implementing serialization functions for enigma::AssetArray.
  • Creating a map for script variables that is generated at compile time.
  • Implementing compiler serialization functions.
  • Modifing game_save_buffer and game_load_buffer.

Testing Functions (unit tests/SOG)

  • Testing serialize_into.
  • Testing deserialize.
  • Unit testing for the generic types.
  • SOG tests for game_save_buffer and game_load_buffer.


  • Make a new directory for JSON serialization functions.
  • Separate file for each type.
  • bytes_serialization namespace.
  • JSON_serialization namespace.
  • Make a new directory for Types_Impl_Bytes.
  • Make a new directory for Types_Impl_JSON.
  • Make new file JSON_parsing_utilities.h.

To Be Done Before Merging

  • Modify detect_serialization.h.
  • Modify all serialization.h functions.
  • Replace internal_serialize_into_fn in Object_Tiers, Background and tests.
  • Documentation for all the files.
  • Extract split and find_value functions from the functions.
  • Add remove_whitespaces function.

Adding new types for the JSON format

Create a new file in the Types_Impl_JSON directory for your new type, and then include this file in the JSON_types_serialization_includes.h file.

Every new data type in our system should implement the following functions

  • internal_serialize_into_fn
    template <typename T>
    matches_t<T, std::size_t, is_new_type> inline internal_serialize_into_fn(const T& value) {
        std::string json = // ....
        // ....
        return json;
  • internal_deserialize_fn
    template <typename T>
    matches_t<T, T, is_new_type> inline internal_deserialize_fn(const std::string& json) {
        T result;
        // ....
        return result;

Sample game that is compatible with the AST_Generation branch

Balloon_Pop (It is the same game in the ENIGMA site but with modified scripts).

Ongoing Work

Please sign in to post comments, or you can view this issue on GitHub.