Home arrow Java & J2EE arrow Page 4 - Gaming Development Setup

Using Open Source - Java

One important step in creating your own computer games is configuring your development environment. Keep reading to learn how. This article is taken from chapter one of Advanced Java Game Programming by David Wallace Croft (Apress, 2004; ISBN 1590591232).

TABLE OF CONTENTS:
  1. Gaming Development Setup
  2. Playing the Demo Online
  3. Introducing XML
  4. Using Open Source
  5. Finding Multimedia for Your Games
  6. Basics Example
  7. Generating an event
  8. Drawing the background and target
By: Apress Publishing
Rating: starstarstarstarstar / 33
March 02, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Hopefully by this point you have been able to compile and run the demonstration program successfully and are now ready to learn how to modify and incorporate the code library as described in the book to create your own games. Before you get too invested in the library, however, you should know the usage limitations and requirements.

Learning the Basics of Copyright

Copyright used to be a mystery to me until I did a little reading on the subject. Here are a few key basics I think every developer should know.

  • You do not need to put a copyright statement on your work nor file paperwork for it to be copyrighted. It is copyrighted automatically by the simple act of creation. Putting the copyright statement on your work and registering your copyright does help you when it comes to receiving damage awards for copyright infringement.

  • You no longer need to append “All rights reserved” to your copyright statement. The law changed and it is now assumed.

  • If you are an employee, your employer is the copyright holder of works you create on the job by default. If you are an independent contractor, you are the copyright holder by default unless your contract states otherwise. Your contract almost always states otherwise unless you drafted the contract yourself.

  • If you create a work with someone else, then you both own the copyright jointly unless an agreement states otherwise. Use and distribution requires unanimous consent and you must share profits from such a work.

  • It is possible to create a contract where the work is owned jointly without accountability. In this case, each copyright holder can use the work without accounting to the other. It is as though they each own the copyright independently and do not need to share profits or seek mutual permission. This might be a useful arrangement if you are teaming with others to create a game for your portfolio instead of for profit.

  • A copyright holder has the exclusive right to use, distribute, and modify the work. If you create a work that incorporates a work by someone else, either in whole or in part, you have created a derivative work. You must have the permission of the copyright holder of the original work in order to create a derivative work legally.

  • Copyright law makes an exception for fair use of a work. This means that under certain circumstances you can use a work without the permission of the copyright holder. This is limited to just a few enumerated uses such as parody, teaching, critical review, and news. There are land mines in the Fair Use doctrine so beware. In general, you should not rely upon Fair Use to incorporate material into your game.

  • Works created by the government are not entitled to copyright. This is why the space pictures taken by NASA are in the Public Domain. If you are creating a science fiction game that requires images of stars, planets, space shuttles, rockets, and astronauts, you are in luck. See http://gimp-savvy.com/PHOTO-ARCHIVE/ for a collection of Public Domain space photos you can use in your games.

  • A license is a grant of permission by a copyright holder to use a work. Licenses come in all shapes and sizes. Some are exclusive, meaning that the licensee is the only one who can use the work, and some are nonexclusive, meaning that many can use the work simultaneously. If you grant an exclusive license to your game to someone for a limited time, you retain the copyright but you cannot allow someone else to use the game during that period.

  • A common misperception is that if something is on the Web and it does not have a copyright statement on it, it is in the Public Domain and can be used without permission and without attribution. This is simply wrong. In general, unless you read something from the copyright holder that explicitly states otherwise, you cannot use it.

My favorite book on this subject is Web & Software Development: A Legal Guide by Stephen Fishman (Nolo Press, 2002). Nolo Press is the publisher of a number of extremely useful self-help legal books. I recommend that you read a book on copyright law at least once early on in your career. It is critical to understanding your employee agreements, your client contracts, and incorporating Open Source software.

Choosing a License

The example game code is licensed to you under the terms of an Open Source license. An Open Source license grants you the right to use and modify the source code to create your own games for free. It usually also places restrictions on your ability to sue the creator of the Open Source code for damages if something goes awry. These days, most of the code underlying the Internet infrastructure is distributed under the terms of an Open Source license.

While not officially a trademark, Open Source usually refers exclusively to code distributed under the terms of one of the licenses approved by the organization known as the Open Source Initiative (OSI). You can find a list of these approved licenses as well as additional information on the theory behind Open Source at the OSI web site.(1)

Some Open Source licenses are considered viral in that they are said to infect your program if you incorporate any of the code licensed under their terms in your game. In this case, you must also release your entire game code— the larger work—under the same licensing terms. The idea is that no one can benefit from the use of this free software unless they are also willing to share their enhancements and contributions. Developers might use non-viral licenses, on the other hand, in a program where different parts of the code are distributed under different licensing terms, including closed source commercial.

The reusable game code library and example games are available under the terms of both viral and non-viral Open Source licenses. Look in the license subdirectory of the code distribution for the different licenses you can use. Which license you choose is at your discretion based upon your needs and preferences but you must choose one if you are to use the code at all.

If you are undecided, I recommend the Academic Free License (AFL) version

2.0 by Lawrence E. Rosen. It is possibly the least restrictive. For example, it is non-viral so you have the option of incorporating it into a closed source commercial release of your game. Other choices include the Open Software License (OSL), the GNU General Public License (GPL), and the GNU Lesser GPL (LGPL).

My Cool Game v1.0
Copyright 2004 John Doe.

Portions Copyright 2003 CroftSoft Inc.
Licensed under the Academic Free License version 2.0
http://www.croftsoft.com/

Note that most, if not all, Open Source licenses require that you maintain the attribution and copyright notice for any included or modified code. If you print something like the preceding code to System.out in the background whenever your game starts up, that is good enough for me.

Renaming Modified Code

If you modify one of the files in the game library, I request that you change the package name so the modified class is no longer in the com.croftsoft package hierarchy. The general rule is that you should use your unique domain name reversed for the beginning of your package prefix to prevent naming conflicts. For example, my domain name is croftsoft.com, so the universally unique package name prefix is com.croftsoft.

If you do not have your own domain name you can use, you should consider getting one. Domain name registration now costs as little as $8.95 per year from registrars such as Go Daddy Software.(2) Hosting for your web pages and applets is less than $8 per month from some providers. If you want the domain name but do not want to pay for the web hosting, you can use the domain forwarding service from your name registrar to redirect visitors to the personal web page that comes free with your Internet Service Provider (ISP) account.

I also ask, but do not require, that you retain my name in the modified source code files as one of the authors as indicated by the @author javadoc comment. Each time a new contributor modifies the file, the list of @author tags should grow.

Sharing the Source

In addition to the CroftSoft Code Library, you might find source code suitable for your game development needs from an Open Source repository. The Open Source repository SourceForge.net, for example, is host to a number of different Java game programming projects.(3) In addition to finer categorizations, it organizes the code by foundry such as the Gaming Foundry and the Java Foundry. Look for projects within the intersection of these two sections.

FreshMeat.net has an impressive search-filtering function that allows you, for example, to look for projects that use an OSI-approved Open Source license, use the Java programming language, and have the word “game” in the description. This search includes projects at other sites such as SourceForge.net.

Sun Microsystems has recently launched the “Java Games and Game Technologies Projects” web site which is starting to attract some Open Source contri-butions.(4) I hope this will become the future center for this type of code, in effect serving as what would be called a “Java Gaming Foundry” if it existed on SourceForge.net. SourceForge.net might continue to dominate, however, as it is much less restrictive as to what projects can be created and how they can be organized.

The Game Developers Java Users Group (GameJUG) has an electronic mailing list, gamejug-open, specifically for the discussion of Open Source Java game development efforts.(5) I recommend that you subscribe to one or more of the GameJUG mailing lists such as gamejug-announce and gamejug-news. As GameJUG volunteers, I and others frequently post useful information and links about the Java game programming industry that you might not find anywhere else. 

This article is excerpted from MAdvanced Java Game Programming by David Wallace Croft (Apress, 2004; ISBN 1590591232). Check it out at your favorite bookstore today. Buy this book now.



 
 
>>> More Java & J2EE Articles          >>> More By Apress Publishing
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: