void BasicAbstractGame::deserialize()

in procgen/src/basic-abstract-game.cpp [1225:1288]


void BasicAbstractGame::deserialize(ReadBuffer *b) {
    Game::deserialize(b);

    grid_size = b->read_int();

    read_entities(b, entities);

    int agent_idx = find_entity_index(PLAYER);
    fassert(agent_idx >= 0);
    agent = entities[agent_idx];

    // we don't want to serialize a bunch of QImages
    // for now we only support games that don't require storing these assets
    fassert(!options.use_generated_assets);

    // when restoring state (to the same game type) with generated assets disabled, these data structures contain cached
    // asset data, and missing data will be filled in the same way in all environments
//     std::vector<std::shared_ptr<QImage>> basic_assets;
//     std::vector<std::shared_ptr<QImage>> basic_reflections;
    // main_bg_images_ptr is set in game_init for all supported games, so it should always be the same
//     std::vector<std::shared_ptr<QImage>> *main_bg_images_ptr;

    // std::vector<float> asset_aspect_ratios;
    // std::vector<int> asset_num_themes;

    use_procgen_background = b->read_int();
    background_index = b->read_int();
    bg_tile_ratio = b->read_float();
    bg_pct_x = b->read_float();

    char_dim = b->read_float();
    last_move_action = b->read_int();
    move_action = b->read_int();
    special_action = b->read_int();
    mixrate = b->read_float();
    maxspeed = b->read_float();
    max_jump = b->read_float();

    action_vx = b->read_float();
    action_vy = b->read_float();
    action_vrot = b->read_float();

    center_x = b->read_float();
    center_y = b->read_float();

    random_agent_start = b->read_int();
    has_useful_vel_info = b->read_int();
    step_rand_int = b->read_int();

    asset_rand_gen.deserialize(b);

    main_width = b->read_int();
    main_height = b->read_int();
    out_of_bounds_object = b->read_int();

    unit = b->read_float();
    view_dim = b->read_float();
    x_off = b->read_float();
    y_off = b->read_float();
    visibility = b->read_float();
    min_visibility = b->read_float();

    grid.deserialize(b);
}