Saturday, 16 April 2011

Code implementation for <H2>DirectPlay/XNA Networking</H2> is done in 8 steps:
1.Initialization :
It is the the simplest step in DirectPlay/XNA Networking.Here we initialize various objects,see the source code.

2.Enumeration of Service Providers:
Service Provider  allows DirectPlay to interact with other instances of itself on remote systems. The four standard service providers enable Serial Cable, Modem, IPX, and TCP/IP connections. Once the service providers have been enumerated, they can be displayed to the user in a variety of fashions, allowing for identification of the desired connection type.

3.Initializing a Connection:
Now initialize the connecction and report back on the success of operation.

4.Starting/Joining a Game :
Now what,our connection is ready?We can now continue by hosting a game or by joining a pre-hosted game.
The codes for "Host" a session and "Join" a session differs.
To host a game, we must create a "Session Object" and specify various parameters such as maximum number of players, and session title. To join a game, we must first list all available "Sessions" exposed by our game service provider  and allow the user to select the desired game to join.
These are quite clear from the source-code.

5.Creating a Player:
As the players join the game you hosted,you must create each player's ID which will be used during game play.
Player ID is defined by various parameters.See the code.

6.Commencing Gameplay:
Once all the player joined the game,the game starts by default or by user input.like there may be options like "Ready" then "Start Game" etc.
If we want the player to keep joining into the middle of a running game then keep enabled the session's Join property.For example "COUNTER-STRIKE".
If we want the player NOT TO join  into the middle of a running game then keep disable the session's Join property.For example "AGE OF EMPIRES".

7.In-Game Messaging:
Once the game starts,game starts to send messages to any or all of the players playing.
Here messages are positions of different players in world map,fire,chat and so on.

8.Termination :
When a player drops out of game or game is over,that player's session must be terminated.Otherwise the network messages will not be sent out to that player and
some errors may occur.

http://www.01fes.com/

No comments:

Post a Comment