Handmade Hero»Forums»Code
Livet Ersomen Strøm
163 posts
What's the point of porting code?
Edited by Livet Ersomen Strøm on Reason: bcs i can:)
I'm not sure I understand why one wants to write portable code at all. I understand well the reason for having a layer, against the OS. Especially the Graphics layer, as there are so many to chose from, and they change "frequently". I could also understand why one want to prepare the code, for ease of porting. Since it isn't extremely hard work, once you have insulated the game code from the OS, which should be done, in any case. But why even think of anything beyond this until it becomes clear that the game, or project is a success?

Isn't that just wasteful?

Also, doesn't porting a game also limit the game? Because you may have different constrains on different hardware?
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
What's the point of porting code?
I'm not sure I understand the question exactly, but here are some things to think about - I hope they help clarify the reasoning behind cross-platform development!

For Handmade Hero specifically, it is mostly for educational purposes. I want to show people how to construct code that draws the right boundaries between the game and the system, because this is an important programming skill to master. So that is why we are doing it.

For games in general, though, cross-platform development is often crucial due to the realities of the marketplace. It is often the case that the business decisions for a game might not be made until half way through the development of the game, or more, and so the developers might not even know what their primary launch platforms are until the game is well underway! Being flexible, and making it easier to ship on multiple platforms at launch, can be very important to the financial success of a game.

If, for example, you are a Windows-only game, but Sony approaches you and says they will give you a bunch of marketing support if you launch simultaneously on PS4, that could be a very important opportunity for you if you are a small indie developer. Being able to say "yes" to things like that can make the difference between success and failure.

Similarly, supporting platforms that may not seem financially important for a game (Mac OS X and Linux, for example) can nonetheless be very important for smaller games. Smaller platforms often have vocal supporters and enthusiastic fans, so if you do something nice for them like shipping your game on their platforms, they may well help spread the word about your game and help support your project disproportionately to the size of the market on that platform. Being PC/Mac/Linux is also crucial for being on things like The Humble Bundle and other sorts of business opportunities that require 3-platform support for various philosophical or political reasons.

So, in summary, there's just a lot of reasons why cross-platform development makes sense for game developers, and if you design your code right, then it doesn't cost you that much to do.

- Casey
Livet Ersomen Strøm
163 posts
What's the point of porting code?
cmuratori


So, in summary, there's just a lot of reasons why cross-platform development makes sense for game developers, and if you design your code right, then it doesn't cost you that much to do.

- Casey


Thanks. Seems reasonable. (Although I couldn't say). And it really is cool to learn about whats needed to do it. So, education wise, I am enthusiastic. But if you're approached. Then the game already has traction. And then of course you port. But if it has not. Seem to me unneeded effort. And sources of bugs. And limitations too, perhaps. Due to platform differences. Smaller textures, less vertices, gpu and maybe other data differences, and so on. (something I read about). I mean in the general case. Gta V isn't coming for the pc before early 2015, I think. But I am aware of many who are willing to order the pc version. Even they already have it for the console. My point was in the general case. That the focus is on the game. But I see your points as well.

The question occured to me while reading this gamasutra article.
http://www.gamasutra.com/view/fea...dirty_game_development_tricks.php
Casey Brant
9 posts
What's the point of porting code?
I obviously can't speak for Casey, but you mention "in the general case", and in my experience it's just a good idea to isolate your own code from anything else that it touches. Even if you don't want to port a program to a different platform, if you have a lot of platform-specific API calls scattered around everywhere, you're going to have real problems if you have to adjust something about how you interact with that platform. Contrast that with isolating yourself, where if you want to change how you use the platform (or if god forbid the platform deprecates something out from under you), you have only one place to make the change.

It's just a good idea, for all sorts of programming, not just games.
Andrew Bromage
183 posts / 1 project
Research engineer, resident maths nerd (Erdős number 3).
What's the point of porting code?
As a general rule, portable code is better code. One of the best favours that you can do for performance is to use well-thought-out internal APIs. It means that if you find a performance issue, you can swap code in and out and there is a smaller chance that you will break anything.