Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Module membership for sf::Packet  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Module membership for sf::Packet
« 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
« Last Edit: June 27, 2016, 04:03:14 pm by Glocke »
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Module membership for sf::Packet
« Reply #1 on: June 27, 2016, 04:21:19 pm »
It depends on system networking libs, so yes, it must be in the network module.
Laurent Gomila - SFML developer

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Module membership for sf::Packet
« Reply #2 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!! :)
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Module membership for sf::Packet
« Reply #3 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.
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Module membership for sf::Packet
« Reply #4 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 a try?

 

anything