Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Dev Talk] Ep 1: Cross-Platform Development  (Read 1605 times)

0 Members and 1 Guest are viewing this topic.
[Dev Talk] Ep 1: Cross-Platform Development
« on: March 18, 2012, 07:48:16 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Introduction
Dev Talk is a series of focused discussions related to various game development topics. In each weekly "episode," I will propose a topic and present an initial argument or statement, and hope to get an active discussion within the community regarding said topic. The point of these discussions is to encourage growth as both game developers and as a community.

Cross-Platform Development
Cross-platform development in the games industry has become the norm for game consoles, as simultaneous releases for the Xbox 360 and Playstation 3 are almost expected by gamers, with the main exception lying in first-party IPs (Mario, God of War, Halo). However, with the exception of a select few developers (such as Blizzard Entertainment), cross-platform development for various computer operating systems has never been the norm, and has only recently started to gain any traction within the games industry.

The point of this week's discussion is the value of cross-platform development (from marketing, development, idealogical, and all other points of view), the positive and negative aspects of managing cross-platform development, the requirements for handling cross-platform development, and all other issues related to cross-platform development. Note that it is not confined to multiple computer operating systems, but even to console-computer platforms and even those relegated only to the various game consoles.



Personally, I love the thought of cross-platform development. It provides an excellent challenge for the programmers implementing the game systems, with each platform having specific "best practices" and quirks that must be managed. The challenge is, ultimately, why I am attracted to game programming in the first place.

One example of best practices that I'd mentioned is how Mac OS handles application bundles. On Linux and Windows systems, applications tend to be a large set of files that aren't often self-contained, with sometimes large dependencies being spread across the operating system. Mac OS X, on the other hand, primarily contains applications within a self-contained "folder," called an App Bundle. For smaller games and applications, such as one might find in development by an independent game studio, all of the game's media files are contained within this bundle (often under AppName.app/Contents/Resources), and even the application's dependencies (often in the form of Frameworks on Apple systems) can be contained within this single file. This makes packaging and distribution incredibly simple in comparison with the necessary distribution and installation methods on Linux and Windows platforms (such as the installation of the Visual C Runtimes on Windows systems).

However, this creates some difficulty with regard to accessing resource files in code, such as when you need to load a specific texture or script file. Whereas in Windows and Linux systems, you can easily specify a relative directory from the binary itself, the directory structure of the App Bundle separates the binary file and the folder, creating platform-dependent code for locating the binary itself.

One manner that I used to overcome this is to implement a static Platform class, with a function to transform the relative filename based on its platform. A Mac OS X implementation of this is:

Code: C
  1.         std::string Platform::DataFile(const std::string& fileName)
  2.         {
  3.                 std::stringstream stream("");
  4.                 char path[PATH_MAX];                    // Will store the absolute directory to the Resources directory
  5.        
  6.                 // Obtain a reference to the main application bundle
  7.                 CFBundleRef mainBundle = CFBundleGetMainBundle();
  8.        
  9.                 // Grab the Resources directory
  10.                 CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
  11.        
  12.                 if(!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (unsigned char*)path, PATH_MAX))
  13.                 {
  14.                         std::cerr << "Error obtaining a file-system representation of the Resources URL!" << std::endl;
  15.                         return "";
  16.                 }
  17.                 CFRelease(resourcesURL);
  18.        
  19.                 stream << path << "/";
  20.        
  21.                 // Append the File URL
  22.                 stream << fileName;
  23.        
  24.                 return stream.str();
  25.         }
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.214 seconds with 37 queries.

anything