Shawn Hargreaves Blog
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:
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:
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?
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.