embedded linux ramblings

Sunday, February 18, 2007

building the reel strip

building the reel strip.

some thing about video slot machine.
there are two things that would have to decided do you have game that can be resized on the fly?
that is operator can enter into configuration console and switch
from 640x480 to 800x600 or 1024x768?
that would be the ideal.

but for this demo probably not.
everything should be set to 800x600.

things to do start using sprites for everything.

move sprite classes into main prog.

start putting anything related to positions into positions.h



cache + vector (vertical/horizontal) = sprite/image

cache.cellsize(x,y)

check when adding the cells that these apre part of compile value

create build_strip
sprite.buildstrip(vector,horiztal/vetical,alpha)

build the strip. if the strip is has the same nature as before use
this dont recreate because this strip gets built over and over

fix spline code.



check to see if images have the correct depth and size properties
but make algorith simple that is if your system ask for 128 pixel
images do so but make this explicit


class wrapped around sdl_surface

Monday, February 12, 2007

xorg configuration for make-live cd

first startx looks like this :
#!/bin/sh

# $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $

userclientrc=$HOME/.xinitrc
sysclientrc=/etc/X11/xinit/xinitrc


userserverrc=$HOME/.xserverrc
sysserverrc=/etc/X11/xinit/xserverrc
defaultclient=xterm # this is what is launching xterm
defaultserver=/usr/bin/X
defaultclientargs=""
defaultserverargs=""
clientargs=""
serverargs=""

if [ -f $userclientrc ]; then
defaultclientargs=$userclientrc
elif [ -f $sysclientrc ]; then
defaultclientargs=$sysclientrc

fi
if [ -f $userserverrc ]; then
defaultserverargs=$userserverrc
elif [ -f $sysserverrc ]; then
defaultserverargs=$sysserverrc
fi

whoseargs="client"
while [ x"$1" != x ]; do
case "$1" in
# '' required to prevent cpp from treating "/*" as a C comment.
/''*|\./''*)
if [ "$whoseargs" = "client" ]; then
if [ x"$clientargs" = x ]; then
client="$1"
else
clientargs="$clientargs $1"
fi
else
if [ x"$serverargs" = x ]; then
server="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
--)
whoseargs="server"
;;
*)
if [ "$whoseargs" = "client" ]; then
clientargs="$clientargs $1"
else
# display must be the FIRST server argument
if [ x"$serverargs" = x ] && \
expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
display="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
esac
shift
done

# process client arguments
if [ x"$client" = x ]; then
# if no client arguments either, use rc file instead
if [ x"$clientargs" = x ]; then
client="$defaultclientargs"
else
client=$defaultclient
fi
fi

# process server arguments
if [ x"$server" = x ]; then
# if no server arguments or display either, use rc file instead
if [ x"$serverargs" = x -a x"$display" = x ]; then
server="$defaultserverargs"
else
server=$defaultserver
fi
fi

if [ x"$XAUTHORITY" = x ]; then
XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY
fi

removelist=


# set up default Xauth info for this machine

# check for GNU hostname
if hostname --version > /dev/null 2>&1; then
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
hostname=`hostname -f`
fi
fi

if [ -z "$hostname" ]; then
hostname=`hostname`
fi

authdisplay=${display:-:0}
mcookie=`/usr/bin/mcookie`
dummy=0

# create a file with auth information for the server. ':0' is a dummy.
xserverauthfile=$HOME/.serverauth.$$
xauth -q -f $xserverauthfile << EOF
add :$dummy . $mcookie
EOF
serverargs=${serverargs}" -auth "${xserverauthfile}

# now add the same credentials to the client authority file
# if '$displayname' already exists don't overwrite it as another
# server man need it. Add them to the '$xserverauthfile' instead.
for displayname in $authdisplay $hostname$authdisplay; do
authcookie=`xauth list "$displayname" \
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
if [ "z${authcookie}" = "z" ] ; then
xauth -q << EOF
add $displayname . $mcookie
EOF
removelist="$displayname $removelist"
else
dummy=$(($dummy+1));
xauth -q -f $xserverauthfile << EOF
add :$dummy . $authcookie
EOF
fi
done
xinit $client $clientargs -- $server $display $serverargs

if [ x"$removelist" != x ]; then
xauth remove $removelist
fi
if [ x"$xserverauthfile" != x ]; then
rm -f $xserverauthfile
fi

if command -v deallocvt > /dev/null 2>&1; then
deallocvt
fi

Thursday, February 08, 2007

make-live live cd project

the project is located at http://wiki.debian.org/DebianLive
first the project is the best of what is out there and produces
the smallest image all the other seem to want to into the direction
of knoppix. that is produce a application heavy cd. i dont need this.

First if you dont install apt-cacher your builds will take forever.
edit the file /etc/default/apt-cacher
change the entry AUTOSTART=0 to AUTOSTART=1
then start the server by
/etc/init.d/apt-cacher start
when that is done do the folllowin
edit the /etc/make-live.conf file:
LIVE_MIRROR="http://localhost:3142/ftp.debian.org"

things in the chroot that need to edit
/etc/apt/sources.list seems to have the settings for apt-cacher
this needs to be removed if you need to mod the chroot

making the bootsplash rle file
you will net the netpbm software package and ppmtolss16
and the gimp.
note, that ppmtolss16 is installed with the debian syslinux package.

1. create a new splash.png file using gimp 640x320 resolution and save it
as splash-isolinux.png

2. Click menu: image > mode > indexed > maximum number of colors > set to 16 > ok

3. Click menu: file > save as > file type > PNG image > save (splash-isolinux.png)

In a console:

4. convert it to "pnm" by using "pngtopnm"
   % pngtopnm splash.png > splash.pnm

5. convert it to "rle" by using "ppmtolss16"
% ppmtolss16 <>splash-isolinux.rle


see the document http://www.geexbox.org/wiki/index.php/How_to_create_a_theme
for decent explanation of this.




goals for this project:
1) brand the bootup screen for a specific splash rle file.
2) simplify the boot up options.
3) make sure that if xorg dies or the program crash xorg is restarted and will restart
the game application or game launcher application.
4) be able to add a deb package of the gaming software to the system, possible without
a complete rebuild of the underlying cdrom image.
5) slim down every thing.
6) the xorg resolution is way to high i needs to be set at 800x600
--------------------------------------------------------------------------------------
1) part of 1 is done with splash.rle file mentioned above.
2) this means altering the file isolinux.cfg this file is included in the --template
option of the make-live prog.
3) the file casper-login script does this:
USERNAME=casper
[ -f /etc/casper.conf ] && . /etc/casper.conf
exec su -l -c /usr/bin/startx $USERNAME
#exec /bin/login -f $USERNAME
4) this means know how to build deb packages. this is big one and i dont get know
how to do this. a possible way to start would be to take a small deb prog and modify
to my uses.
5) slimming means a couple of things. first running a script inside the chroot. this is
a good thing as you are going to be removing files and the worst that might happen is the
chroot will get trashed and not the outer system. the slimming script
will be included with directory designated with the --include-chroot and be run with --hook
option
6) xorg resolution is is probably last reall big task slimming down i will attack piecmeal

make-live has a nice option --

Friday, December 08, 2006

books of note about states

Pattern Hatching by John Vlisside discusses
the Mememento pattern on pages 102 to about 106+

How to Design Programs
An introduction to Programming and Computing
Matthias Felleisen (scheme language)

Tuesday, December 05, 2006

matt buckland : ai book excerpts

Buckland, Mat.
Programming game AI by example / by Mat Buckland.
p. cm.
Includes index.
ISBN 1-55622-078-2 (pbk.)
1. Computer games — Design. 2. Computer games — Programming. 3.Computer
graphics. I. Title.
QA76.76.C672B85 2004
794.8'1526 — dc22

class State
{
public:
virtual void Execute (Troll* troll) = 0;
};

Now imagine a Troll class that has member variables for attributes such as health, anger, stamina, etc., and an interface allowing a client to query and adjust those values. A Troll can be given the functionality of a finite state machine by adding a pointer to an instance of a derived object of the State class, and a method permitting a client to change the instance the pointer is pointing to.

class Troll
{
/* ATTRIBUTES OMITTED */

State* m_pCurrentState;

public:

/* INTERFACE TO ATTRIBUTES OMITTED */

void Update()
{
m_pCurrentState->Execute(this);
}

void ChangeState(const State* pNewState)
{
delete m_pCurrentState;
m_pCurrentState = pNewState;
}
};

Wednesday, November 22, 2006

how to build qt3 for win32

install the cvs client from http://www.wincvs.org/ its smaller than
the one from cygwin.

then do the following

http://qtwin.sourceforge.net/qt3-win32/compile-net.php

Requirements

* Windows 2000 or XP
* a cvs client (for example from http://www.cvsnt.org), when using the kde cvs server
* Visual Studio .NET or .NET 2003

Get the Q... sources

* by downloading a Q... source snapshot from the KDE-Cygwin snapshot area
* or from the cvs repository

first connect to the cvs server

c:\source> cvs -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin login

enter empty password
then checkout the sources with

c:\source> cvs -z3 -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin co -r QT_WIN32_3_3_BRANCH qt-3

Compiling Qt with command line tools

* Open a cmd shell
* Setup your compiler environment (please adjust the path to your needs)

c:\source> "c:\Programme\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"

* Setup Q.. environment

c:\source> set QTDIR=< qt3 source root>
c:\source> set PATH=%QTDIR%\bin;%PATH%
c:\source> set QMAKESPEC=win32-msvc.net

* Configure and build the source
The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt-headers into the include-directory. configure.exe is the replacement for the ./configure-script unter Unix/Linux. After that, qmake.exe is build and the compilation gets started.

c:\source> cd < qt3 source root >
c:\source\qt-3> configure.bat [-fast] [-verbose]

configure knows some of the parameters of the x11 release configure script like -fast or -verbose.
For a full list see bin\configure.exe -help.

This should build the whole Qt release. If it breaks you can restart compiling with

c:\source\qt-3> nmake [< target >]

for a list of all available targets see the toplevel Makefile
* Start Q.. applications

c:\source\qt-3> designer
c:\source\qt-3> assistant
c:\source\qt-3> linguist
c:\source\qt-3> cd tutorial\t1
c:\source\qt-3\tutorial\t1> t1