In modern game design, which parts of the game are written to be portable?

Say you are a big company and create a huge blockbuster title that will target PC, Mac, Xbox, and PS3. And let them say that you have chosen C ++, as most studios do. What parts do you write to be portable? Can you really write a portable game? Do I need to rewrite the rendering engine and user interface if you upgrade to a new platform?

+4
source share
4 answers

It is clear that everything except hardware-dependent code is written as portable. That is, game logic, vector graphics, sounds (?) Are (quite) portable, graphic outputs, memory management, timing (always).

With a good selection of libraries, you can probably increase the number of portable code.

+2
source

You cannot ask your players to use the 360 ​​controller.

The resulting and user interface should be redone from scratch, at least. In addition, it is likely that other OS-dependent features, such as networking, should be reformed. After all, boost::asio probably doesn't work on PS3. Some other processor-specific things like vectorization

However, ideally, the game would use as much portable code as possible.

+1
source

As a rule, I assume that there is a physical engine that will be portable. There would also be gaming systems such as health, inventory, NPC behavior, etc. Would be platform independent. Most likely, you will have to rewrite the rendering mechanism depending on which console the game is intended for. User interaction can be slightly rewritten due to the need to interact with another controller, which is likely to be available differently in each console.

In general, if the code interacts with the console API, rendering, vectorization, user interface, input, etc. must be rewritten. Basic code, such as physics, basic behavior, Ai, and stockpile management, doesn't really need to be rewritten.

So, at the end: If it depends on the equipment, it will need to be rewritten or reorganized.

+1
source

Following the DRY principle, it also leads to more portable code, since any portable code is localized.

For example, avoid doing this several times in code:

 #if defined(PC) // create a network connection PC-style #elif defined(XBOX) // create a network connection XBox-style #elif defined(MAC) // create a network connection Mac-style #elif defined(PS3) // create a network connection PS3-style #endif 

and instead do it once and create a function

 createNetworkConnection(); 

which you use in several places.

+1
source

All Articles