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

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

0 Members and 1 Guest are viewing this topic.

serkeini

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • https://walmartone.me/
Why isn't there a networking event?
« on: May 04, 2020, 12:36:58 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.)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10820
    • View Profile
    • development blog
    • Email
Re: Why isn't there a networking event?
« Reply #1 on: May 04, 2020, 12:48:09 pm »
As a game engine like Game Maker you can make such messaging system, but that requires a specific design on how to integrate networking and your messaging system.
SFML is not a game engine and merely provides a cross-platform API that abstract the basic OS and OpenGL functionality with some additional tooling. Events as in key presses, mouse movement and joystick actions are all provided by the OS event system and thus provided as events.
For networking, SFML just provides you the bare tools of working with sockets and allows you now to build up on top of it. If you use some custom message bus system, you could integrate a network module to produce network messages and to receive other messages and generate network calls, but that's not a design SFML wants to provide, as it can be very opinionated and built specifically for someone's need.

To reiterate, SFML is not a game engine, but simply provides a cross platform API to various OS or OpenGL functionalities.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything