I have a bit of a dilemma and wanted to get some other developers' opinions on it and maybe some guidance.
So I have created a 2D game for Android from the ground up, learning and re factoring as I went along. I did it for the experience, and have been proud of the results. I released it for free as ad supported with AdMob not really expecting much out of it, but curious to see what would happen.
Its been a few of months now since release, and it has become very popular (>250k downloads!). Additionally, the ad revenue is great and is driving me to make more good games and even allowing me to work less so that I can focus on my own works.
When I originally began working on the game, I was pretty new to concurrency and completely new to Android (had Java experience though). The standard advice I got for starting an Android game was to look at the sample games from Google (Snake, Lunar Lander, ...) so I did. In my opinion, these Android sample games from Google are decent to see in general what your code should look like, but not actually all that great to follow. This is because some of their features don't work (saving game state), the concurrency is both unexplained and cumbersome (there is no real separation between the game thread and the UI thread since they sync lock each other out all the time and the UI thread runs game thread code). This made it difficult for me as a newbie to concurrency to understand how it was organized and what was really running what code.
Here is my dilemma:
After spending this past few months slowly improving my code, I feel that it could be very beneficial to developers who are in the same position that I was in when I started. (Since it is not a complex game, but clearly coded in my opinion.)
I want to open up the source so that others can learn from it but don't want to lose my ad revenue stream, which, if I did open the source, I fear I would when people released versions with the ad stripped, or minor tweaks that would fragment my audience, etc.
I am a CS undergrad major in college and this money is giving me the freedom to work less at summer job, thus giving me the time and will to work on more of my own projects and improving my own skills while still paying the bills.
So what do I do? Open the source at personal sacrifice for the greater good, or keep it closed and be a sort of hypocritical supporter of open source?
One possibility is to do what several of the large game studios have done (ID software for example). That is, you release the game source code, but keep all the resources (graphics, sound, etc.) to yourself. That way, people can use your code to build their own games, but won't easily be able to duplicate it without a significant effort to recreate the resources...
There's nothing hypocritical about earning money from your work that you've spent time, effort and your own resources in getting done. Open-source doesn't mean that you have to let others take something that's yours or get a free ride. Otherwise, you might as well make your home open-source and let the thieves in. However, I think your actions may become muddier if you prevent others from earning their fair reward in the same way.
I say: Well done on your work and don't feel guilty about earning a living from it. If you wish to give something back to the community, it can take all kinds of forms, like helping others become better coders at StackOverflow.
Just my 0.02$: Keep the sources to yourself for now, to ensure you make enough money to sustain your next (big) project. When the downloads for the game start going down and not so many people are playing it anymore you can open source it. Sort of like how John Carmack did with Quake. This way, by the time other people start using your sources, you are already working on the next thing and retain your competitive advantage, but still offer something to the community, even if it's not from the first moment (better late than never).
Why not just make a blog in the name of your game, which is clearly very popular, telling people how you achieved certain effects and perhaps writings short tutorials (although you don't have to go to that much effort usually -- code speaks for itself).
This way you can share your work without sharing too much, while using the name of your game to explain explicitly how things may be done for the benefit of others.
Win-win, right?
There are a few options. One approach that could work might be to open-source the basic version of the game, while keeping the best features closed. Another is to dual-license the code, restricting commercial use.
The general options available are discussed in this related question: Making money with open source as a developer [1].
[1] http://stackoverflow.com/questions/196131/making-money-with-open-source-as-a-developerOpen-source is not necessarily about altruism. People will open-source a framework to get other people's support in improving it, while building their applications on top of that framework. People will open-source software just to get their name out there, which can reap financial rewards when looking for a job. I doubt many people open-source applications hoping that the karmic benefits will feed their families.