Skip to content

Commit

Permalink
drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
geneotech committed Aug 19, 2016
1 parent 55f8d13 commit 189a3a4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Binary file modified ToDo/todo.tdl
Binary file not shown.
25 changes: 24 additions & 1 deletion game/transcendental/simulation_exchange.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
#include "simulation_exchange.h"
#include "simulation_exchange.h"
#include "cosmic_delta.h"

void simulation_receiver::acquire_new_entropy(const cosmic_entropy& entropy) {
jitter_buffer.push_back(entropy);
}

void simulation_receiver::acquire_new_heartbeat(augs::bit_stream& delta) {
cosmic_delta::decode(last_snapshot, delta);

new_state_to_apply = true;
}

void simulation_receiver::pre_solve(cosmos& into) {
if (new_state_to_apply) {
into = last_snapshot;
new_state_to_apply = false;
}

if (jitter_buffer.size() > 0) {
auto next_entropy = jitter_buffer.front();
jitter_buffer.erase(jitter_buffer.begin());
}
}
5 changes: 5 additions & 0 deletions game/transcendental/simulation_exchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ class simulation_broadcast {
class simulation_receiver {
std::vector<cosmic_entropy> jitter_buffer;
cosmos last_snapshot;
bool new_state_to_apply = false;

public:
unsigned jitter_buffer_length = 3;

void acquire_new_entropy(const cosmic_entropy&);
void acquire_new_heartbeat(augs::bit_stream& delta);

void pre_solve(cosmos& into);
};

0 comments on commit 189a3a4

Please sign in to comment.