On Simulation and Engines

I love technical simulations, such as flight or driving simulators, specifically that ones aiming to simulate real physical entities, in contrast to game software where the focus is entertainment and not realistic behavior. Of course, nowadays you cant draw a clear borderline between gaming and simulation  (for the PC market, not the industrial purpose simulator). Amazing to observe the development and evolution of software and underlying physics and graphics rendering engines over the last 30 years, I still remember getting my hands on Microsoft’s first version of the Flight Simulator from 1982 (its version history ended in 2006 with Flight Simulator X).
Due the hardware limitation of that time (typically 4.77 MHz IBM PC, 64K memory, 360K floppy , no harddisk !) the graphics were rather simple, not to say extremely simple, but still it made us being overly excited to use this simulator in the early 80′s. The software focused from the first version to be accurate on flying physics and navigation.

MS flight Simulator 1.0 Screenshot

30 years later we have such high level of graphical and physical rendering quality, that we almost simulate reality as-is. Hardware build in phones surpasses easily the capabilities of hardware of 80′s, you even get simulation software for tablets today.

The above screenshot is from the website  fshistory.simflight.com (the copyright belongs to them) and I ask you to drop by the website setup by Jos Grupping, unfortunately there are no updates since 2007, as well the Wikipedia entry.

Comparing to visual impact of the version X from 2006.

MS Flight Simulator X

On a side note: Microsoft restarted their effort to build a flight simulator with MS Flight, this time targeting the mass market with a more entertaining version. It is FREE to play, but Microsoft decided again to cease development and scrapped the project in July 2012. Download from here. Wikipedia Info.

In this series I will look further into the simulation software and underlying engines for Windows and Linux.

OpenSource Hardware

OSS is nothing really new anymore, even Microsoft announced 60% of their software (they use!) is OSS. But OpenSource Hardware is still fairly new, at least on a broader market. Over the years I read about various initiatives to launch this kind of products. I believe only geeks and hackers are attracted by hardware they can build, program and configure to their needs and ideas. Many years back I did some electronics (during my studies), but often started from the scratch with simple stuff to control household devices, as simple as dimming the light with a remote, etc.

I came across the Arduino board which gives you a micro-controller platform that you can connect to your Windows, Mac or Linux desktop to program it and let it run independently. It is all open and documented, you can control something simple like a LED but can go to the extend of reading acceleration, temperature, controlling cameras, an almost infinitive field of appliances. Google for Arduino projects and you find amazing stuff, built on top of a 29$ device.

I recommend at least some basic knowledge of electronics, but even without any clue, you can get started, there are plenty of books and websites with tutorials.

Get started here: www.arduino.cc and buy the device from here, and if you live in Singapore from SGBotics.

Arduino Platform

SnipplrScout Release 0.1

A little sunday afternoon project, mixing Java and Groovy into a Swing application that reads your favorite code snippets from snipplr.com. The website has an XML-RPC based API, so a good exercise with this rather old API technology. I am storing both sourcecode and jar file on bitBucket (which is now under Atlassian). Learning the Mercurial way.

Download the tool from: http://bitbucket.org/javadude/snipplrscout/downloads

SnipplrScout 0.1A

Project: Visualizing Trac Wiki Pages (Part 2)

More information before we start with the implementation:

Graph requirements:

  • Display all wikipages as nodes
  • Show direction (links are uni-directional)

Option Requirements:

  • Highlight direct connected wikipages
  • Display content (in separate browser window)

Wiki Graph

The XML for prefuse graphs look like this sample (our groovy script needs to produce this):

<?xml version="1.0" encoding="UTF-8"?><graphml xmlns="http://graphml.graphdrawing.org/xmlns">
 <graph edgedefault="directed">
 <key id="wname" for="node" attr.name="wname" attr.type="string"/>
 <node id="1">
 <data key="wname">WikiStart</data>
 </node>
 <node id="2">
 <data key="wname">IdeOverview</data>
 </node>
 <node id="3">
 <data key="wname">JavaEE</data>
 </node>
[..]
 <edge source="1" target="3"/>
 <edge source="1" target="4"/>
 <edge source="1" target="5"/>
 <edge source="1" target="6"/>
 <edge source="1" target="7"/>
 <edge source="1" target="13"/>
 <edge source="3" target="4"/>
 [..]
 </graph>
</graphml>

The prefuse xml file contains the metadata for the nodes, all nodes and all edges linking the nodes.

Using the backup function of Trac we need to process input like this sample:

INSERT INTO "wiki" VALUES('wikiPage1',2,1246948793,'user','220.255.7.193',' * MySQL on Server xyz * Evaluate Firebird and Oracle. (schema and timestamp issue)','',0);

The SQL file contains the complete wiki content. Following the sample we need to filter with

  • type: INSERT INTO ‘wiki’ (filter out all others)
  • page title: ‘wikiPage1
  • version: ‘2‘ (search for the highest version)
  • wiki user: ‘user‘ (filter out all ‘trac’ entries)
  • content: ‘* MySQL on Server xyz * Evaluate Firebird and Oracle. (schema and timestamp issue)

Project: Visualizing Trac Wiki Pages (Part 1)

We are using Trac as Wiki and after a couple of months using it as main know-how repository, we tend to loose the overview of the myriad of pages and how they are linked to each other. A graph representing the relation between the pages would be very useful.

I could not find any plugin or tool, so it would be a good exercise to create a tool that convert a trac wiki into a graph.

Options:

  • Use Java or Groovy. I choose Groovy because less boilerplate for standard tasks, such as creating xml, reading text files, etc.
  • XML-RPC to access the wiki directly. I tried to create a mockup in Java, but failed due to the cryptic error messages and hard to debug.
  • Trac backup to retrieve wiki data: You can create a backup in form of an INSERT sql file containing the complete structure of the wiki (inclusive of non-user content and all revisions of the wiki. I choose this as a starting point until I get the XML-RPC problem solved (maybe in Groovy).
  • Visualization in JGraph, InfoVis, Prefuse or other toolkits. I decide for Prefuse because it is feature complete, powerful and I created simple applications previously.

Current Implementation:

  • A simple Groovy script that works in 2 stages, a) reading and processing the sql backup file and b) creating a xml file that my prefuse viewer can display.

Future Plans:

  • Create a standalone SwingXBuilder application
  • Create a Netbeans Plugin

Sunday Afternoon Projects

I love 3D engines and the concepts of simuation of real world scenarios with realistic looking software. Most of the 3D engines are heavily infested with C, C++ or C# (due to higher performance) and almost all of them have a hefty learning curve, if you want to go beyond the click-and-play editor of the simple game engines. I dont really have time to get involved in technology that is too far away from Java and Java is not really known for powerful 3D graphics…until I found this:

  • JMonkeyEngine (JME is a highperformance 3D scene graph based graphics API)
    (link)

    Josh Slack (the brain behind JMonkeyEngine) at Java One 2008

And if you want to have a simpler start into the world of physics, you can play with Phys2D. I even someone implementing a simple game in JavaFX using this ! Will share more on this on the next sunday afternoon sesion.