[SDL] [Framework] Event-based Networking

Glocke cgloeckner at freenet.de
Sat Mar 16 03:32:01 PDT 2013

Hi there, 

In advance: I already postet this at the "Game Development"-Subforum of this board. But know I noticed that subforum is used for general game discussion and not SDL-based discussion (the title "SDL Development" seemed confusing to me ^^). To get more feedback I would like to post the following stuff here. If the moderators dislike this double-posting, pleace delete the old one :?

I am working with SDL using C++. Because I did not found something suitable yet, I startet solving the problem on my own: https://github.com/cgloeckner/networking 

It is a framework for C++ using SDL and SDL_net; its aim is to offer sending "events" over the network and handling them after receive. The events are enqueued in a thread-safe fifo queue before sending. Any received events are also enqueued in an also thread-safe fifo queue at the receiver's side. They will stay there until they were handled. Each event type is a derivate of the struct event. It contains an event-id to identify it at the receiver's side referring to it's original type. Then you can type-cast it to enable accessing the actual data. Both sides are using the same set of events. 


This events are not allowed to carry pointers or std-containers. Only primitive data types are allowed. This is because the framework does not serialize any data before sending. So pointers or high-level containers (using pointers) cannot be sent or received, unless serializing them first. 

Licence and structure

I released the project under CC BY-NC 3.0. You can find the source code at the linked GitHub-Repository: the framework is placed inside the src-directory. Also you can find an example inside the example-directory.

Additional notes 

The project is already using features of C++11. Actually, I like to make it independent from C++11, because of the missing support of many compilers. That is why I implemeneted all threading stuff using SDL_thread. 

I am curious about your feedback! 

With kind regards 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130316/4422ee61/attachment-0008.htm>

More information about the SDL mailing list