Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 95 commits into
base: AST-Generation
Choose a base branch
from

Conversation

FaresAtef1
Copy link

@FaresAtef1 FaresAtef1 commented Aug 21, 2023

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.

Organization

  • 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

@FaresAtef1 FaresAtef1 marked this pull request as ready for review September 3, 2023 00:38
Copy link
Contributor

@dc03 dc03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost finished, very well done!

ENIGMAsystem/SHELL/Universal_System/Object_Tiers/object.h Outdated Show resolved Hide resolved
ENIGMAsystem/SHELL/Universal_System/Resources/AssetArray.h Outdated Show resolved Hide resolved
ENIGMAsystem/SHELL/Universal_System/buffers.h Show resolved Hide resolved
ENIGMAsystem/SHELL/Universal_System/bufferstruct.cpp Outdated Show resolved Hide resolved
ENIGMAsystem/SHELL/Universal_System/var4.h Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants