• Advertisement

Archived

This topic is now archived and is closed to further replies.

Why make portable game code?

This topic is 5026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why waste time and effort on making portable code, if you know that it won''t be used on any other platform? I mean, the market for linux games for instance is so small compared to windows.

Share this post


Link to post
Share on other sites
Advertisement
why not making portable code, when it''s so easy?
if everybody thought like you there wouldn''t be games for linux at all, so...

Share this post


Link to post
Share on other sites
quote:
Original post by DarkZoulz
Why waste time and effort on making portable code, if you know that it won''t be used on any other platform?
If you really, really know that it won''t be used on any other platform, then there''s no reason. But, not making portable code more or less guarantees that it won''t be used on any other platform...
quote:
Original post by DarkZoulz I mean, the market for linux games for instance is so small compared to windows.
True, but it''s still a market, and all sold copies are money. And if you easily can make the code portable, then maybe it''s worth it.

Share this post


Link to post
Share on other sites
quote:

True, but it''s still a market, and all sold copies are money. And if you easily can make the code portable, then maybe it''s worth it.



I doubt very much that a game producer would ever consider releasing a game for linux, because it is such a small market. They are only instrested in the money. Have you ever seen a copy of a linux game in a store? I haven''t.

Using standard functions that work on all platforms is ok, but actually laying down effort and time into making the game work on linux, i think is a waste of time that could have been spent more wisely. =) My oppinion. At least now, when windows is the dominant platform for games.

(ps. i''m not at all a linux-hater. I''m sure games run great on linux and it''s great for servers etc. I''m just looking at things from a market point of view.)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Actually I''ve seen both UT2003 and UT2004 on sale in shops for Linux. It''s just they''re on the same DVD as the windows version. Which means if you''ve brought either of these games you''ve also brought the Linux version :-)

Share this post


Link to post
Share on other sites
Its interesting this. For those commercial games I have been involved in that have been on more than one platform very little of the code has been shared. e.g. one game was on the PC and PS1 and so none of the graphics could be shared, none of the physics (no floating point unit on ps1 so fixed point maths instead). However modern consoles are more powerful and so I would expect you could share at least the game logic code between platforms.

If you think about a game generally it is in 3 levels. The top level is game specific code, the middle is game generic code and the bottom is hardware specific code. So in an ideal world a new game would just require the top level changing, the same game on a different platform would just require the bottom level changing. The middle is your generic game engine. You would hope that some of the top two layers could be portable.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
DarkZoulz its people like you that ensure the linux market stays so small

Share this post


Link to post
Share on other sites
Platform is such an arbitrary restriction. Writing portable code is not much more of an effort, its just another thing to consider when you are programming. Sure you may want to use a platform specific API, but it is still a good idea to abstract it. You may want to replace it with the successor to that API in the future, even on the same platform.

There are many more potential platforms than Windows and Linux, especially if you are working in games. And there will be more in the future. Writing API / platform specific code when a little care could make it more generic will often make life harder in the future, since portable & reusable are often the same thing.

Share this post


Link to post
Share on other sites
Indie/Shareware games tend to be a better market for cross-platform games. With a little extra effort you can reach a whole bunch of extra people. And while the linux market may be less willing to actually pay for software, Mac users are badly starved of good games.

Share this post


Link to post
Share on other sites
In my engine which by the time I stopped making it was around 5,000 lines, I bet I had less than 200 lines of platform specific code, including the #ifdef''s and everything else. So really the issue is, are you just too lazy to google for the right function on linux. Often times, you don''t have to make huge changes in your code: for example, in my dynamic library code, linux has the same set of stuff as windows (different data types, but the size of the data types were the same).

Share this post


Link to post
Share on other sites
I just like the thought of taking my code for Win32, recompiling it on a linux box, and it running perfectly. Granted, with Delphi/Kylix its a tad easier with minimal $IFDEF usage, but the point still remains

"You are in a room. You can see a cow."
">look at cow"
"It is a cow."

.:Cubicle2:.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if you use decent APIs & libraries such as OpenGL and SDL, making portable code is a doddle.

Share this post


Link to post
Share on other sites
quote:
Original post by DarkZoulz
I mean, the market for linux games for instance is so small compared to windows.


Anyone who releases a game for Linux instantly corners the market, *because* it''s so small. Similar story with MacOS. You''ve just got no competition.

Share this post


Link to post
Share on other sites
quote:
Original post by superpig
Anyone who releases a game for Linux instantly corners the market, *because* it''s so small. Similar story with MacOS. You''ve just got no competition.


PC gaming is changing its form due to the consoles. Consoles itself are a very good reason to write portable code, another reason is to write code that is appropriate for your paradigm. Standard C code syntax itself is crossplatform. If you use non-standardized code, you are also using gimmick hacks and bad style. It is quite surprising that original ideas behind C was platform intependent code.

Now back to how PC gaming is changing... The real market is the concoles and to tell the truth PC games are somewhat dying away. There are hardly any innovative PC games in the market, and those that are come from eastern european / russian companies that are more independent(but economically as restricted) of the publishers than western companies.

Thus if you aim for giantic market, which is the marignal of gamedevers (95% people here are hobbyists who fiddle around and cut and paste source code, as far as I see) and about 5% and even less are original content creators.

On the other hand, people are buying more and more Macs, because they are more reliable than PCs and are not as vulrnable to spyware and malware (which are inevitable result of market driven application development and soon on apple machines, too).

Of course the genration of windows desktop ricers, the main population of gamedev, prefers the illusion of strong background support, which is found from Microsoft products. So, by saying "Fuck open source, fuck platform-independency, DirectX for life, C#/C++/Java for life" you are committing to monovision and platform dependency.

On the other side you have open source. Not just any open source, but GNU open source.

Open source is ideology and far more benefical in all situations where the intention is not bare profit. In this message I have proved that "profit" and giantic market is way out of the hands of average teenage programming fiddler whose blatant insecurities about his choice programming language make him change between cross-platform support (read C#) and efficiency (read C++) in about once a week.

If you can identify with this, I''m afraid to tell you that real game development is way out of your hands and that you have two options.

You can either learn and choose open source or you can stick with DirectX and C# and have wet dreams about being game programmer.

Share this post


Link to post
Share on other sites
What a strange email Goatsie I have worked in the games industry as a programmer and let me tell you a lot of hobbyists on here are not that different in skill and knowledge than those who do it full time. In fact when you are working in games you get little time to actually explore new ideas - one of the reasons I left the industry. I can now go much deaper into things than just sit at a desk typing for 12 hours a day!

Anyway I have gone off topic. Some of what you say is sensible, certainly about console development being where the big money is at the moment. However how much code in a game could be shared between GameCube, XBox and PS2 ? OpenGL is no good to you here - you have to work with the manufacturer''s APIs. Some game code could be shared but memory size problems may arise and for PS2 you have to work hard to get most out of the vector units. GameCube memory is split awkwardly which can cause issues. So how much code could be shared? I don''t know but I would expect perhaps 40%? Interested if anyone who has created a game for these 3 platforms could comment?

Share this post


Link to post
Share on other sites
Well, I am working on a game and I think that by making a game for Win, Mac and Unix, when it does not take that much time and the market gets bigger, is quite a good idea.

/Alex

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
if you use decent APIs & libraries such as OpenGL and SDL, making portable code is a doddle.


Then again you could use DirectX and target PC and XBox. There''s a much bigger market for XBox games than Linux.

Games made professionally are more likely to use an in-house engine to handle multi-platform games and it''ll be well planned out which platforms to target. Time is always an issue and code is rarely 100% portable. You don''t want to go spending time on a platform that simply won''t get the sales. PC / XBox / PS2 / GameCube, all sell games really well. Linux doesn''t. Unless more people use linux instead of Windows it won''t get the games. Then again, if it doesn''t get the games people won''t start using it.

Share this post


Link to post
Share on other sites
Portable code is always the way to go.

What if you develop your game in DirectX, and then decide to switch it over to use OpenGL? You gotta write code that will make that switch as less painful as possible.

Also, just because something "works", doesn''t mean its good. You gotta code to specifications. For example sometimes functions don''t do what they are meant to do, such as function "free" may be completely ok if you pass it NULL in one compiler, and may blow up if you pass it NULL in another compiler. So you gotta look over function specification - not just test that whatever you did works, and assume that other compilers, or other version of same compiler will continue to support nonsense.

Another reason to write portable code, is if you want to comeback to the project in a few years, the OS of choice may have changed, you might find that you want to re-develop the game for Linux.

Yet one more reason is that lets say you have some code in C++, and now you want to compile same program with C#, you would be better off if you designed the code in the beginning in a generic way, not assuming you will always have C++ compiling it.
You might want to compile this code in C, downgrading from C++, and loosing lots of power - or what I like to call crazyness - so don''t code in a language-specific way.


http://www.anywherenotes.com - never lose another note again.

Share this post


Link to post
Share on other sites
Because that''s a skill that might get you a job one day?

Share this post


Link to post
Share on other sites
What if you want to cash in 10 years from now (like Nintendo does)?????

If your code is portable, and modular, you can just rewrite a few specific pieces of code, and your game should run on that new platform. It''ll be like free money.

If your code has platform specific code strewn throughout it, it''ll be a lot of work to make it work on the new platform, which will cost you money.

Share this post


Link to post
Share on other sites

> I doubt very much that a game producer would ever consider releasing a game for linux, because it is such a small market.

Our game runs fine under both Linux and Windows. Our customers can use whichever version they prefer. About 10% of them choose Linux.

If we were to eliminate the Linux version, probably about half of our Linux users would switch to the Windows version, and the other half would just walk away.

I wouldn''t want to lose 5% of my customers. I mean, I know 5% doesn''t sound like a lot, but profit margins are thin these days.

It didn''t cost me much to make the Linux version. Really, all I had to do was:

1. Choose OpenGL over Direct3D (pretty much equivalent anyway)
2. Choose FMOD over Miles (again, pretty much equivalent)
3. Choose Cal3D over Granny (saved me some money, actually)

Since all of those work under Linux, there wasn''t much work involved in "porting" it... actually, it took me less than 48 hours.

Share this post


Link to post
Share on other sites
There are companies that port games to Linux and Mac. Games like Jagged Alliance 2 have succesfully been ported, and the result is sometimes faster/less-buggier than the first game. Send them the source code and down, then royalties as it racks up sales.

Share this post


Link to post
Share on other sites
The question isn''t "why?", it''s "why not?" Since I started using SDL/OpenGL/OpenAL (I''ve always programmed as close to "ANSI C" as possible), porting one of our games to Mac has become a one day operation with no particular effort on my part. In my opinion, these libraries are easier to use than DirectX anyway, so I''d use them even if portability wasn''t a consideration.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
DarkZoulz its people like you that ensure the linux market stays so small
No, because people like him aren''t publishing anything.

It''s Linux users who don''t put their money where their mouth is that keep the market small.

Portability has its pros and cons. Combined with smart marketing, you can make supporting an additional platform a minor expense such that moving a few thousand units breaks even.

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi
It''s Linux users who don''t put their money where their mouth is that keep the market small.



If I had the option of buying a Linux version or a Windows version I would buy the Linux version. There is a problem with this, however: This assumes I was going to buy the game in the first place. Which, as things are these days, I probably wasn''t.

My point is, if the Linux version is there and I was thinking of getting the game anyway, I would get the Linux version. But if there is only a Windows version, I would seriously consider not getting it. It matters less the fact that it runs on Linux than it''s a game that I want.

So what would you have us do? Buy every Linux game out there just to build the market?

Image loads when I''m online.The following statement is true. The previous statement is false.
Shameless promotion:
FreePop: The GPL Populous II clone.

Share this post


Link to post
Share on other sites

  • Advertisement