Worked on code for difference transmission

This commit is contained in:
2021-09-09 18:23:17 -04:00
parent bac1a7b876
commit aedd8ca43a
8 changed files with 456 additions and 403 deletions

View File

@@ -197,20 +197,7 @@ public:
void snapshot();
void rollback();
// Difference transmission.
//
// This generates diffs and stores them in the specified buffer,
// so that they can be sent to the client. It also applies the diffs
// to this model.
//
void difference_transmit(int64_t actor, World *master, StreamBuffer *sb);
// Apply differences.
//
// Note that difference_transmit applies the differences to the server
// synchronous model, so this is only used by the client synchronous model.
//
void apply_differences(StreamBuffer *sb);
util::IdVector get_visible_union(int64_t actor_id, World *master);
public:
////////////////////////////////////////////////////////////////////////////
@@ -252,6 +239,10 @@ public:
//
void tangible_copy_global(int64_t id, const std::string &path, const std::string &global);
// Pretty-print the entire tangible database and return it as a string.
//
std::string tangible_pprint(int64_t id) const;
private:
// Run any threads which according to the scheduler queue are ready.
//
@@ -269,21 +260,26 @@ private:
//
void invoke_plan(int64_t actor_id, int64_t place_id, const std::string &action, const InvocationData &idata);
// pass 1 of difference transmission: actor essentials.
public:
///////////////////////////////////////////////////////////
//
// Before we do anything else, we need to get the actor in the right place.
// We also update the actor's ID allocation pipeline.
// Difference transmission
//
static void diff_actor_essentials(const Tangible *mactor, const Tangible *sactor, StreamBuffer *sb);
int64_t patch_actor_essentials(StreamBuffer *sb);
///////////////////////////////////////////////////////////
// Pass 2 of difference transmission: visible animations.
int64_t patch_actor(StreamBuffer *sb);
void diff_actor(int64_t actor_id, World *master, StreamBuffer *sb);
void patch_visible(StreamBuffer *sb);
void diff_visible(const util::IdVector &ids, World *master, StreamBuffer *sb);
void patch_luatabs(StreamBuffer *sb);
void diff_luatabs(int64_t actor_id, World *master, StreamBuffer *sb);
// This is the main entry point for difference transmission.
//
// Synchronizes the animation status of every tangible inside the visibility
// radius of either model. Creates missing tangibles and deletes excess tangibles.
//
static void diff_visible_animations(const TanVector &mvis, const TanVector &svis, StreamBuffer *sb);
void patch_visible_animations(StreamBuffer *sb);
void patch_everything(StreamBuffer *sb);
void diff_everything(int64_t actor, World *master, StreamBuffer *sb);
public:
///////////////////////////////////////////////////////////
@@ -350,17 +346,11 @@ public:
//
///////////////////////////////////////////////////////////
// Compare the numbered general tables.
//
void patch_numbered_tables(StreamBuffer *sb);
void diff_numbered_tables(lua_State *master, StreamBuffer *sb);
// Compare the tangible databases.
//
void diff_tangible_databases(const IdVector &basis, lua_State *master, StreamBuffer *sb);
void patch_numbered_tables(StreamBuffer *sb);
void patch_tangible_databases(StreamBuffer *sb);
void diff_tangible_databases(const IdVector &basis, lua_State *master, StreamBuffer *sb);
private:
// Type of model