There’s actually some really interesting philosophy about making money with free software; in fact, one of the definitions of free software is you have the right to sell your work. The majority of free software projects are build to be free software from the ground-up, and most commercial projects were designed to be sold. But as Richard Stallman says: “You either control your software, or the software controls you”, no matter how benign the software is.
Open-sourcing your work doesn’t mean you give up control over it, and you still have absolute authority over everything that goes on in it. What it does though is basically outsources the boring work of debugging and fixing stupid issues to the Internet. It’s like having your own army of helper monkeys while you’re the dictator that determines who and who can’t contribute.
It also allows your work to be included in games compilations, Linux distribution libraries, and by the desperate free software press who is usually stuck reviewing the same programs that have existed for twenty years. A happy consequence is it allows your work to be known for much, much longer than any proprietary software. If you’ve heard of Dungeon Crawl: Stone Soup, Nethack, or games emulators like Dolphin, you’ll know these are all massively popular free software applications. Even the Quake engine is free software, allowing it to be relevant and used for decades after!
Licenses range from monstrously dense (Gnu GPL) to as simple as it gets (MIT). Even if some aspects of your game is copyrighted, you can still apply a license to the work and make everything else under that license, as you’re disclaimed from finding the appropriate “rights” in order to put copyrighted work under such. It’s something you should do as early as your first public release, so that people can start contributing on the very first day.
If you want your game to be copylefted, E.G. all distributions must have their source code released, then the GPL is universally known as such, though nobody understands it. For the only restriction being attribution, try the MIT Expat license, though you still have to enforce the thing for it to be effective and it’s practically impossible to know if anybody has used your code in proprietary software. If you want to save yourself any and all legal troubles and obligations, existing in Copyright Nirvana, use the public-domain dedicator CC0. An exhaustive list of licenses is at https://www.gnu.org/licenses/license-list.html .
Personally, I consider any notion of copyright to be a cultural cancer that damages everything it touches, putting the wants of the individual against the rights of the majority. It kills ideas before they even form, forces artists to self-censor out of fear they’re violating the law, and allows businesses and artists sweeping powers to sue, censor, and imprison anybody who uses any copyrighted material, including those which can be infinitely reproduced for free and forever and as such are economically worthless.
That’s why I dedicate all my work into the public domain; as the Degenerates say, “the less laws in our lives, the better”. It’s a matter of moral integrity, you see, because the only way to stop yourself from doing harm is to not have the capacity to do harm. CC0 is also simple to understand, even by people without a legal background. For a better formatted version, you can use mine at https://kratzen.neocities.org/copying.html , minus everything before “Statement of Purpose”.
If you publish your game commercially and make lots of money, you’ll have the honour of being the world’s first commercially-viable public domain video game. Unless you publish it on Steam with DRM, then it won’t really be free at all. Everything that you can’t legally license under CC0 will still apply under their respective licenses, and it’s up to the audience to seek those out, and to you to comply with them.