How To Share Your Code

Most people who post example code on forums don't mind if this code is copied, or even archived. Unfortunately, most of this code stays on the forum and is slowly covered up my new posts. This article will tell you what you need to know so that your code remains useful.

How To Share Your Code

Most of us amateur game programmers write code to be shared. Often, someone will ask for an example and we will write it without hesitation. Then, we post it to the forum where it is immediately useful to the person who asked for it. Someone else is going to need this code later when they ask for the same kind of example or ask the same kind of question. So why limit the use of your code to one thread on a forum? Codebases are important and they are built up by forum posts like these. They provide examples and answers for people who need them. Sadly, most of this code is going to waste and codebases are getting very, very rare.

101 BASIC Computer Games

Let's start by taking a look at 101 BASIC Computer Games. It's a book of basic code listings and reveals how much attitudes in the amateur game programming world have changed.

101 BASIC Computer Games is THE classic book of BASIC code listings. In fact, it could be the very first published ever as it was published in 1973 and the code included is mostly for large time-sharing systems. But when the issue of copyright is considered, 101 Basic Computer Games reveals much more than computer history.

This book comes from not only a golden age of computers and BASIC, but a golden age of copyright as well. In it, you will find many copyright violations, or "near copyright violations". The first is the use of many illustrations from MAD Magazine. There is no evidence in the book that David H. Ahl actually got permission. Instead, a policy of "fair use" is assumed and the illustrations are credited. However, since the images are used to illustrate the game code rather than critical review of the image itself or the artist who produced it, it doesn't fall under fair use. In short, David H. Ahl, the Stan Lee of amateur computing, simply "got away with it."

These are just the illustrations. The game code itself follows the same policy of "fair use abuse". Several popular, copyrighted board and dice games are included. Most notably Monopoly and Yahtzee. Another game is the classic Star Trek (SpaceWar) game that not only mentions it is a Star Trek game by name, but uses many trademarked names.

So what's the problem? If this book was published today, David H. Ahl, one of the greatest game programmers who ever lived, would have been sued into the poor house.

Since Then…

Since then much has changed. While we know that this kind of use of copyrighted materials is harmless, it nevertheless gives a company, if they so choose, the ability to sue your pants off. Whether they actually do it or not is solely up to them. Now, copyright has become much more strict and it seems everyone is looking to sue someone else, especially companies "protecting" their copyrights, and especially after Napster. We no longer have the freedom that Dave Ahl had. It's a shame too.

Back to Sharing Code

What does this all have to do with sharing code? Well, the most important thing is people consider copyright and securing proper permission. There are some people gleefully ignorant of copyright law and will copy your code anyway, however, most people will not touch it unless they are absolutely sure of two things :

  1. You meant for your code to be shared.
  2. You are likely to give your permission.

Some other people won't bother even asking, and then again, some of us who write code to be shared hate to be emailed constantly with permission requests. (Its fun at first, but gets old.) There is an easy way to make sure that

  1. Everyone knows your code is meant to be shared.
  2. They know that they have your permission to copy it and/or modify it without having to ask.

The Solution

The solution is a simple one : In your intro comments, where you put the title and your name, also put the permissions. There's two good ways to do this. Creative Commons and "Public Domain"

Creative Commons

I personally prefer a Creative Commons license and everything you see on the wiki is licensed under the Creative Commons Attribution 2.5 license. By using a creative commons license, you immediately let people know that your code is meant to be shared, archived, and modified. Here's an example :

' Big Bugs Squashathon
' by Shawn Hartnell
' available under the Creative Commons
' Attribution 2.5 License
' If you use it, please credit me somewhere.

Wha-la, your code lives forever. But what if you didn't even care if you got credit?

Public Domain

You can include "public domain" in your intro comments. This tells everyone that you really don't care what someone does with your code. Copy it, modify it, archive, it really doesn't matter to you. It was your pleasure just to write it and share it. Here's an example :

' Vampires Ahoy!
' by Shawn Hartnell
' Public Domain, do whatever you want.

There is a slight problem with Public Domain in the US. According to US copyright law, you cannot release something into the public domain even if you want to. According to the law, things just kind of slip into the public domain when it's copyright runs out. So technically, even if you use this, its not really public domain. Instead, it lets people know that you're not going to sue them.

page_revision: 2, last_edited: 1205818550|%e %b %Y, %H:%M %Z (%O ago)