Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SFML Blueprints

You're reading from   SFML Blueprints Sharpen your game development skills and improve your C++ and SFML knowledge with five exciting projects

Arrow left icon
Product type Paperback
Published in May 2015
Publisher Packt
ISBN-13 9781784398477
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime