How can I find out about developing a cross-platform game?

How can companies such as Valve release games on all three major gaming platforms? I'm interested in the best code-sharing practices between Windows, Xbox360, and PS3, because the ideal solution is to reuse as much code as possible, rather than re-writing all of this for each platform.

+6
windows xbox360 ps3
source share
7 answers

This is no different than writing platform-independent code in other contexts. Hide platform-specific details (input, window interaction, main event loop, threads, etc.) Behind universal interfaces and regularly check all the platforms that you intend to support.

Note that the cell stream model is unusual enough to make threads "in general." I’m not an employee of Valve, and I don’t know any of their secrets, but I understand that most game developers who want to target PS3 use a job queue in which individual cell processors capture tasks as needed. This is not necessarily the best way to use Cell, but it perfectly complements the more traditional streaming models (like frex, the one that uses PCs and 360s).

+6
source share

There are tons of game developer magazine articles and GDC discussions on the subject. In fact, since you mentioned Valve, they talked about their approach in GDC08.

This is a really huge topic that I could (and have) talked about for hours, but a lift summary:

  • Determine which parts of the engine are completely platform dependent and place them behind an abstraction. For example, file and asset downloads should be overwritten for each console; but you can hide it behind the IFileSystem interface, which provides a single API that the game code talks to.
  • PS3 makes this difficult because its abstraction point must be somewhere completely different from other platforms. Even game features like collisions and nav have to be written differently for Cell.
  • Try to save the code of the playing field (entity, AI, sim) as much as possible platform agents ...
  • But accept that even the most deciduous game code will sometimes require platform-specific #ifdefs for performance or memory or TCR reasons. Many user interfaces will have to be rewritten, as manufacturers have conflicting certification requirements.
  • Anyone who says the words “I'm not worried about performance” or “memory is not a problem” should not be on the payroll.
+4
source share

This question can be divided into two separate questions. "How to write portable code?" and "What are the diverging requirements of major gaming platforms?"

The first question is relatively easy to answer. Recommendations for abstracting your non-portable code are described in the “Portable Code Record” article: http://books.google.ca/books?id=4VOKcEAPPO0C&printsec=frontcover

Turning theory into practice, the Quake 3 source code does a pretty good job of dividing the various platforms into separate areas for the C code base, available at http://www.idsoftware.com/business/techdownloads/ However, it does not show C + templates +, such as abstract interfaces implemented once per platform.

The second part of your question: "What are the diverging requirements of the main gaming platforms?" is tougher. However, it is noteworthy that your biggest areas of change are still your renderer, your audio subsystem, and your network.

Each console platform has a number of certification requirements, available by agreement with the owners of the respective consoles. Requirements lead to consistency in user experience and are not focused on gameplay or high-quality quality problems. For example, your game may need to display a rather interesting animated loading screen, and black screens are unacceptable.

Grab this documentation as soon as possible to make the right choice when designing for a specific console.

Finally, if you cannot access the devkit console, I suggest you port your code to a Mac from Windows. The Mac provides you with an OS port that ensures that you are not tied to Windows, as well as to the processor port, if you support universal binaries. This ensures that your code is not an agent.

If you support both PC and Mac, you will have good opportunities to support the third platform if you get access to it in the future.

Addendum You wrote:

the ideal solution is to reuse as soon as possible, instead of rewriting everything for each platform

In many game porting scenarios, the ideal solution is not to reuse as much code as possible, but to create the optimal code for each platform. The code can be reused between projects and is relatively inexpensive compared to the content that the engine uses. A more reasonable goal is to focus on the lowest common denominator content that works on all platforms unchanged (the build phase that packs the content for the media is fine).

+3
source share

Good to do simultaneous development. You will find all kinds of errors that you will not find using only one platform.

I remember that programmers in DOS always had pointers to zero, because writing to low memory did not immediately lead to their collapse. When you ported Amiga, Atari ST or Macintosh, boom! I remember telling the DOS programmer that he had several null pointers to a deferred game. He thought for a couple of seconds and grinned: "This explains a few things."

Now that the games have such large budgets, it is important to send them at the same time so as not to spend money on marketing and advertising budgets.

My advice for concurrent development is to choose one leading platform, but never let other platforms get more than a week ago. This will become apparent as you program which parts of the code are common to all platforms and which are different. Extract differences in one or more areas of the platform.

My experience in C / C ++. This is a big problem if you have to port to different languages ​​(like Java and Objective-c).

+3
source share

A few years ago, the CEO of Opera said in an interview that the key to developing for independent platforms is the transition from any OS / platform libraries. He continued and said that they had developed their own libraries that improve OS performance.

I believe that large companies will have common, Xbox, PS, Windows, FooOS, separate teams. Each platform must be modified in different ways and requires different implementation methods. I do not think that they make one source for all platforms; rather, they build one for each OS, thereby increasing efficiency. I remember what EA used to release some console games earlier than PC versions and vice versa.

Another problem is that different consoles have different hardware, so different programming methods are required.

There are two extremes: build one source that suits everyone (for example, java), but you risk inefficiency or write 40 versions; one optimized for each platform

+2
source share

Back when I had a friend in educational computer games (before the Learning Company gutted the field), he was a big fan of creating cross-platform libraries for everything.

This is easier for games than for other applications. For example, if you have a word processing application for Mac and Windows, it really needs to look and behave like a Mac application on a Mac and a Windows application on Windows. Write a game, and it should not correspond to behavior, appearance and feeling.

+1
source share

If you need open source examples, you can check out the source code for Quake engines 1, 2, and 3. They are structured fairly portable. (Of course, ps3 or xbox360 support is not supported, but the same principles apply)

http://www.idsoftware.com/business/techdownloads/

+1
source share

All Articles