Book Image

SFML Blueprints

Book Image

SFML Blueprints

Overview of this book

Table of Contents (15 chapters)
SFML Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Modifying our game


To add this functionality to our game, we will need to rethink the internal structure a bit. First of all, we need to split our code to build two different programs. All the common classes (such as those used for communication) will be put into a common directory. All the other functionalities will be put into the server or client folder with respect to their usage. Let's start with the most complicated part: the server.

Server

The server will be in charge of all the simulation. In fact, all our game will reside in the server. Moreover, it will have to ensure the possibility of having multiple matches running at the same time. It will also have to deal with connections/disconnections and player events.

Because the server will not render anything, we don't need any graphic class anymore on this side. So the AnimatedSprite function in the CompSkin component will have to be removed, as will the sf::RectangleShape component in the CompHp function.

Because the positions of the...