0

I am using Lidgren networking library to create a real time multiplayer game.

What I am trying to do is, save all incoming packages (including all bytes) to a peer in a binary file. Later when I need to debug some weird behavior of networking, I can load this file and have it load all (or rebuild) the packages that it saved, sequentially. This way, I can find how the weird behavior occurred exactly.

My question is, how do I recreate this package when I load it from the file?

It is a NetIncomingMessage that I need to recreate, I assume, and so far I thought of either creating it anew, or sending an NetOutgoingMessage to self, so it hopefully has the same effect I want to achieve, if the first approach fails.

Szabolcs Páll
  • 1,402
  • 6
  • 25
  • 31
BigThinker
  • 81
  • 1
  • 11

1 Answers1

0

The way I solved this is by creating an interface (wrapper object) of the NetIncomingMessage which contains a data byte array among other data members, and than have a thread to fill a list of these objects based on the saved incoming time, which is requested and removed (dequeued) from another thread. See https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem

BigThinker
  • 81
  • 1
  • 11