SFML community forums

General => General discussions => Topic started by: Glocke on June 27, 2016, 04:01:06 pm

Title: Module membership for sf::Packet
Post by: Glocke on June 27, 2016, 04:01:06 pm
Hi, I've been using sf::Packet quite a while to prepare game data for being written to binary files (because of the builtin byte order handling). This makes e.g. savegames easily cross-platform. I understand that this functionality is also used while networking. But is it really necessary to attach the class to the networking module?

It isn't a big deal .. but more a question of grouping. Personally, I'd expect such things within the system module of SFML. Any thoughts on that?

Glocke
Title: Re: Module membership for sf::Packet
Post by: Laurent on June 27, 2016, 04:21:19 pm
It depends on system networking libs, so yes, it must be in the network module.
Title: Re: Module membership for sf::Packet
Post by: Glocke on June 27, 2016, 04:37:09 pm
It depends on system networking libs, so yes, it must be in the network module.
You mean those byteorder-version functions? Good point!! :)
Title: Re: Module membership for sf::Packet
Post by: FRex on June 28, 2016, 04:03:43 am
It's also friends with the two socket classes to allow calling virtual protected member functions...
Ntohs, etc. functions would be easy to get rid of compared to thinking how to do that differently.
And Packet (from its description in docs) seems to be meant mainly for networking, not as a binary data store in general.
There are plenty of nice, easy and human readable formats to save data as, that might be nicer (but less cool :P) for development and debugging.
Title: Re: Module membership for sf::Packet
Post by: Mario on July 01, 2016, 03:06:54 pm
While SFML might be convenient, look into serialization libraries for things like this. How about giving Cereal (https://github.com/USCiLab/cereal) a try?