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

Author Topic: Why isn't there a networking event?  (Read 2410 times)

0 Members and 1 Guest are viewing this topic.

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Why isn't there a networking event?
« on: August 04, 2019, 05:24:27 pm »
Game Maker has it, and it makes sense to me honestly. Not as default, but as a feature the programmer can either enable or disable.

The idea is being able to receive and elaborate networking messages through the events system, without requiring the user to deal with async stuff.

Right now for what i'm working on i'll make a class that does exactly that, in a second thread it takes data from the network and fills a queue; the main cycle after handling events handles that queue's content as if it was another event. (well it's more complex than that for thread safety and actually uses two queues so you don't lock the main thread, but that's the idea.)
« Last Edit: August 04, 2019, 05:26:47 pm by barnack »

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: Why isn't there a networking event?
« Reply #1 on: August 05, 2019, 06:16:09 pm »
Because the event system is made to handle window related event(e.g. keyboard input in the window, mouse in the window, resizing, close, etc.)

SFML is not a game engine. It's up to you to implement a network event system. Plus the way you do may not solve all use cases.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord