Tuesday, December 2, 2008

XKCD: Faust 2.0


Image by XKCD

Monday, December 1, 2008

There's a new STXI trailer out there featuring an old Spock, portrayed by Leonard Nimoy from the old series, at the end.
J. J. Abrams is bloody good at marketing and knows for sure how to rise the hype. I'm sure we must expect some other tricks before the movie is released.
live long and prosper folks!

Sunday, November 30, 2008

My PyQt Scribbles (Python and Qt) #2: a plain window in PyQt

Today we will create a main window, set a window title, an icon and a tooltip related to the window.
First of all let's check that our PyQt is well installed and working. To do this just type: import PyQt4 from IDLE and press enter. If nothing happens we're fine. If it shows an error message like "ImportError: No module named PyQt4", try to check your installation (see My PyQt scribbles #1).
If everything is fine we can start.
I will first present the code as a whole and then proceed through it to analyse the various parts.
import sys
from PyQt4 import QtGui

class HelloWorldWindow(QtGui.QMainWindow):
        def __init__(self, parent = None):
                QtGui.QMainWindow.__init__(self, parent)
                self.setWindowTitle("My First Qt Window")
                self.setGeometry(300,300,250,150)
                self.setWindowIcon(QtGui.QIcon("C:/Python26/PyQt/Icon/gadu.png"))
                self.setToolTip("Hello to this Wiz and Chips example!")

app = QtGui.QApplication(sys.argv)
main_window = HelloWorldWindow()
main_window.show()
app.exec_()
We begin importing the needed modules.
import sys
from PyQt4 import QtGui

Sys is needed to initialise the QApplication class. This class manages the application control flow and the main settings. QApplication contains the main event loop (where all events from the window system and other sources are processed and dispatched), the application initialisation and finalization. For any GUI application based on Qt there must be one QApplication object, no matter how many windows are displayed.
QtGui is the module which contains the GUI classes. As a matter of fact extends the QtCore module with GUI functionality
We now create a main class:
class HelloWorldWindow(QtGui.QMainWindow):
The argument of our window class refers to another class, QMainWindow, which supplies a main application window.


The layout has a center widget area where any kind of widget can be placed. You can add QToolBars, QDockWidgets, a QMenuBar, and a QStatusBar. It's not currently possible to create a main window without a central widget. You must have a central widget even if it is just a placeholder.
Now we create a function to initialise the class
def __init__(self, parent = None):
            QtGui.QMainWindow.__init__(self, parent)
this is to initialise the main window. __init__ is a special function in python which is used to set up the object using the arguments to make variables for the object. __init__ is called upon the object creation.
Now it's time to shape a bit our window.
self.setWindowTitle("My First Qt Window")
The setWindowTitle() method sets the window title
self.setGeometry(300,300,250,150)
The setGeometry method sets the relative position (x,y) on the screen and the size (w,h) of the window
self.setWindowIcon(QtGui.QIcon("C:/Python26/PyQt/Icon/gadu.png"))
This method sets the window icon. For my test I have used a crystal clear project icon (http://www.everaldo.com/crystal/). For windows user be sure to use "/" as folder separator instead of "\". The latter is used for escapes in python.
self.setToolTip("Hello to this Wiz and Chips example!")
With this method we specify a tooltip related to our present object: the main window
app = QtGui.QApplication(sys.argv)
QApplication class manages the GUI control flow and main settings
main_window = HelloWorldWindow()
main_window.show()

The show() method displays the widget on the screen
app.exec_()
This is to enter the main loop
Here below you can see the result: a window with all the accessories we have defined both in Windows XP and Linux Kubuntu 8.10 KDE 4.1 fashion.



Pretty neat result isn't it? And without too much effort also! At this very early point PyQt seems quite cool and easy to me. Let's see what we can pull out of it.
As always.. stay tuned folks!
Disclaimer: I'm not a prefessional python programmer nor I pretend to be. I am just an amateur willing to learn and share its by-no-means-guarantee-as-it know-how with the reader. I nevertheless hope you will enjoy my scribbles and maybe find them somewhat stimulating and helpful.

Thursday, November 27, 2008

Town and neighbours to deprive 3yo disabled boy of his pony

I want to report what I read today following a Boing Boing suggestion by the newsletter I receive on daily basis. This led me reading an article on the National Post, Posted Toronto website which I further delved into on the Caledon Enterprise.
What I read is something that, as father of a 16 months old boy, I am especially sensitive to. It is also something which appeals to some of the most basic civil concepts as well as to a compassion feeling that should be a common base to all human beings. Of course that isn't the case and this is especially true when we see something like this taking place in one of those countries we include within the list of the more advanced and civilized ones. This is also a pilot light about how many injustices are in the world which are just there, awaiting to be eradicated.

The story is simple. Little Sam, 3yo boy living in Caledon Town, Ontario, Canada, is born with spastic quadriplegic cerebral palsy. Sam can't walk or crawl and when he was younger he also suffered from lung problems which can make him prone to possible infection. The boy suffers also from seizures.

To all this suffering Sam has only one thing, apart from his mother and grandparents, that bring joy to his difficult life: his mini pony Emily who's a gift from Sam's grandfather.

Sam rides Emily and he's happy, I imagine him dominating the world from the height of his pony friend. She holds him on his back from which he can feel freedom in a world where he can't move the way a boy of his age would like to do. I can understand deeply in my heart what he feels because I know how much my son, Robert, like to move, run, crawl and twirls like a little Tasman devil.

Now it comes the harsh news. Antonia Spiteri who's the mother of Sam, received a notice from the Town that, due to neighbours complaints and a so called out-of-the-law usage of her own property, Emily must be removed. It seems that Antonia's neighbours find the smell of Emily a severe threat to their life standards and the Town finds unacceptable to maintain a mini pony (called livestock) on a one acre property that borders a cattle farm.

Antonia, who is a single mom living with her parents, is struggling to avoid her son to be separated from Emily. Sam is really attached to the pony and Antonia says that he cries when they take him off the pony, even if he's tired. More of a friend Emily is also part of a therapy for Sam whose core muscles need to be strengthen. Sam's mother has already begun to show her son the possibility that the pony could go away. So Sam gets very upset every time they take him off Emily because he fear he will not see her again.

Antonia's going to discuss this issue to the Caledon committee of adjustment on Dec. 10. This procedure will cost her something about 1000 Canadian Dollars which are something about 650 Euro. It'sis really frustrating and absurd and tragically ridiculous that besides his serious conditions Sam, who's only 3 years old, must also face the cruelty of neighbours and the stupidity of bureaucracy.

I just want to spread the voice about this situation. I only ask you to send an e-mail to Antonia to let Sam and her your support. They need it for sure.
Her e-mail is:




If you also want to send a message of concern to the Caledon city council you will find the e-mail contacts to this page of the town website.

Wednesday, November 26, 2008

My PyQt Scribbles (Python and Qt) #1

this first installment of My PyQt Scribbles I will briefly introduce the Qt (PyQt) framework.
We will work with PyQt4 and Python 2.6. I will try as much as possible to test the code either on Linux (Kubuntu 8.10 currently) or Windows XP.
Let's start with a note on the installation.
For Windows users it's quite trivial (as usual) to download the binary from this page of Riverbank website. If you intend to use same tools I'm using then be sure of downloading the package for Python 2.6 (PyQt-Py2.6-gpl-4.4.4-2.exe). For Linux unfortunately there's no binary available but only the source for you to compile. My advice is to install the packages through Synaptict or Adept. Just look for python-qt4 in the repository.
PyQt, as binding of Nokia (former Trolltech) Qt, is a very complete library whose classes have been split is several extension modules.
The most important ones are the following:



And directly from the PyQt reference guide...
QtGui module: This contains the majority of the GUI classes.
QtCore module: This contains the core non-GUI classes, including the event loop and Qt's signal and slot mechanism. It also includes platform independent abstractions for Unicode, threads, mapped files, shared memory, regular expressions, and user and application settings.
QtNetwork module: This module contains classes for writing UDP and TCP clients and servers. It includes classes that implement FTP and HTTP clients and support DNS lookups.
QtXml module: This module contains classes that implement SAX and DOM interfaces to Qt's XML parser.
QtSvg module: This module contains classes for displaying the contents of SVG files.
QtOpenGL module: This module contains classes that enable the use of OpenGL in rendering 3D graphics in PyQt applications.
QtSql module: This module contains classes that integrate with SQL databases. It includes editable data models for database tables that can be used with GUI classes. It also includes an implementation of SQLite.
phonon module: This module contains classes that implement a cross-platform multimedia framework that enables the use of audio and video content in PyQt applications.
Qt module: This module consolidates the classes contained in all of the modules described above into a single module. This has the advantage that you don't have to worry about which underlying module contains a particular class. It has the disadvantage that it loads the whole of the Qt framework, thereby increasing the memory footprint of an application. Whether you use this consolidated module, or the individual component modules is down to personal taste.
We will begin referencing to QtGui directly -thus not calling PyQt directly-. As it happens to many voyages also my journey into PyQt has not an established trail or end. This means we will implement features together and possibly refer to many of the modules later.
As I always say, stay tuned folks!

Monday, November 24, 2008

The Linux Game Box #4: Beyond the Red Line (Battlestar Galactica)



Welcome to episode 4 of The Linux Game Box.
Today I'm gonna talk of Beyond the Red Line, a space combat simulation and unofficial spin-off of the reimagined Battlestar Galactica show.
Title:        Beyond the Red Line
Genre:     Platform
License:  Unknown but free
Website: http://www.beyondtheredline.net/

Beyond the red line is a standalone conversion (hooray!) of the award winning FreeSpace 2 game by Volition, Inc. The game released in 2007 it's only a demo featuring three single player missions and multiplayer support. A full game version (commercial?) is announced but no release date is specified. The official website provide scarce information and on October 2008 part of the team left Beyond the Red Line to work on a different project. We can thus fear that the full Beyond the Red Line full game is a vapoware.


INSTALLATION REQUIREMENTS → 5
To install the demo first thing you must download the install script. You can do so using this tracker for your torrent client. If you don't have a torrent client you can just download the script directly from on of the mirrors on the official web site.
After having downloaded the file you must set the script to be executable. To do this right click on the file, choose the permission tab and click the executable check box and run the script by double clicking it. At this point you could face a library problem like "error while loading shared libraries: libgtk-1.2.so.0: cannot open shared object file: No such file or directory". If you have this issue just install the last version of libgtk from Synaptic or Adept. At this point you can double click again on the install script and install the game.   Alternatively to solve the dependency and install the the game you could type this on the console:
$: sudo apt-get install libgtk1.2
$: sh BtRLDemoInstaller.run
The installer will create a btrl_demo folder on your /home folder.
Run the btlr_demo script to run the game.
Linux system requirements:
• Operating System: Linux x86 compatible
• CPU: Pentium® 1 GHz or AMD Athlon 800 MHz processor
• Memory: 512 MB RAM, 1 GB recommended
• Graphics Card: 64 MB NVIDIA® GeForce 3 or ATI Radeon with closed source drivers, Mesa 6 or better with S3TC extension available for open source drivers
• Input Device: Mouse and keyboard
• Installation: 800 MB free HD space

GAMEPLAY FUN → 8
BTRL is a space combat simulator game so the gameplay is similar to that of glorious games of the past like Wing Commander and the Lucasfilm X-Wing series. Thus the concept is basically you sit into the cockpit of a colonial Viper to do the fighter pilot's job: escort ships and do a lot of dogfight against the cylons. The game implement semi Newtonian physics flight to enable the player to perform all the manouvers seen on the show. Also the weaponry and ship instrumentation are replica of those designed for the SciFi tv show. Similar to its predecessors also BTRD features a full set of commands which requires a certain amount of practice to be learnt and mastered. This can be see as a drawback but in my opinion that's not the case. At the beginning can be hard to mess around with all the keys -somewhat contortionist- but as you learn and use them you get accustomed to them and acquire more control on the ship and this is quite rewarding. 




GRAPHICS APPEAL → 9.5
From the visual point of view BTRL is quite satisfactory. The ships are accurately modeled and contain high-resolution textures. The environment is fascinating and immersing. Performing flybys of asteroids while chasing down cylon fighters with a gigantic alien planet in the background is something which provides breathtaking experience. Some effects, like explosions, could have been better and some others, like the shaking of the ship in afterburner, are really nice.




SOUND DELIGHT → 9
The sound is a real plus of this game. Even if BTRL is not an official Battlestar Galactica game the guys of the development team put pieces by Bear McCreary and Richard Gibbs which, useless to say, create a unique atmosphere. Music apart, the game is rich of actor speech either during briefing or during space combat. This especially helps you to bathe into the pilot character; you will hear pilots chatting, swearing "frak!" and screaming for their life, this all melted with the crackling of the laser and the humming of the cylon fighters brushing your ship.



STORY ENCHANTMENT → 7
The story is set during Battlestar Galactica Season 2. You are a pilot recruit draft and pressed into service by the not-so-gentle folks of the Battlestar Pegasus. Who watched the show's already aware that the philosophy of the Pegasus captain concerned a struggle to survive which implied dismantling of the civilian ships it was supposed to protect. Your objective is do your job and becoming a first class pilot of the Pegasus forces and possibly not to get killed also.
I must say that the story is not that well told or present in the game. There's a lot of briefing (all spoken by actors) but no introductory sequences, no cinematics, and no after mission chill out activities such as interaction with the mother ship personnel or environment. Although this is only a demo of a future game, I must list this aspect within the cons.


MALUS POINTS → -5
Even is Beyond the Red Line is amazing under many aspects, to have only 3 single player missions to play which is simply disappointing.
Note: the source code of FreeSpace2 was released by Voliton, Inc. under a non commercial license. The source code can be used to produce mods and stand alone games and it's currently developed and maintained by the FreeSpace 2 Source Code Project

OVERALL SCORE → 6.7

Here below you can see a video footage showing the game in action.
If you want browse more videos you can check the Beyond the Red Line YouTube channel here

Monday, November 17, 2008

The Linux Game Box #3: Secret Maryo Chronicles



The game I'm about to present you for this instalment of The Linux Game Box, it's just one of those title so polished, smooth and fluid that lets you think that yes, there is hope for Linux to be just a little more of a gaming platform. I say this despite the simplicity that marks every aspect of this particular game.

I don't wanna waste more time so let me introduce you Secret Maryo Chronicles.

Title: Secret Maryo Chronicle
Genre: Platform
License: GNU Public License v3
Website: http://www.secretmaryo.org/

Secret Maryo Chronicles is platform game heavily inspired (someone could find it a clone) by Nintendo's Super Mario series. The game is coded in C++ with SDL and OpenGL libraries and it's really pretty fluid on my 4yo laptop. On January 2008 SMC has been awarded #1 in the 5 best (free) open source games chart by the Australian computer magazing APC.



INSTALLATION REQUIREMENTS → 7
To install Secret Maryo Chronicles on (K)Ubuntu is sufficient to add the repository to your repository list with Synaptic or Adept.
The repository for (K)Ubuntu Intrepid Ibex is this:
deb http://archive.ubuntu.com/ubuntu/ intrepid universe
The packages to be installed are called:
smc
smc-data
smc-music
The Ubuntu Package page can be found here. The download page on the official site is here


GAMEPLAY FUN → 9
Of course Secret Maryo Chronicles is pure fun. Just like the old 2D Super Mario games you have basically to explore and travel through various levels running and jumping to crush enemies or discover goodies hidden behind bricks. There's no more to say about it as this is a well tested formula of simple and mindless game fun. The sensation of running a Nintendo classic on your Linux machine is strong and, as far as I'm concerned, this is also a strong plus for this well done game.



GRAPHICS APPEAL → 8
The graphics is simple but just perfect for the game. I would say it's flawless either in concept or in design. The sprites and the world components are well refined with a great appeal. Again, main character apart all the graphics in the game strongly resemble that of Super Mario 2D games. This is not a drawback in my opinion but I must be honest and say that even if the guys in the wiki faq say they don't want to clone Super Mario (that's why they redrew the Maryo sprite) the sensation of playing a clone is pretty strong.
As already said the 2D engine runs perfectly fast in all the conditions I have been able to test.

SOUND DELIGHT → 6
The sound is generally nice and does is job well.  The music is well suited for the game and again it reminds the Nintendo block buster. The sound effects are nothing special but they work sufficiently well.

STORY ENCHANTMENT → 3
You couldn't expect the story to be a high score aspect in a game such as this one. The game ratio is all focused on the gameplay that, as I mentioned above, scrapes perfection. However even the Mario game's attempted to sketch a story, at least as a sort of frame to give a "structured sense" to the action. Super Maryo lacks in this aspect. When you start the game you are presented with no introduction and no hints are shown during the games (at least during the few levels I played). At the beginning there's just a map showing your progress in the world and that's all.
A manual for the built-in editor can be found in the game wiki here.

BONUS POINTS → 10
The game comes along with a built-in editor which is so simple and intuitive to be a valuable tool for enthusiast level creators. As a matter of fact by installing smc-data you are supplied with lots and lots of user created levels. To enter the editor you just press F8 when playing a level and you are allowed to modified everything with a drag and drop fashion by means of a side bar presenting all the game components. Creating a level with the SMC editor it's really simple and fun. To prove this you can see a screenshot of my messing around and creating a dummy Wiz & Chips level.




OVERALL SCORE → 8.6

Here below you can see a video footage showing the game in action.
If you want browse more videos you can check the Secret Maryo Chronicles YouTube channelhere