View previous topic - View next topic |
Author |
Message |
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Fri Apr 01, 2005 8:20 pm Post subject: |
[quote] |
|
Hajo wrote: | I have about 20.000 lines of C++ code, so I can't easily switch to 'modern' OO languages that have inbuild object serialization. I wrote my own serialization support, but it only writes to files.
I'll have to write another subclass of the data output API to serialize into memory buffers. Not much of work, but a bit boring. |
I believe this is where serializing to a generic output stream would be preferable: instead of requiring the class to know (explicitly) the stream upon which it is outputing itself (for example, as you say in the first paragraph, a file-stream), use the generic ostream; then, it doesn't matter if you asked the object to place itself on an ofstream or an ostringstream.
Quote: | But the real problem is that I don't want to transfer full player/monster body data between client and server. This would allow the players to cheat by sending fake data back to the server. So serialization doesn't help, I need to change the UI to work indirectly, not directly on the map/world data as it does now. |
While I have absolutely no idea about how the innards of your code operate, it might be handy for all objects that need to be sent over the ether to have some sort of Momento to facilitate in their serialization: the memento would hold the requested time-snapshot, and it would take care of the serializaton. It also provides very little public access to that data. This, however, doesn't take care of your immediate concern. Two thoughts come to mind: some sort of elaborate 3- to 4- way handshake for data transmissions (which, obviously, would be wasteful for real-time/UDP), by which the server can authenticate incoming messages, or some sort of of encryption algorithim, which is only known by the internals of the system. (So, it would be harder for clients to send spurious data.)
But, then again, I've never done anything like this, so I would not take these ramblings too seriously. It's all supposition. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
Hajo Demon Hunter
Joined: 30 Sep 2003 Posts: 779 Location: Between chair and keyboard.
|
Posted: Mon Apr 04, 2005 9:06 am Post subject: |
[quote] |
|
LeoDraco wrote: |
I believe this is where serializing to a generic output stream would be preferable: instead of requiring the class to know (explicitly) the stream upon which it is outputing itself (for example, as you say in the first paragraph, a file-stream), use the generic ostream; then, it doesn't matter if you asked the object to place itself on an ofstream or an ostringstream.
|
Yes. I have something like streams (what I called the output API). I don't need to change the app code, only a new stream that writes to buffers instead of files.
Quote: |
While I have absolutely no idea about how the innards of your code operate |
This problem should be solveable very soon. The project is now registered at Sourceforge, and the code is imported to the CVS:
https://sourceforge.net/projects/h-world/
Public/Anonymous CVS seems to have a delay and doesn't show the files yet. Sourceforge says thgis should be solved within 24 hours.
|
|
Back to top |
|
|
|
Page 4 of 4 |
All times are GMT Goto page Previous 1, 2, 3, 4
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|