Changing the recipe
An introduction to basic game mod’ing
Download the whole article as PDF
- 2006-07-13
- Published on web | Intermediate
-
Write a full post in response to this!
This content was sponsored by:
There is a tradition amongst computer game aficionados which may be little known to people accustomed to proprietary games. This activity is called mod’ing—making small changes to a game to customize the play experience. Without a game’s source code, such changes are extremely difficult to implement. Games licensed as free software, on the other hand, are quite amenable to mods. This article presents two example mods for single-player games and proceeds to discuss mod’ing in general.
It may be news to you that it is usually easy to tinker with the source code for games
If you haven’t done much programming then it may be news to you that it is usually easy to tinker with the source code for games. Typically there are a few crucial variables like score and powerup. There is a main loop which reads keyboard and mouse events. Adding a special cheat key and recompiling can entail as little time as an hour or two.
It may sound impractical for mere reflex gamers to make source code changes for cheat keys and the like. Examine the following examples to decide whether you’ll need any help.
Mods for single-player games
Before jumping into source code, understand that most software is developed through independent projects. Gathering all these projects and making them work together is the primary motive of distributions like Red Hat, Gentoo, and Debian. If you use the packaging tools which come with your distribution then you will have an easier time because the myriad of integration problems are already solved. I use the Debian toolset here.
# Some preparation: apt-src automates the process of
# downloading source code. We'll keep track of our
# changes with GIT, just like the pros.
#
$ apt-get install apt-src git-core
# You may have to add a deb-src line to your
# /etc/apt/sources.list.
#
$ apt-src install gnome-games
# This tutorial uses version 2.12.3. Other versions
# hopefully differ little.
#
$ cd gnome-games-*
# Take a snapshot of the original version.
#
$ git init-db
$ git add .
$ git repo-config user.name "John Doe" # your name here
$ git commit -m original
# Edit the code such that git diff show the following
# changes. Add lines prefixed with plus and remove
# lines prefixed with minus. It's probably OK if the
# line numbers turn out slightly different.
#
$ git diff
--- a/gnometris/blockops.h
+++ b/gnometris/blockops.h
@@ -44,10 +44,10 @@ public:
GnomeCanvasItem *generateItem(int x, int y, ..
const Block * const getFieldAt(int x, int y) ..
+ void eliminateLine(int l);
private:
bool blockOkHere(int x, int y, int b, int r);
- void eliminateLine(int l);
Block **field;
bool field_initialized;
Field *fieldDisplay;
--- a/gnometris/tetris.cpp
+++ b/gnometris/tetris.cpp
@@ -1132,6 +1132,10 @@ Tetris::keyReleaseHandler ..
} else if (keyval == t->moveDrop) {
t->dropBlock = false;
res = TRUE;
+ } else if (keyval == 'c') {
+ t->ops->putBlockInField(true);
+ t->ops->eliminateLine(LINES-1);
+ t->ops->putBlockInField(false);
}
return res;
# Build a new deb package with your mod. This can take
# a long time depending on the speed of your machine.
# You need about 100M of free disk space.
#
$ dpkg-buildpackage -b -uc -rfakeroot
# If all goes well, install it on your box.
#
$ su -c 'dpkg -i ../gnome-games*.deb'
Write a full post in response to this!
Similar articles
Do you like this post?
Vote for it!
Copyright information
Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved.
Biography
Joshua Pritikin: Joshua is an aspiring researcher in evolutionary anthropology. To participate in his research, visit http://shared1.openheartlogic.org
- Login or register to post comments
- 4563 reads
- Printer friendly version (unavailable!)




Best voted contents
-
Google App Engine: Is it evil?
Terry Hancock, 2008-04-24 -
The Bizarre Cathedral - 3
Ryan Cartwright, 2008-05-05 -
Free Software Magazine Awards 2008
Tony Mobily, 2008-04-22 -
The Bizarre Cathedral - 2
Ryan Cartwright, 2008-04-27
Similar entries
Buzz authors
All news
From the FSM staff...
- The Top 10 Everything (Dave). The good, the bad and the ugly.
- Free Software news (Dave & Bridget). A site about short stories and writing.
- Book Reviews: Illiterarty (Bridget). Book reviews, blogs, and short stories.
Hot topics - last 60 days
-
Installing an all-in-one printer device in Debian
Ryan Cartwright, 2008-05-05 -
What is the free software community?
Tony Mobily, 2008-03-29 -
Things you miss with GNU/Linux
Ryan Cartwright, 2008-05-01 -
How do you replace Microsoft Outlook? Groupware applications
Ryan Cartwright, 2008-03-20 -
Beyond Synaptic - using apt for better package management
Ryan Cartwright, 2008-04-03
Hot topics - last 21 days
-
Installing an all-in-one printer device in Debian
Ryan Cartwright, 2008-05-05 -
Things you miss with GNU/Linux
Ryan Cartwright, 2008-05-01 -
Digital Rights Management (DRM): is it in its death throes?
Gary Richmond, 2008-05-07 -
Open letter to standards professionals, developers, and activists
Pieter Hintjens, 2008-05-13
Dedicated server
be careful what you mod
Submitted by Anonymous visitor on Wed, 2006-08-30 21:49.
Vote!Also a good note, be very VERY careful what you mod... game modding has gotten myself and my friends sued in the past. I kid you not: http://www.worthplaying.com/article.php?sid=23629