System link networking in XNA Game Studio 2.0

System link networking in XNA Game Studio 2.0

Rate This
  • Comments 9

So, the 2.0 beta is out...

If you are wanting to try out our shiny new network API, you may be waiting to be emailed the code which unlocks access to Games for Windows - LIVE. But did you know:

  • If you just want to develop and test a network game, you can use a system link session with a local profile. No subscriptions or codes required. The code is only necessary when you want to play your finished game with someone else over the Internet.

  • This email-to-get-code process will not be necessary in the final version. You will still need a Creators Club subscription in order to use LIVE networking, but this will be checked automatically without any special codes.

Local profiles are easy and free to create. After you add the GamerServicesComponent to your game, just press the Home key to bring up the Guide, then create a new profile. When it asks if you want to join LIVE, cancel that screen. Tada! You now have a local profile, and you can make many of these on as many computers as you like.

Local profiles cannot create or join LIVE PlayerMatch sessions, but they work just fine for system link. I normally test my games using system link between my Xbox and PC, but if you have more than one computer you can use PC to PC system link as well.

If you have previously done LIVE programming using the native API, you are probably thinking "hmm, but system link and LIVE are pretty different. How is testing using one going to make sure my game works with the other?". The answer is that we did a lot of work in the XNA Framework to make sure system link and LIVE sessions will behave exactly the same. For instance we added some code in our system link session discovery layer which exactly emulates the behavior of the LIVE matchmaking servers.

In fact, you should only see three differences between system link and LIVE sessions:

  1. System link works with local profiles, while LIVE requires a Gold account and Creators Club subscription.
  2. System link only works over a local subnet, while LIVE works over the Internet.
  3. Because they are only exchanging packets over a local network, system link sessions will see very low latency and packet loss compared to playing over the Internet.

Difference #3 is the main thing that affects testing of your game, so we built in a solution for this, too:

    NetworkSession.SimulatedLatency = TimeSpan.FromMilliseconds(200); 
    NetworkSession.SimulatedPacketLoss = 0.1f;

This will simulate the worst network conditions you are likely to encounter out in the wilds of the Internet. Just make sure you remember to turn the simulation off when you finish testing!

  • I really like the packet loss simulation. Very usefull indeed!

  • "so we built in a solution for this"

    Are those properties only getters? I mean, say I want to put some more stress in the simulated environment. Yea, I know ... call me crazy ...

  • > Are those properties only getters?

    They're settable. Deliberately introducing artificial stress is exactly what they are for, in fact...

  • Shawn, I'm glad you guys are lucky enough to call 200ms latency the worst network conditions over the internet. Ever been to Africa? 200ms is a GREAT connection when you're talking about connecting to a server internationally. (Like the LIVE servers...)

    Anyways, Is there any limit to the SimulatedLatency?

  • Heh :-)

    I chose 200ms because that is the requirement that all commercial Xbox Live games must support gracefully. I guess the certification people picked that as a reasonable limit that the majority of gamers will come in under, although there are obviously going to be a few with worse connections. Many Xbox Live games are likely to run poorly or suffer dropped connections over slower links than that.

    No, there's no limit to the SimulatedLatency. In fact I have a unit test that delays packets by several minutes...

  • I was wondering if there are any solutions if you only have one computer with a decent graphics card. I actually had to upgrade my own computer to work with XNA which a dream framework for aspiring game developers.

    I was also very disappointed with the restriction of only being able to do pc<-->pc connection if you pay, which I guess I will do for this sorta thing.

    I also am loving Games for windows platform, it makes life so easy for managing profiles, I was also wondering a few things.

    - How do you detect if the guide button was pressed so you can your own things (pause, darken screen?)

    - How do you get the current player information (name, gamerpic, etc. etc.?)

    - Can you use the players gamerpic for ingame displaying?

  • I answered my last 3 questions, but I was still wondering about the first question.

    I must say I'm more excited about XNA currently then Halo 3 when it was released.

  • So if you want to have a client/server architecture where the server is on the internet, is that supported by XNA networking or do I have to use system.net?

    I also noticed na networking is limited to 31 users - doesn't seem very scalable.

    One another point, in a released game do players have to have a CC membership in additional to XBox Live to play game?

    In that case, I probably do my own networking and avoid XNA networking.

  • I'm thinking of making an MMO and that is definately something where networking can't be gimped. It's very important.

Page 1 of 1 (9 items)
Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post