DirectX:DirectPlay:Tutorials:VB:DX7:Create a Player

From GPWiki
Jump to: navigation, search

Now that we've successfully started or joined a session, we must create a player within that session. When we do so, we will be returned a "PlayerID" which we will use as our identity later when we're sending messages and such.

Dim lngPlayerID as Long

   lngPlayerID = dp.CreatePlayer("Lucky", "Ryan Clark", 0, 0)

Here we've initialized a player on the current session, using "Lucky" as the player name and "Ryan Clark" as the formal name. The 3rd and 4th parameters can contain various flags, but in most cases they are not necessary.

Notice, we've stored the return value (the "PlayerID") so that it can be used at a later time. This is important!

This was a short one! Surely you have time to read Commencing Gameplay? (Click here to download this tutorial's source code.)