Archive for the ‘software’ Category

CUDA Link Collection

Tuesday, November 6th, 2007

Here’s a list of CUDA related things on the web. CUDA stands for Compute Unified Device Architecture and is a GPGPU technology created by NVIDIA that allows a programmer to use the C programming language to code algorithms for execution on the GPU. The official website can be found here.

Update: NVIDIA introduced the new CUDA Zone website: http://www.nvidia.com/cuda a convenient way to access everything related to CUDA.

If you happen to know more CUDA related links (e.g. projects that use CUDA) feel free to leave a comment.

VTK read and display 2D raw data

Tuesday, August 7th, 2007

In order to create a simple 3D and 2D data visualization tool I took a look at the Visualization Toolkit. I found everything I needed there – it’s a really great collection of C++ classes with bindings for various other programming languages (TCL, Python). However the documentation is somewhat confusing and lacking simple basic things although a very good document on how to install compile and use it together with Visual Studio can be found here and a great blog aiming at overcoming the lack of tutorials can be found here.

I had quite a hard time figuring out the easiest thing: read raw 2D data and visualize it. After I played around with it for a while I figured it out. It’s actually pretty simple. Here’s the code:

/*******************************************************************************

    Simple VTK Example

    A very simple VTK example - a raw 2D datafile is read
    it's magnified by a factor of 3 and then it's displayed on a window.

    The pipeline:
    vtkImageReader->vtkImageMagnify->vtkRenderWindow

    The image file is a raw file of 64 rows * 64 columns. The values are
    2 byte (short int) long. 
    It's a greyscale dataset (NumberOfScalrComponents = 1)

*******************************************************************************/

#include "vtkImageReader.h"
#include "vtkImageViewer.h"
#include "vtkImageMagnify.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"

#define IMG_FILE "C:data.raw"

int main (void)
{
  vtkImageReader *imgReader = vtkImageReader::New();
    imgReader->SetFileDimensionality(2);
    imgReader->SetFileName(IMG_FILE);
    imgReader->SetNumberOfScalarComponents(1);
    imgReader->SetDataExtent(0,63, 0,63, 0,0);

  vtkImageMagnify *imgMagnify = vtkImageMagnify::New();
    imgMagnify->SetInputConnection(imgReader->GetOutputPort());
    imgMagnify->SetMagnificationFactors(3, 3, 3);

  vtkImageViewer* imgViewer = vtkImageViewer::New();
    imgViewer->SetInputConnection(imgMagnify->GetOutputPort());

  vtkRenderWindow *renWindow = vtkRenderWindow::New();
    renWindow->AddRenderer(imgViewer->GetRenderer());
    renWindow->SetSize(64*3, 64*3);

  vtkRenderWindowInteractor *renWindowInteractor = vtkRenderWindowInteractor::New();
    renWindowInteractor->SetRenderWindow(renWindow);
    renWindowInteractor->Initialize();
    renWindowInteractor->Start(); 

  return 0;
}

All new

Thursday, July 19th, 2007

All new on the echelon blog. The layout has undergone a severe design rework – it looks much prettier now. Also check out the supercool new navigation and blog-description.

Suomenlinna

The blog is now driven by Wordpess. Even the hosting changed as this webserver now runs on one of those new fancy server grids. Took long enough to make those changes but now everything is running very smoothly again and new posts are about to come. As for the RSS feed: it is now located at http://www.soa-world.de/echelon/feed/.

Good Games

Monday, April 9th, 2007

No, this is not about the coolest, best and most spectecular new video games but about good video games as in “doing good“. HopeLab a non profit organization in the area of San Francisco has dedicated itself to combine rigorous research with innovative solutions to improve the health and quality of life of young people with chronic illness.

Their first and most popular product is Re-Mission, a “challenging, 3D shooter with 20 levels that takes the player on a journey through the bodies of young patients with different kinds of cancer. Players control a nanobot named Roxxi who destroys cancer cells, battles bacterial infections, and manages realistic, lifethreatening side effects associated with cancer”. Watch the making of video here.

The other game might not entirely fit in the category “good game” but it’s another exepctional game. PeaceMaker by Impact Games is a game where you either play the Israeli Prime Minister or the Palestinian President. It is inspired by real events in the Israeli-Palestinian conflict and your goal is to achieve a two-state solution in order to bring peace to the region. Read an extensive game review on Gamasutra here.

I like the idea of games that “do good” a lot and I’m wondering if a MMOG such as a browser game could be designed to do good too.

Javascript Game Engines

Sunday, March 11th, 2007

Here is a roundup of Javascript Game Engine prototypes. I’m very interested in this stuff and I implemented a very simple prototype myself some time ago. There are two very different types of engines: one group is able to render some sort of map, suitable for strategy or arcarde games. The other group consists of first person 3D engines, suitable for e.g. car racing games and shooters. Here are two examples for the first group:


Ajax3d Demo and Freevolution – an Isometric Map Engine

Both engines seem very cool and very advanced. I’m looking forward to games that use this kind of engines. Such games could combine appealing graphics found in conventionel computer games and the fun that massive amounts of players bring to a game as browser bases games are noted for. I predict sheer infinite possibilities.

The second group of engines is not as attractive as the first one. The reason for that is simple. Games like shooters and car racing games are attractive because they look good. Because they look very realistic. Because they have fantastic effects. Javascript based games could not ever compete with regular computer games in this area. However if one is inventive and has a great game concept I definetly see a future for those kinds of engines too. Here are two examples:


Canvascape – “3D Walker” and HTML Canvas Element real 3D Demo

Browser Games and Software Engineering

Thursday, February 15th, 2007

I recently started writing (yet another) browser based massively multiplayer online game (MMOG) engine. Nothing to fancy, very basic and simple stuff. And I’m of course nowhere near finished. However I spent a considerable amount of time thinking about the fundamental design from the standpoint of a software engineer. This article describes what I came up with.

The very basic design pattern
As all well coded modern applications implement the model-view-controller design pattern I tried to adapt this princible. The pattern facilitates splitting the application into three layers: the model, the view and the controller.

The view (or user interface) represents the data in a convenient way for the user and enables him to trigger certain actions, request data and so on.

The controller (or in my case the game logic) embodies the actual game logic. It is capable of processing and responding to user requests or events in general. A ticker object (a piece of code that updates the game regularly) would also fit into this layer. Additionally it contains a data-link, to connect the controller and the model layer.

Finally the model layer. It represents the game data. In browser games this is often a database of some sort. In my case it’s a shiny PostgreSQL 8.2 database.

The advantage of this pattern is obvious: by decoupling data presentation, business logic and data access/storage the layers may be altered independently. It also simplifies development by reducing the complexity of the engine. Additionally it allows developers to work on different problems, e.g. say a web designer develops the user interface whereas the PHP developer creates the game logic. The developers simply have to define the interfaces between their layers. That’s all they need to know of each other.

Decoupling of the presentation layer nowadays is often achieved by using some sort of template engine. A really cool thing! A detailed description of the mvc design pattern can be found on here.

Controller and Model Design
So far I have designed the controller and the model layers. The following pseudo class-diagram visualizes the concept:

The view layer is not yet implemented. However I plan to allow the user interface to send REST requests to the controller layer. There the received data is validated and the user is authenticated. Then the business logic processes the event, requests some data from the database via the data link, compiles the data together and triggers an output class (XML) to return the data to the user interface. Very straight forward. The user interface hopefully knows what to do with this data and represents it accordingly.

Implementation Consideration
I have already implemented the classes in the diagram shown above. I had to make several choices:

Error handling is a difficult and vital point of the design. I followed one basic principle: only the main class (the business logic class) is allowed to handle errors. Errors occurring in other modules are passed through to the business logic class. This is, in my opinion, vital to maintaining a clearly arranged engine. To return errors I used simple function return values and exceptions. PHP supports a very cool and straight forward exception system (with cool try and catch blocks). Exceptions are also a great way to report errors that occur in a class constructor. However I did not stick with exceptions exclusively because sometimes return values are much easier and faster to implement.

Data validation is a two layer task: first I check if the user tries to foist bogus data on the engine. This can be done with regular expressions and preg or ereg. The second layer ensures that the user does not try to do anything he is not allowed to, like reading someone else’s messages or building more soldiers than he can pay for.

Free Stuff
In case you are interested, the images are created with the ingenious 0.45 version of Inkspace. It’s totally free and really cool. A ZIP file containing the source of the images can be downloaded here. The gorgeous icons are taken from the Tango Desktop Project. A larger version of the second image can be found here. As soon as I finish parts of the game I will put the source code online.

First Browsergame Prototype

Friday, November 10th, 2006

My first browsergame prototype is out!

It’s a very very basic graphical user interface prototype that does not do much so far. It was created to start learning the technology and to determine what can be done and what can’t.
The JavaScript inside the prototype is probably very ugly and you can’t do anything more than scroll the map. There’s still lots of room for improvement both usability and featurewise. But as I am a little proud of it I’m showing it anyway, hoping somebody will leave comments or suggestions.

The map is taken from Starcraft (an ingenious realtime strategy game created by Blizzard Entertainment) and is called Lost Temple. It’s very famous among online players.

If you have any suggestions or comments feel free to send an email to chairman at soa-world.de. Well, there’s nothing more to say, just:

go ahead and start the prototype.

To scroll the map you may either touch one of the eight green arrows or move the mouse to an edge of the map.