Freitag, 18. Juli 2008

BlobbyVolley for OpenSUSE 11.0


Finally I packaged Blobby for the distribution (after applying some small fixes, like adding the
#include <algorithm>
statement).
For those who do not know Blobby:

BlobbyVolley is the head-to-head multiplayer volleyball game. It is one of the best games to be played between some ego-shooters (like Unreal Tournament or Quake) at LAN-partys :-)

At least to play you need to change:



  • create in your home directory (e.g. mkdir /home/pkirsch/.blobby) the ".blobby" directory.
  • copy from /usr/share/games/blobbyvolley/ the data directory in your freshly created .blobby directory
  • Why? some config files are needed to start BlobbyVolley
  • If you have problems with starting the game in your OpenSUSE then change in your config.xml (located in your .blobby directory)


    <?xml version="1.0" encoding="utf-8"?>

    <userconfig>
    <var name="device" value="SDL"/>
    <var name="fullscreen" value="false"/>
    <var name="left_blobby_color_r" value="0"/>
    <var name="left_blobby_color_g" value="0"/>
    <var name="left_blobby_color_b" value="255"/>
    <var name="left_blobby_oscillate" value="false"/>
    <var name="right_blobby_color_r" value="255"/>
    <var name="right_blobby_color_g" value="0"/>
    <var name="right_blobby_color_b" value="0"/>
    <var name="right_blobby_oscillate" value="false"/>
    <var name="left_script_name" value="dumbjump.lua"/>
    <var name="right_script_name" value="simbel.lua"/>
    <var name="left_player_human" value="true"/>
    <var name="right_player_human" value="true"/>
    <var name="left_player_name" value="Left Player"/>
    <var name="right_player_name" value="Right Player"/>
    <var name="gamefps" value="75"/>
    <var name="global_volume" value="0.960000"/>
    <var name="mute" value="false"/>
    <var name="scoretowin" value="15"/>
    <var name="showfps" value="false"/>
    <var name="blood" value="false"/>
    <var name="background" value="strand1.bmp"/>
    <var name="network_side" value="0"/>
    <var name="network_last_server" value="blobby.openanno.org"/>
    </userconfig>

    change the string "OpenGL" to "SDL" and it should work (otherwise open me a bug at Novell's Bugzilla)
  • Some hint: Some libraries are needed: SDL physfs boost but they should all installable with zypper in SDL physfs boost

Sources and Wiki:


BlobbyVolley at sf.net

Mittwoch, 9. Juli 2008

Spielen unter Linux: bomberclone (Bomberman) mit Joypad

Warum der Aufwand?


Linux mit seiner Spielvielfalt kann durchaus als Nintendos WII Ersatz (alternativ auch Sonys Playstation 3) genutzt werden und da Studenten im Allgemeinen nicht so viel Geld zur Verfügung haben, muss man sich eben einen Spielkonsole-Klon selbst schaffen :-). Die Erfahrung hat gezeigt: Spielekonsolen sind oft nur für einen Monat interessant und landen danach in der Ecke. Außerdem bekommt so der alt-gediente Pentium III 800 MHz noch einmal neues Leben, in Kombination mit einem großen TFT Monitor oder Flachbildschirm.

Die WII ist eher als gesellschaftliches Party-Spielgerät orientiert und genau das will ich auch mittels Linux (in dem Fall OpenSUSE 11.0) und den Arcade Klassikern haben.

Am liebsten wäre mir eine Linux Distribution (wie Knoppix) einfach ins CDRom Laufwerk, booten und direkt auswählen, welches Spiel nun gestartet werden soll.

Dabei gibts aber Probleme:

  • es fehlt die Keypad (oder Joypad) Unterstützung in vielen Spielen (und versuche einmal auf die Schnelle deinen Freunden die "WASD" Spielesteuerung bzw. die zweifach oder vielfache belegte Tastatur/Tastenkombination zu erklären). Da ist ein USB basierendes Joypad für 5€ von Ebay schon Gold wert. Zumal wer möchte sich schon zu dritt eine Tastatur teilen, nur um ein Spiel zu bedienen (alternativ kann man jedem Mitspieler auch seine eigene USB-Tastatur geben)? Diese liegen eher unhandlich auf dem Schoß und man kann sein Bier nicht ordentlich trinken kann, eben weil man die Tastatur festhalten muss.

  • das zweite Problem der Distribution wäre die automatische Grafikkarteninstallation (out-of-the-box) ohne umständigerweise die Online-Repositories von ATI oder Nvidia zu installieren und danach die Grafikkarten erstmal einzurichten (bzw. auch den X-Server).



Bomberclone


Dieses Spiel ist Bestandteil der OpenSUSE 11.0 Distribution und kann somit ohne Probleme mit zypper in bomberclone installiert werden.

Joystick bzw. Joypad



  • nach dem Anstecken des Joypads an den USB Port sollte man in der Ausgabe von /bin/dmesg folgendes entdecken:


    usb 5-1: new low speed USB device using uhci_hcd and address 24
    usb 5-1: configuration #1 chosen from 1 choice
    input: GreenAsia Inc. USB Joystick as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input29
    input,hidraw1: USB HID v1.10 Joystick [GreenAsia Inc. USB Joystick ] on usb-0000:00:1d.3-1
    usb 5-1: New USB device found, idVendor=0e8f, idProduct=0012
    usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    usb 5-1: Product: USB Joystick
    usb 5-1: Manufacturer: GreenAsia Inc.

  • folgend sollte "/dev/js0" vorhanden sein (also der erste Joystick)
  • um zu prüfen ob sie Signalübertragung auch funktioniert (funktionalen Test) kann man ein "cat /dev/js0" ausführen. Anschließend sollte die Ausgabe diverse Zeichen bei Betätigung der Achsen bzw. der Aktionsknöpfe enthalten.

Beispiel zur Joystickabfrage



/* Tipp: http://de.wikibooks.org/wiki/SDL:_joypad
kompilieren mit :
gcc joypad.c -o joypad `sdl-config --libs` `sdl-config --cflags` */

#include
#include "SDL.h"

int main ()
{
int i;
unsigned int n;
short a;

if ( SDL_InitSubSystem ( SDL_INIT_JOYSTICK ) < 0 )
{
fprintf ( stderr, "Unable to initialize joypad: %s\n", SDL_GetError() );
return -1;
}
printf ( "Es sind %i joypads erkannt.\n", SDL_NumJoysticks () );

/* Hier wird allerdings nur der erste joypad verwendet*/
SDL_Joystick* joypad = SDL_JoystickOpen ( 0 );
if ( joypad == NULL ) {
printf ( "joypad konnte nicht geöffnet werden.\n" );
return -2;
}

printf ( "joypad hat %i Achsen\n", SDL_JoystickNumAxes ( joypad ) );
printf ( "joypad hat %i joypads\n", SDL_JoystickNumBalls ( joypad ) );
printf ( "Joypad hat %i Köpfe\n", SDL_JoystickNumHats ( joypad ) );
printf ( "Joypad hat %i Knöpfe\n", SDL_JoystickNumButtons ( joypad ) );

SDL_JoystickEventState ( SDL_QUERY );

while ( 1 )
{
SDL_JoystickUpdate ();
for ( i=0; i < SDL_JoystickNumButtons ( joypad ); ++i )
{
n = 0;
n = SDL_JoystickGetButton ( joypad, i );
if ( n != 0 )
printf ( "Knopf gedrückt: %i\n", i );
}
for ( i=0; i < SDL_JoystickNumAxes ( joypad ); ++i )
{
a = 0;
a = SDL_JoystickGetAxis ( joypad, i );
if ( a != 0 )
printf ( "Achse %i betätigt mit Wert %d\n", i,a );
}
}
}
return 0;
}


Joypad Patch für Bomberclone


Mit Hilfe des obigen Beispiels ist/war es ein leichtes das Spiel zu erweitern. Wer mag kann Bomberclone auch einmal abends mit seinen Freunden spielen. Ich habe den Patch dem Maintainer übergeben und er dürfte bei dem nächsten Update der Distribution mit dabei sein.

Resumee
Der Spielspass mit Joypad ist einfach unübertroffen.