SFS2X Docs / ExamplesFlash / space-race
» Space Race
Space Race is a four-player futuristic racing game featuring a top-down view, a scrolling circuit, power-ups and more. It utilizes all the main characteristics of SmartFoxServer 2X to demonstrate how to build a fast-paced realtime multiplayer game, but focuses on showcasing UDP protocol usage.
TCP is the most common protocol deployed on the Internet. It’s 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 as well, is commonly found on the Internet, however, UDP is not used to deliver critical information – 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 it’s destination.
In online multiplayer games, UDP offers the ability to update other players with non-critical information quickly and frequently. In Space Race this is used for player's vehicle positioning and verification.
The Space Race game and walk-through are distributed for educational purposes only. You must retain all the copyright notices appearing in the user interface, source code and any other accompanying file.
Please read the license file contained in the game folder for more informations.
Contact us if you are interested in buying a commercial license which removes the above restrictions.
» Running the example
In order to run the game follow these steps:
- copy the spaceRace folder from the /deploy/extensions folder to your SFS2X installation folder, under /SFS2X/extensions;
- copy the SpaceRace.zone.xml file (containing the Zone configuration) from the /deploy/zones folder to your SFS2X installation folder, under /SFS2X/zones;
- start SmartFoxServer 2X;
- install the SFS2X_SpaceRace Adobe Air application available in the /deploy/client folder following the on-screen instructions;
- run the SFS2X Space Race application.
» Source code setup
The client-side assets are contained in the /source/client folder: create a new Flash Builder project, copy the content of the /source/client/src folder to your project's source folder and link the libraries contained in the /source/client/libs folder. The project must target Flex SDK 4.1 or later and the Air SDK 2.0 or later; in order to do this you have to perform one of the following actions:
- download the Flex SDK 4.1 and merge it with the Air SDK 2.0 (information on how to do this can be found here: http://kb2.adobe.com/cps/495/cpsid_49532.html); or
- download and install the Flex SDK 4.5 or later.
Flex SDKs can be found here: http://opensource.adobe.com/wiki/display/flexsdk.
Space Race features a server-side Extension, as described in the walk-through. In order to access its code, create and setup a new project in your Java IDE of choice as described in the Writing a basic Extension document. Copy the content of the /source/server/src folder to your project's source folder.
Space Race was developed by A51 Integrated. You can download and read the developer's walk-through, which discusses the main SmartFoxServer 2X features implemented in the game and the techniques used to handle realtime user interaction.
» More resources
You can learn more about the involved SFS2X features by consulting the following resources: