Shooter

The Shooter example shows how to develop a complete multiplayer first/third person combat game with Godot and SmartFoxServer. The game utilizes SmartFoxServer's ability to mix TCP and UDP based messaging, and makes full use of SmartFoxServer Lag Monitor.
TCP is the most common protocol deployed on the Internet. Its dominance is explained by the fact that TCP performs error correction. When TCP is used, there is an assurance of delivery. This is accomplished through a number of characteristics including ordered data transfer, retransmission, flow control and congestion control. During the delivery process, packet data may collide and be lost, however TCP ensures that all packet data is received by re-sending requests until the complete package is successfully delivered.
UDP is also commonly found on the Internet. However UDP is not used to deliver critical information, as it forgoes the data checking and flow control found in TCP. For this reason, UDP is significantly faster and more efficient, although, it cannot be relied on to reach its destination.
In this example, all critical game information between the server and client are sent via TCP for reliable delivery. This could be shooting for example, or animation sync, damage messages, etc. On the other hand, sending updates to the player position, which is continuously broadcasted by and to all clients, is executed using UDP.
The example scene features a simple lobby and multiple games which can run at the same time as individual arenas. The example was ported from its Unity counterpart: although the server-side code is the same, a Godot client cannot interact with a Unity client due to their different handedness (Unity is left-handed, Godot is right-handed).
Source code
- Get the full examples pack from the SmartFoxServer website
- Get this example source from the Godot Asset Store
The porting of this tutorial from the SmartFoxServer 2X documentation is still in progress. We apologize for the inconvenience.