Reader small image

You're reading from  SFML Game Development

Product typeBook
Published inJun 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781849696845
Edition1st Edition
Languages
Tools
Right arrow
Authors (5):
 Artur Moreira
Artur Moreira
author image
Artur Moreira

Artur Moreira is a game development enthusiast who ultimately aims to start a new game development company in his home country. He has been programming games and game-related software for over 4 years. Most of the effort in that time was put in creating an open source game-making library with lots of flexibility and portability. The library is called Nephilim and is known for supporting all major desktop and mobile operating systems, making game development fully crossplatform and fast. Alongside this big project, he keeps making his own prototypes and games for educational and commercial purposes. Aside from the programming, he also puts some focus in creative areas such as 3D modeling, digital painting, and music composing.
Read more about Artur Moreira

 Henrik Vogelius Hansson
Henrik Vogelius Hansson
author image
Henrik Vogelius Hansson

Henrik Vogelius Hansson has always been in love with both games and programming. He started his education fairly early and continued on into the indie scene with Defrost Games and their game Project Temporality. The next company that hired him was Paradox Development Studio where he got to work on titles such as Crusader Kings 2. Beside the game companies, Henrik has also been very active in the SFML community and has even provided a binding for Ruby called rbSFML.
Read more about Henrik Vogelius Hansson

Jan Haller
Jan Haller
Henrik Valter Vogelius
Henrik Valter Vogelius
View More author details
Right arrow

Working with the Server


Now it is time to put our hands on the actual server! We will be dissecting the GameServer class to understand properly what is going on.

Server thread

To begin with, we decided to put the server in a separate thread. This is very useful in many ways. For once, server processing can be intensive and could hurt the frame rate on the client. On the other hand, if the server is running on a parallel thread, aside from improving its performance, it also allows it to perform blocking calls whenever necessary, and the game keeps running smoothly. Another plus in this approach is that our server does not communicate programmatically with the client, it communicates only via network; therefore, we don't even need to care about synchronization between the two. It is just like as if server is running on a different application!

As we have already introduced sf::Thread before in Chapter 5, Diverting the Game Flow – State Stack, we will skip that topic here. It is important to notice...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
SFML Game Development
Published in: Jun 2013Publisher: PacktISBN-13: 9781849696845

Authors (5)

author image
Artur Moreira

Artur Moreira is a game development enthusiast who ultimately aims to start a new game development company in his home country. He has been programming games and game-related software for over 4 years. Most of the effort in that time was put in creating an open source game-making library with lots of flexibility and portability. The library is called Nephilim and is known for supporting all major desktop and mobile operating systems, making game development fully crossplatform and fast. Alongside this big project, he keeps making his own prototypes and games for educational and commercial purposes. Aside from the programming, he also puts some focus in creative areas such as 3D modeling, digital painting, and music composing.
Read more about Artur Moreira

author image
Henrik Vogelius Hansson

Henrik Vogelius Hansson has always been in love with both games and programming. He started his education fairly early and continued on into the indie scene with Defrost Games and their game Project Temporality. The next company that hired him was Paradox Development Studio where he got to work on titles such as Crusader Kings 2. Beside the game companies, Henrik has also been very active in the SFML community and has even provided a binding for Ruby called rbSFML.
Read more about Henrik Vogelius Hansson