Multiple Cores, etc... on the 360

Hello everyone,

Like practically everyone here, I'm truly excited about the idea of being able to run my own games on the 360! I've long been interested in the concept of running my own code on a console and it's always annoyed me that systems needed to be locked down so heavily because of the pirates who spoil the fun for all of us. So I just want to say thanks to Microsoft for giving us hobbyist/one-guy game developers the chance to develop for the console like this! It's like my prayers have been answered!

Now for a couple of questions:

1) I'm just wondering how the multiple cores in the 360 will work Will the managed code automatically utilize all three (well, in effect, six) cores or will I be required to create multiple threads If the answer is the former, will I be given the option to manually control which processes, etc... are assigned to which cores (I won't be programming anything that will probably even need above one core, but I'm just curious).

2) It has been repeated many times that networking will not be supported on the 360, however, can I use the C#/Windows networking functions to have networking/multiplayer on the PC and just remove that support out when we compile for the 360, or will networking functionality be completely removed from XNA Just to further clarify, can I use any C# library with XNA Studio Express

Thanks in advance for any input you can provide!

David



Answer this question

Multiple Cores, etc... on the 360

  • Can-Ann

    By the way, since you were wondering--yes, any .NET library will work with XNA Game Studio Express if you're writing Windows games. As mentioned, the only catch is that you'll have to remove these from your Xbox 360 builds, since libraries like System.Net aren't available on the 360.
  • Matthew Lebo28574

    Yes, you can use conditional compilation (#if, etc.) to exclude code from your 360 builds. I don't recall offhand exactly what symbol will be defined, but you'll probably be doing something like "#if XBOX360". I should mention that you will need separate project files for the Windows and Xbox 360 versions of your game, but conditional compilation lets them include the same code files.
  • Bertrand Caillet

    @Kevin: can I use symbols/attributes to "remove" XP targeted code from the 360 build process I thinking about something like:

    #if WIN32 //just like "DEBUG" for Debug/release builds in VS NET

    // System.NET code here...

    #endif

    --or--

    [TargetPlatform(Win32)]

    // System.NET code here...

    thanx,


  • simon burgess

    Hello again,

    Thanks for all the responses! I skimmed through the article and it looks good although I'll definitely have to look into it more in-depth.

    It's good to hear that coders have some control over the threads and it's really good to hear that the System.Net libraries will work on Windows. I was afraid that multiplayer support wouldn't be available at all with XNA, even on the Windows platform.

    Thanks again for the answers!

    Best Regards,

    David


  • Bert666

    Mitch Walker wrote:
    Threading on the Xbox 360 will be extremely similar to the desktop CLR. It will be up to the developer to determine how best to use those threads.

    The 360 has 3 cores with 2 hardware threads in each

    Will there be any documentation regarding best practices to prevent L2 cache contention / flush, thread synchronization and locking on the 360 cpu architecture

    Will lock and volatile keywords work like they do on an x86 cpu

    Thanks,

    Roger Larsen


  • vic07

    Correct - 3 cores 2 hardware threads (HT) each.  Threads on the 360 have a hard affinity.  The xbox os scheduler only schedules the thread on a single HT.  We will be providing an API in the Thread class to explicity set the current thread's hard affinity.  Note - not all HTs will be available  for use by game devs.  Some may be reserved for future purposes. 

    MSDN will contain updated documentation that will spell out these details once XNA is released. In addition to all of the current documentation on MSDN, we will publish white papers as needed to address any 360 specific threading concerns. 

    For begginers, If you want to ramp up on multi-threaded programming, you can start with any of the existing documentation, coding against the .NET Framework on Windows or the .NET Compact Framework on Windows Mobile (smart phones and Pocket PC devices).  There are a bunch of books and online resources available for all.

    For lockless programming, Thread.MemoryBarrier will be exposed to enforce full data sync across cores. 

    "lock" (System.Monitor) and volatile keywords will function correctly.



  • Safar

    Threading on the Xbox 360 will be extremely similar to the desktop CLR. It will be up to the developer to determine how best to use those threads.

  • Jeff Bramwell

     

    I can not quote on the first question, but with the second Yes you can use the networking libs from system.net on the pc. Remember that you will have to remove these from systems when you publish using the express editions to the x360.



  • Rhubarb

    You might want to look into Microsoft's Concurrency and Coordination Runtime (CCR). "The CCR makes programming asynchronous behavior much simpler than the typical challenge of writing threaded code."

    For more information, there is a good article here... http://msdn.microsoft.com/msdnmag/issues/06/09/ConcurrentAffairs/

    I don't know if this will work with XNA Game Studio Express.


  • Multiple Cores, etc... on the 360