Archive: Software Engineering
March 6, 2008
Microsoft Excel 3D engine
Peter Rakos wrote an article for Gamasutra today which demonstrates how to hack yourself a simple 3D engine by subverting an Excel worksheet. It's not going to win any FPS awards, but the fact that you can even get Excel to draw raw shapes blows my mind.
In his demo, the worksheet is used to calculate values for all the polygon vertices and a very small macro loop draws the resulting mesh to the screen.
After downloading the source XLS, run the demo by hitting alt-F8 (option-F8 in Mac Excel). You'll find the code under the "Tools->Macro->Macros" menu.
Microsoft Excel: Revolutionary 3D Game Engine - Link
Peter's Example 3D Excel files - Link
Posted by Jason Striegel |
Mar 6, 2008 08:14 PM
Excel, Gaming, Software Engineering |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 29, 2008
Single character commenting
It's a pretty common practice to comment and uncomment big chunks of code during the development and testing of software. Here's an odd little hack from the ajaxian blog that can make this a little easier for blocks that you're constantly flipping on and off during development.
For C style comments, the following will be commented out:
/*
if ( foo == bar )
{
dosomething();
return();
}
// */
And the addition of a single '/' will uncomment the block:
//*
if ( foo == bar )
{
dosomething();
return();
}
// */
In languages that don't have the single line comment, such as CSS, you can do the same thing with only the block level comments.
Commented:
/*/
min-height:100px;
/**/Uncommented:
/**/
min-height:100px;
/**/
You are probably talking to your screen right now, saying, "hey Jason, that commenting trick is marginally useful at best." I can only respond by reminding you that every keystroke is a beautiful and unique snowflake that must be cherished and never wasted.
A neat commenting trick - Link
Posted by Jason Striegel |
Feb 29, 2008 05:42 PM
Software Engineering |
Permalink
| Comments (15)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 10, 2008
Extracting GTA3 art assets for use in your own game

One of the most frustrating things about homebrew game development is that there's almost an insurmountable amount of work that needs to be done just to get something decent to display on a screen. You can roll your own complete graphics and physics engines and still have nothing to show for it if there are no art assets to load.
QuantumG's solution to the problem was to focus on developing the game engine using the model data from GTA3. Knowing that the art is already functional in another game allows you to focus on your code, and it's more fun when you can see the immediate results of your work.
The blog entry walks you through his experience with extracting and using the mesh, texture, city, and character data and making use of it with the OGRE graphics engine. If you've ever played around with making a game before, but got discouraged for lack of art assets, this is really worth a read.
Using GTA3 art assets in OGRE - Link
OGRE 3D graphics engine - Link
Posted by Jason Striegel |
Feb 10, 2008 08:18 PM
Gaming, Software Engineering |
Permalink
| Comments (2)
| TrackBack
| Digg It
| Tag w/del.icio.us
January 23, 2008
Accelerometer motion analysis

There's an article over on the WiiLi Wiki that goes into great detail describing how to translate 3D accelerometer measurements into an estimation of the position, rotation, and velocity of a device like the Wiimote. By making a few assumptions—people's arms have a limited range of motion, most Wii play doesn't take place in moving vehicles, etc.—it's quite surprising what you can get away with with just the accelerometer data.
The amusingly named (but rarely used) term for the rate of change of acceleration is jerk. The jerk term for the remote shows up in the time derivative of the force recorded by the sensor, along with the rotation term that contains the angular velocity of the remote. We can extract both rotation and linear acceleration if we assume a few things:
- We know the "up" direction before the motion starts.
- Throughout the motion, the jerk on the remote perpendicular to the current direction of gravity is small.
Then we can assume the time derivative of the force component which is perpendicular to our current estimate of the up direction is caused by the user rotating the controller only. This allows us to update our estimate of the up direction for the next time step. In each time step, we can also get the linear acceleration of the remote by subtracting our estimate of from the current force sensor report. In effect we are integrating up a coupled set of ordinary differential equations. (Note, need to review the math here. Beware.)
The main problem with this technique is error accumulation in our estimate of "up." Since it is unlikely the user can keep the controller in constant linear motion without injuring themselves, the TV, or their opponent, we can look for times when the total reported force is close to g = 1.0 to recenter . You have to be careful when doing this because it is possible and probably common for the Wiimote to report an acceleration close to g = 1.0 while it is accelerating. When this happens your acceleration vector does not actually point "up" and you will recenter to an incorrect R. This can happen anytime you are accelerating both downward and in the horizontal plane.
I keep thinking that there should be some class of flying vehicle that, when operated under fairly restrained conditions, might be able to get by with just accelerometer measurements to obtain reasonably accurate state information. You could integrate the acceleration data through very limited motions that are within some margin of error, recalibrate, and repeat. This is probably a pipe dream, but I really want a solution for a $50 6DOF IMU. :/
Accelerometer motion analysis - Link
Posted by Jason Striegel |
Jan 23, 2008 10:30 PM
Electronics, Flying Things, Gaming, Math, Software Engineering |
Permalink
| Comments (4)
| TrackBack
| Digg It
| Tag w/del.icio.us
January 17, 2008
Mouse wheel programming in Javascript and Flash
It's an underused feature, but you can give your Flash and AJAX/Javascript applications basic mouse wheel support that works across most common browser platforms. Google Maps' mouse zoom feature is a good example of how useful this small addition can be. If you're programming an application where zooming or scrolling is a common task, give your users a break and don't overlook this one.
On the Javascript side, Adomas Paltanavicius has put together a thorough overview and some example code for making this work in your application. You can capture wheel scroll events in IE, Safari, Firefox and Opera.
For Flash, you need to do some Javascript to Flash communication to capture mouse events on the Javascript side, and then make the data available from within the running Flash application. The SWFMacMouseWheel library provides the necessary glue to do all of this, bundling the Javascript listener code and an Actionscript event object into an easy to use package.
Mouse wheel programming in JavaScript - Link
SWFMacMouseWheel: use the mouse wheel in Flash - Link
Posted by Jason Striegel |
Jan 17, 2008 10:09 PM
Flash, Software Engineering, Web |
Permalink
| Comments (1)
| TrackBack
| Digg It
| Tag w/del.icio.us
January 2, 2008
Open source game development

One of the more interesting recent news items is the announcement of Apricot, a new open source game development effort that is promising to produce a complete 3D game and development/production stack by the end of July 08.
The team will work on a cross platform game (at least Linux, Windows, OS X), using Blender for modeling and animation, Crystal Space as 3D engine and delivery platform, and Python for some magic scripting to glue things together. It is not only the purpose to make a compelling 3D game experience, but especially to improve and validate the open source 3D game creation pipeline, with industry-standard conditions.
I've only monkeyed with Crystal Space and Blender in the past, but I'm really impressed to see how far both of these applications have come and how they are now able to integrate with each other. There's a plugin for Blender called blender2crystal which makes it possible to develop maps and characters within the Blender 3D modeler, then export those models (including their physics and animation properties) into scriptable entities that can be used directly in the Crystal Space 3D engine. Tying the functionality of these two applications together is such a good move. Hopefully Apricot will help develop a solid model and some best practices for producing an entire game using these two tools.
If you can't wait until July to start digging through the Apricot code, there are several demos that have been made using Blender and Crystal Space that you should check out. The general outline is that you develop your game's 3D artwork within Blender, use Crystal Space as the underlying 3D engine, and then write your game logic in Python scripts which can control the underlying 3D engine via the CEL (Crystal Entity Layer) API.
Resources:
Project Apricot - Link
Crystal Space (3D Engine) - Link
Blender (3D Modeling Tool) - Link
CEL (Python Scripting for Crystal Space) - Link
blender2crystal - Link
Blender 3D: Noob to Pro WikiBook - Link
Posted by Jason Striegel |
Jan 2, 2008 10:51 PM
Gaming, Linux Multimedia, Software Engineering |
Permalink
| Comments (1)
| TrackBack
| Digg It
| Tag w/del.icio.us
December 28, 2007
Chumby software development

MakeFan: wrote in to remind us that those cute little Chumby devices are for sale now. The best thing about the little wireless touchscreen appliance is that they were designed to be open and hackable. The underlying operating system is Linux, and there are a number of lower level OS hacks, but you can also pretty easily whip up slick "widget" applications as well, since the Chumby's normal mode of operation is to play Flash Lite 3 applications.
The Chumby developer wiki has source for a number of sample widget applications that will help you get started if you're new to Flash. If you're a seasoned pro, Flash Lite 3 isn't all that different from developing in standard Flash / AS2. You just need to avoid a few features like bitmap caching, and lay off CPU and graphics intensive code.
If you're interested in developing for the Chumby community, but don't have a device, you can make an account on the chumby.com site. After logging in, you can upload your widgets to a "Virtual Chumby" and see how they would run on the device.
Resources:
Chumby Flash development overview - Link
Chumby Flash development forum - Link
Widget development Wiki - Link
Posted by Jason Striegel |
Dec 28, 2007 05:16 PM
Flash, Software Engineering |
Permalink
| Comments (2)
| TrackBack
| Digg It
| Tag w/del.icio.us
December 25, 2007
Lecturefox: free university lectures
I think MIT coined the term Open Courseware, but there are several other universities that are releasing lecture videos for free online. Now, tracking down a particular subject matter is made quite a bit easier because of a project titled Lecturefox. From the about page:
What is Lecturefox?It's all about the joy of learning.
Lecturefox is a free service. You can find high-quality classes from universities all over the world. We collect without exception lectures from official universities, and we have a special interest in lectures from the faculties physics, chemistry, computer science and mathematics. In the category "faculty mix" you can find miscellaneous lectures from other departments like electrical engineering, biology, psychology, economics, history and philosophy.
I really like what they've done in collating these resources into a single index. Tracking the companion blog's RSS feed, you can get updates about new material that's become available. Video, audio and text courseware are included in the index and it appears to be actively maintained and comprehensive, especially for computer science and other math/science related courses.
Forget your other new years resolutions. You couldn't do much better than treating yourself to a free lecture every weekend.
Lecturefox: Free University Lecture Index - Link
Lecturefox Blog - Link
Previously: Bootstrap Education - Link
Posted by Jason Striegel |
Dec 25, 2007 07:14 PM
Education, Life, Lifehacker, Software Engineering |
Permalink
| Comments (3)
| TrackBack
| Digg It
| Tag w/del.icio.us
December 23, 2007
Johnny Chung Lee's Wiimote hacks
Johnny Chung Lee, who you may recall from $14 steadicam fame (read about it in Make:01), is also a very proficient Wiimote hacker.
His latest, demonstrated in the video above, is a prototype VR system that uses the Wiimote and a head-mounted IR LED as a head tracking device. The software transforms a standard monitor into a 3 dimensional portal. As you move your head, the objects on the screen are positioned appropriately for your new perspective. Think about adjusting your position to see what's around the side of the screen! The effect is like looking through a window, and it gives an more impressive 3D effect that you'd get with the goofy colored glasses.
Lee has a project page for his Wii creations, which also includes a finger tracking, Minority Report-style device and an interactive whiteboard hack. He's generously provided source for all of these hacks. Return the favor by building something cool.
Johnny Chung Lee's Wii Hacks - Link
Procrastineering Blog - Link
Posted by Jason Striegel |
Dec 23, 2007 08:16 PM
Electronics, Gaming, Software Engineering |
Permalink
| Comments (2)
| TrackBack
| Digg It
| Tag w/del.icio.us
November 17, 2007
Faking constants in Actionscript 2.0
Most people get around Actionscript 2.0's lack of constant variables by just naming member variables in all capital letters and remembering not to alter their value. This works okay, assuming you obey the rules, but what if you want to enforce a constant value so that it cannot be changed during runtime. Edgar De Loa wrote to us about this today:
Constants are not inherent in actionscript 2.0. The closest one could get is to make something private, and globally accessible. However, this doesn't ameliorate the problem, since the variable could still easily be changed, and the notion of it being a constant crushed.I've found a very easy way to simulate constants. After looking around, I've found no one else that has suggested and/or used this method.
The first step is to create a static class, and define a private variable with the value one would like to store. The next step is to add a public function that returns the aforementioned private variable. Naming the function identical to the private variable (all in caps), is a great and easy way to access the constant.
static class ConstantVars {
private var ARRAY_SIZE = 12;public function ARRAY_SIZE() {
return ARRAY_SIZE;
}
}
So now, one can use ConstantVars.ARRAY_SIZE() to access the constant, with no way to change or get rid of it. I've also found that naming the class something simple, like "Const" will make everything even more quick and simple.
This works, but I think we can even do one better.
By using a static "getter" method, you can retrieve enforced constant value and you don't need to use a function's normal parenthesis notation to access it. You can use this in a more global static "Const" class as Edgar describes for more global variables. Alternatively, you can encapsulate the static constant in any normal class, which is handy if the constant is relevant to a particular class (instead of just a global const variable).
As an example, let's say you had a class that authenticates a user. It's not a static class. It has some member variables and a few methods that deal with authenticating and storing a user's credentials. It also has a few message strings that are relevant to the authentication process, which you may want available to other parts of the application, but you want to make sure these strings are constants and aren't accidentally changed at runtime:
class Authentication {
private var guid;
private var username;
private var password;
private var server;
public static function get SUCCESS_MSG():String { return "Login successful"; }
public static function get NOSUCHUSER_MSG():String { return "The user was not found"; }
public static function get SERVERERROR_MSG():String { return "There was an error while connecting to the server"; }
public function Authentication( server, username, password ) {
...
}
public function authenticate():String {
//Performs the authentication and returns one of the constant error strings
}
...
}
Now code inside your Authentication class can refer to NOSUCHUSER_MSG directly, and code external to the class can access the constant values in a simple manner like Authentication.SERVERERROR_MSG. In this scenario, this could be pretty useful, because the Authentication class can pass success/error information around and external classes can know what the text means, even if it's changed in another translation. Another class could do something like the following to authenticate a user:
Authentication userauth = new Authentication( servername, user, pass );
var result = userauth.authenticate();
if ( result != Authentication.SUCCESS_MSG )
{
displayError( result );
}
This is a really simplified example--and there is probably a better example that didn't immediately come to mind--but you get the idea. Real constants are supported in Actionscript 3.0 using the const syntax, but if you're working on an AS2 project, there's still a solution for you that will give you the same effect.
Posted by Jason Striegel |
Nov 17, 2007 09:07 PM
Flash, Software Engineering |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
October 14, 2007
PyGPU - write software for the GPU in Python
The dedicated video hardware in most modern PCs can perform a number of algorithms at blazingly fast speeds, particularly those involving large matrix or vector operations. PyGPU allows you to access this computational power from a familar high-level language.
Haven't you ever dreamt of writing code in a very high level language and have that code execute at speeds rivaling that of lower-level languages? PyGPU is a compiler that lets you write image processing programs in Python that execute on the graphics processing unit (GPU) present in modern graphics cards. This enables image processing algorithms to take advantage of the performance of the GPU. In some applications, performance increases approach an order of magnitude, compared to CPUs.
There are a number of applications for this. What immediately came to mind, though, is that using the GIMP-Python package, this might be an easy way to add accelerated image processing plugins to GIMP.
PyGPU - Python for the GPU - Link
PyGPU: A high-level language for high-speed image
processing (PDF) - Link
Posted by Jason Striegel |
Oct 14, 2007 07:18 PM
Software Engineering |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
October 6, 2007
Heap-based buffer overflow: how the iPhone and iPod Touch could be hacked
The recent scuttlebutt in the iPhone and iPod Touch developer forums is that there is a buffer overflow bug in the code used to load TIFF images in Safari (libtiff). The letdown is that the stack is not executable on the devices, leading many to think this is a dead end.
The heap, however, _is_ executable, and a heap based buffer overflow which exploits the libtiff bug may be the way to gain usable access to the iPod Touch and the 1.1.1 upgraded iPhone.
Read full storyPosted by Jason Striegel |
Oct 6, 2007 05:45 AM
Software Engineering, iPhone, iPod |
Permalink
| Comments (1)
| TrackBack
| Digg It
| Tag w/del.icio.us
June 15, 2007
DIY orb warden for software builds

If a lot of your day is spent building and rebuilding software, you want to know at a glance how things are going. You could walk over to the monitor and look at the text symbols that humans use to communicate, or you could glance at a softly glowing orb that lets you know what's going on. devon.jones has posted an Instructable that shows you how to do it using Arduino, and even shows you how to build the orb. Link
Posted by Brian Jepson |
Jun 15, 2007 04:03 AM
Software Engineering |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
Bloggers
Welcome to the Hacks Blog!
Categories
- Ajax
- Amazon
- Android
- AppleTV
- Astronomy
- Baseball
- BlackBerry
- Blogging
- Body
- Cars
- Cryptography
- Data
- Design
- Education
- Electronics
- Energy
- Events
- Excel
- Excerpts
- Firefox
- Flash
- Flickr
- Flying Things
- Food
- Gaming
- Gmail
- Google Earth
- Google Maps
- Government
- Greasemonkey
- Hacks Series
- Hackszine Podcast
- Halo
- Hardware
- Home
- Home Theater
- iPhone
- iPod
- IRC
- iTunes
- Java
- Kindle
- Knoppix
- Language
- LEGO
- Life
- Lifehacker
- Linux
- Linux Desktop
- Linux Multimedia
- Linux Server
- Mac
- Mapping
- Math
- Microsoft Office
- Mind
- Mind Performance
- Mobile Phones
- Music
- MySpace
- MySQL
- NetFlix
- Network Security
- olpc
- Online Investing
- OpenOffice
- Outdoor
- Parenting
- PCs
- PDAs
- Perl
- Philosophy
- Photography
- PHP
- Pleo
- Podcast
- Podcasting
- Productivity
- PSP
- Retro Computing
- Retro Gaming
- Science
- Screencasts
- Security
- Shopping
- Skype
- Smart Home
- Software Engineering
- Sports
- SQL
- Statistics
- Survival
- TiVo
- Transportation
- Travel
- Ubuntu
- User Interface
- Video
- Virtualization
- Visual Studio
- VoIP
- Web
- Web Site Measurement
- Windows
- Windows Server
- Wireless
- Word
- World
- Xbox
- Yahoo!
- YouTube
Archives
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Recent Posts
- SlugPower - Linux controlled power switch
- Play backed-up Wii games
- Quick workaround for the T-Mobile G1 root shell bug
- Hand gesture multitouch using only a webcam
- Gesture recognition for Javascript and Flash
- Programming DNA
- Live via hologram
- Top 5 election day mashups
- Telescope control with stepper motors
- CSSHttpRequest - cross browser AJAX without JSON
www.flickr.com
|






Recent comments