Freecraft-1.2 old Warcraft2 clone

Play with your Puppy.
Post Reply
Message
Author
goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

Freecraft-1.2 old Warcraft2 clone

#1 Post by goingnuts »

Freecraft is an old warcraft2 clone. Attached a static build. You will need the datafiles installed before you can actually play the game. Extract the content of the fcmp-1.18.20030311-archive into folder /usr/share/games/freecraft and symlink directory data to default (ln -s data default).
The game is playable including sounds and music...
UPDATE 20120808: The static build turned out to be unstable so the pet is removed. I have uploaded a new dynamic linked bin which seems to be stable. Compiled on P412 with SDL static linked in so you do not need to have SDL-libs installed. Hope this one is stable!
Update 20120811: Added script to extract original WC2 graphics & sounds
Update 20120814: Finally found a way to build a static version with uclibc/tinyX11 - removing flags -DUSE_SDLA -DUSE_SDLCD seems to make the build stable. So attached a package with this build below.
Update 20120816: New static build with support for CD-music and support for mp3 & ogg sound formate uploaded (below) and script to unpack & convert sound files here.
Update 20120823: Removed dynamic linked version as the static version seems stable and the dynamic was build with debugging on.
Update 20120919: New build uploaded that also works using Xorg...
Update 20130501: Removed attached files as forum no longer support the download. For download go here
Attachments
snap0000.png
(185.34 KiB) Downloaded 1799 times
Last edited by goingnuts on Wed 01 May 2013, 18:19, edited 8 times in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Just a first note : Seems to work on my Macpup_F3 (Puppy-4.3) installation. Have just opened the welcome screen cause am building gcc-4.6.3 atm, but worked. I am guessing there is a --windowed parameter somewhere.

Many thanks !

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#3 Post by goingnuts »

@Karl Godt: Thanks for testing! Should run on most if not all puppy versions as no external libraries should be needed. The source for 1.20 holds no documentation and also some nifty tools to apparently use the graphics and sound/music from the original game CD are missing. The source for 1.18 has the documentation and the tools although I haven't been able to compile that version. The older versions can be found here.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

Thanks, goingnuts . Have no idea, but it crashes after ~5 peasants and buildings .
Half of it it justs quits and half of the time whole xorg/kernel do not respond anymore :
(transparency support disabled)
ERROR: type number out of range
FATAL ERROR DURING STARTUP OR CRITICAL CODE SECTION

Tested it also on my Lupu-511 and it does not start there :
_X11TransSocketINETConnect: Can't get address for puppy_luci_218
_X11TransSocketINETConnect: Can't get address for puppy_luci_218
Couldn't set 640x480x0 video mode: Couldn't set console screen info
I also have no windowed mode . It occupies the whole screen.

Have recompiled it just ./configure on Puppy-511 and it runs there .
Have also recompiled it on Macpup_F3 "./configure" and it builds but i have a black screen with nothing.

It does not build on Macpup-Opera2 with newer SDL installed. But the compilation of F3 runs nice in windowed mode on Opera_2 .

Your "static" build i guess is "upx -static" .

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#5 Post by goingnuts »

Yes - its upxed. I can confirm that it is unstable :cry: . I have tried to track it down by enable debug but no indications. A dynamic build seems stable until now so I will replace the pet with that until I get the static build working.
Not sure why the windowed mode not working. Have you tried setting screen-size via options in the welcome screen?

Anyway thanks a lot for testing and reporting the error!

Its really a nice game! Haven't been able to pass first single player game yet so lots of challenge here!

For changing the graphics I found that wargus-2.2.4 hold the tool to extract sound and graphic from original WC2-CD or files...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#6 Post by Karl Godt »

goingnuts wrote:Yes - its upxed. I can confirm that it is unstable :cry: . I have tried to track it down by enable debug but no indications. A dynamic build seems stable until now so I will replace the pet with that until I get the static build working.
Not sure why the windowed mode not working. Have you tried setting screen-size via options in the welcome screen?

Anyway thanks a lot for testing and reporting the error!

Its really a nice game! Haven't been able to pass first single player game yet so lots of challenge here!

For changing the graphics I found that wargus-2.2.4 hold the tool to extract sound and graphic from original WC2-CD or files...
It seems that LDFLAGS="-static -s" don't work correctly . A static build usually is bigger than a dynamic build, but here it seems to be the other way : it becomes smaller.

With these configuration options :

Code: Select all

./configure --prefix=/opt/freecraft-1.20-static-static CFLAGS="-Os -static -s" LDFLAGS="-static -s"
I get these dependencies :

Code: Select all

bash-3.00# cd bin
bash-3.00# ldd freecraft 
	linux-gate.so.1 =>  (0xb7884000)
	libSDL-1.2.so.0 => /usr/local/lib/libSDL-1.2.so.0 (0xb77ef000)
	libiconv.so.2 => /usr/lib/libiconv.so.2 (0xb7717000)
	libdirectfb-1.2.so.0 => /usr/lib/libdirectfb-1.2.so.0 (0xb769f000)
	libfusion-1.2.so.0 => /usr/lib/libfusion-1.2.so.0 (0xb7695000)
	libdirect-1.2.so.0 => /usr/lib/libdirect-1.2.so.0 (0xb767f000)
	libts-0.0.so.0 => /usr/lib/libts-0.0.so.0 (0xb767b000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7663000)
	libpng12.so.0 => /lib/libpng12.so.0 (0xb763d000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb7520000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb751c000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7516000)
	libz.so.1 => /lib/libz.so.1 (0xb7501000)
	libbz2.so.1.0 => /lib/libbz2.so.1.0 (0xb74ef000)
	libdl.so.2 => /lib/libdl.so.2 (0xb74eb000)
	libm.so.6 => /lib/libm.so.6 (0xb74c4000)
	libc.so.6 => /lib/libc.so.6 (0xb737b000)
	/lib/ld-linux.so.2 (0xb7885000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb7361000)
And file recognizes:

Code: Select all

bash-3.00# file freecraft
freecraft: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.15, dynamically linked (uses shared libs), stripped
And sizes are

Code: Select all

bash-3.00# ls -s --block-size=1kB freecraft
803 freecraft
bash-3.00# ls -s --block-size=1K freecraft
784 freecraft
*

With the windowed mode i meant

Code: Select all

	-v mode		Video mode (0=default,1=640x480,2=800x600,
				3=1024x768,4=1280x960,5=1600x1200)
	-W		Windowed video mode (only supported with SDL)
which were ignored . I got full screen and in the "Global Options" the checkbox "Fullscreen" had a sticky mark which would not untick. Probably it is partly a Xorg-1.3.0 vesa driver problem. Xorg-1.7.6 loads intel driver.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#7 Post by goingnuts »

@Karl Godt: I gave up on configure...and use the below makefile to compile and control the build:

Code: Select all

CC=gcc

#-nodefaultlibs 
COMPFLAGS=-pipe -Os -mtune=i386 -Wall -fno-strength-reduce -fno-strict-aliasing -I. -I../src/include -Isrc/include -I/usr/include/SDL -I/usr/include

COMMONDEFS=$(COMPFLAGS) -D_BSD_SOURCE -D_GNU_SOURCE

LDFLAGS=-Wl,--gc-sections,--sort-common,-s

LINKDIR=-L/usr/lib

INSTALLDIR=/usr/bin

DEFS=-DHAVE_CONFIG_H  -DUSE_CCL -DUSE_SDL -DUNIT_ON_MAP -DBUILDING_DESTROYED  -DUSE_HP_FOR_XP -DNEW_AI -DNEW_FOW -DUSE_LIBMODPLUG -DWITH_SOUND -DUSE_SDLA -DUSE_SDLCD -DUSE_BZ2LIB -DUSE_ZLIB 

#-DDEBUG 

CFLAGS=-pipe -Os -mtune=i386 -Wall $(COMMONDEFS) $(DEFS)

OBJS=$(wildcard etlib/*.c src/action/*.c src/ai/*.c src/beos/*.c src/clone/*.c src/editor/*.c src/game/*.c src/libmodplug/*.c src/map/*.c src/missile/*.c src/network/*.c src/pathfinder/*.c src/siod/*.c src/sound/*.c src/ui/*.c src/unit/*.c src/video/*.c *.c)

freecraft:	$(OBJS:.c=.o) 
	${CC} ${CFLAGS} -o freecraft $(OBJS) ${LDFLAGS} /usr/lib/libSDL.a /usr/lib/libbz2.a /usr/lib/X11/libXext.a /usr/lib/X11/libX11.a /usr/lib/X11/libXdmcp.a /usr/lib/X11/libXau.a /usr/lib/libpng.a /lib/libz.a /usr/lib/libm.a -L/usr/lib -lpthread -ldl -lc 
	
#-lSDL -lbz2  -lXext -lXdmcp -lXau -lX11  -ldl -lpng -lz -lm 
#/usr/lib/libpng.a   

clean:
	rm -f *.o freecraft etlib/*.o src/action/*.o src/ai/*.o src/beos/*.o src/clone/*.o src/editor/*.o src/game/*.o src/libmodplug/*.o src/map/*.o src/missile/*.o src/network/*.o src/pathfinder/*.o src/siod/*.o src/sound/*.o src/ui/*.o src/unit/*.o src/video/*.o *.o
	
install:
	cp -f freecraft $(INSTALLDIR)
	
depend:
	gccmakedep -- $(CFLAGS) -- etlib/*.c src/action/*.c src/ai/*.c src/beos/*.c src/clone/*.c src/editor/*.c src/game/*.c src/libmodplug/*.c src/map/*.c src/missile/*.c src/network/*.c src/pathfinder/*.c src/siod/*.c src/sound/*.c src/ui/*.c src/unit/*.c src/video/*.c *.c
and with the following content in config.h:

Code: Select all

#define HAVE_DLFCN_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIBDL 1
#define HAVE_LIBM 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define LT_OBJDIR ".libs/"
#define PACKAGE "freecraft"
#define PACKAGE_BUGREPORT "http://projects.comum.org/freecraft"
#define PACKAGE_NAME "FreeCraft"
#define PACKAGE_STRING "FreeCraft 1.20"
#define PACKAGE_TARNAME "freecraft"
#define PACKAGE_URL ""
#define PACKAGE_VERSION "1.20"
#define STDC_HEADERS 1
#define VERSION "1.20"
Using the above make file gives me a freecraft with size 2Mb and the following dependencies:

Code: Select all

ldd freecraft 
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7efd000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7ef9000)
        libc.so.6 => /lib/libc.so.6 (0xb7dfe000)
        /lib/ld-linux.so.2 (0xb7f13000)
I haven't been able to do a static build with normal glibc - my original static build was made with uclibc and tinyX11...

Just thought of the missing response to " -W Windowed video mode (only supported with SDL)" and the list of your dependency: Could it be that directfb is used/preferred and SDL is not?

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#8 Post by Karl Godt »

Just thought of the missing response to " -W Windowed video mode (only supported with SDL)" and the list of your dependency: Could it be that directfb is used/preferred and SDL is not?
No.

On P-511 i have compiled SDL with tslib and DirectFB.

I have recompiled SDL on Macpup in bulk and now freecraft-1.20 is running correctly there.

List of SDL* :

Code: Select all

0 	/usr/lib/libSDL-1.2.so.0
476	/usr/lib/libSDL-1.2.so.0.11.2
328	/usr/lib/libSDL-1.2.so.0.11.3
404	/usr/lib/libSDL-1.2.so.0.7.2
584	/usr/lib/libSDL.a
4	/usr/lib/libSDL.la
4	/usr/lib/libSDLmain.a
0	/usr/lib/libSDL_mixer-1.2.so.0
180	/usr/lib/libSDL_mixer-1.2.so.0.2.6
0	/usr/lib/libSDL.so
0	/usr/local/lib/libSDL-1.2.so.0
476	/usr/local/lib/libSDL-1.2.so.0.11.0
488	/usr/local/lib/libSDL-1.2.so.0.11.2
484	/usr/local/lib/libSDL-1.2.so.0.11.3
472	/usr/local/lib/libSDL-1.2.so.0.11.4
0	/usr/local/lib/libSDL-1.3.so.0
832	/usr/local/lib/libSDL-1.3.so.0.0.0
2952	/usr/local/lib/libSDL.a
240	/usr/local/lib/libSDL_gfx.a
4	/usr/local/lib/libSDL_gfx.la
0	/usr/local/lib/libSDL_gfx.so
0	/usr/local/lib/libSDL_gfx.so.13
84	/usr/local/lib/libSDL_gfx.so.13.5.2
92	/usr/local/lib/libSDL_gfx.so.13.9.1
0	/usr/local/lib/libSDL_image-1.2.so.0
48	/usr/local/lib/libSDL_image-1.2.so.0.8.2
48	/usr/local/lib/libSDL_image-1.2.so.0.8.2.backup.SDL_image-1.2.10-i686.pet
48	/usr/local/lib/libSDL_image-1.2.so.0.8.4
0	/usr/local/lib/libSDL_image-1.2.so.0.backup.SDL_image-1.2.10-i686.pet
232	/usr/local/lib/libSDL_image.a
232	/usr/local/lib/libSDL_image.a.backup.SDL_image-1.2.10-i686.pet
4	/usr/local/lib/libSDL_image.la
4	/usr/local/lib/libSDL_image.la.backup.SDL_image-1.2.10-i686.pet
0	/usr/local/lib/libSDL_image.so
0	/usr/local/lib/libSDL_image.so.backup.SDL_image-1.2.10-i686.pet
4	/usr/local/lib/libSDL.la
4	/usr/local/lib/libSDLmain.a
4	/usr/local/lib/libSDLmain.la
0	/usr/local/lib/libSDL_mixer-1.2.so.0
168	/usr/local/lib/libSDL_mixer-1.2.so.0.12.0
392	/usr/local/lib/libSDL_mixer-1.2.so.0.2.6
456	/usr/local/lib/libSDL_mixer.a
4	/usr/local/lib/libSDL_mixer.la
0	/usr/local/lib/libSDL_mixer.so
0	/usr/local/lib/libSDL_net-1.2.so.0
16	/usr/local/lib/libSDL_net-1.2.so.0.0.7
16	/usr/local/lib/libSDL_net-1.2.so.0.8.0
48	/usr/local/lib/libSDL_net.a
4	/usr/local/lib/libSDL_net.la
0	/usr/local/lib/libSDL_net.so
36	/usr/local/lib/libSDL_Pango.a
4	/usr/local/lib/libSDL_Pango.la
0	/usr/local/lib/libSDL_Pango.so
0	/usr/local/lib/libSDL_Pango.so.1
16	/usr/local/lib/libSDL_Pango.so.1.1.0
0	/usr/local/lib/libSDL.so
0	/usr/local/lib/libSDL_sound-1.0.so.1
160	/usr/local/lib/libSDL_sound-1.0.so.1.0.2
632	/usr/local/lib/libSDL_sound.a
4	/usr/local/lib/libSDL_sound.la
0	/usr/local/lib/libSDL_sound.so
0	/usr/local/lib/libSDL_stretch-0.so.3
16	/usr/local/lib/libSDL_stretch-0.so.3.0.0
12	/usr/local/lib/libSDL_stretch.a
4	/usr/local/lib/libSDL_stretch.la
0	/usr/local/lib/libSDL_stretch.so
0	/usr/local/lib/libSDL_ttf-2.0.so.0
24	/usr/local/lib/libSDL_ttf-2.0.so.0.10.1
24	/usr/local/lib/libSDL_ttf-2.0.so.0.6.3
64	/usr/local/lib/libSDL_ttf.a
4	/usr/local/lib/libSDL_ttf.la
0	/usr/local/lib/libSDL_ttf.so
0	/usr/local/lib/SDL_stretch/libSDL_stretch_test-0.so.3
8	/usr/local/lib/SDL_stretch/libSDL_stretch_test-0.so.3.0.0
4	/usr/local/lib/SDL_stretch/libSDL_stretch_test.a
4	/usr/local/lib/SDL_stretch/libSDL_stretch_test.la
0	/usr/local/lib/SDL_stretch/libSDL_stretch_test.so
I have used that script to compile bunches in a directory :

Code: Select all

#!/bin/sh

###
#
#
#
###

cd "`pwd`"
CURR_DIR="$PWD"
me_base_name="${0##*/}"
BEGIN=`grep -n '^###\*\*\*BEGIN\*\*\*###' "$0" |cut -f1 -d:`
((BEGIN++))
#end_of_file=100 ## linenr.
if [ -x "$CURR_DIR"/"$me_base_name" ];then
./"$me_base_name"
else
sed -n "$BEGIN,$ p" "$0" > "$CURR_DIR"/"$me_base_name"
chmod +x "$me_base_name"
./"$me_base_name"
fi
exit $?


###***BEGIN***###
#/bin/sh
#####################
cd "`pwd`"
CURR_DIR="$PWD"
me_base_name="${0##*/}"
echo "###
# `date`
###" >> "$CURR_DIR"/"$me_base_name"

###
#
#
#
###
set -x
cd "`pwd`"
CURR_DIR="$PWD"

for i in *.tar.*;do
[ -f "$i" ] || continue
echo "$i"
case "${i##*\.}" in
gz) O=-z;;
bz2) O=-j;;
xz) O=-J;;
lzo) O=--lzop;;
lzma) O=--lzma;;
Z) O=-Z;;
esac
I="${i##*/}"
J="${I//\.tar\.*/}"
echo "$J"
[ -d "${J}" ] && continue
tar $O -x -f $i
done

for i in *;do
[ -d $i ] || continue
[ -f $i/configure ] || continue
[ -f $i/Makefile ] && continue
cd $i
./configure
[ $? -ne 0 ] && touch configure_not
cd "$CURR_DIR"
done

for i in *;do
[ -d $i ] || continue
[ -f $i/Makefile ] || continue
[ -e $i/configure_not ] && continue
cd $i
make 2>>make-errs.log
if [ $? != 0 ];then
geany make-errs.log &
cd "$CURR_DIR"
continue
fi
#[ $? = 0 ] || { geany make-errs.log &
#cd "$CURR_DIR";continue; }
make install 2>>make_install-errs.log
if [ $? != 0 ];then
geany make_install-errs.log &
cd "$CURR_DIR"
continue
fi
#[ $? = 0 ] || { geany make_install-errs.log &
#cd "$CURR_DIR";continue; }

new2dir -f -r
sleep 2m
cd "$CURR_DIR"
done
where i have altered new2dir to run in force mode and rescue runs find command instead of installwatch.
I duplicates itself into the directory to be further used as ' ./"$me_base_name" ' to be able to alter configure options on it.

After that i was reading your question, so i compiled DirectFB en bunch too, which succeeded from version 1.0.1 to 1.4.17 simply "./configure" and randomly parts of these with

Code: Select all

 ./configure --enable-static --disable-shared --enable-x11 --enable-text --enable-gettid --enable-network --enable-multi --enable-voodoo --enable-unique --enable-mmx --enable-sse --enable-devmem --enable-fbdev --enable-sdl --enable-vnc --enable-sysfs --enable-jpeg --enable-zlib --enable-png --enable-gif --enable-freetype --enable-video4linux --enable-video4linux2 --with-smooth-scaling
Then before recompiling SDL again i started my freecraft compiles and now they work correctly.
Dependencies now :

Code: Select all

	linux-gate.so.1 =>  (0xb806f000)
	libiconv.so.2 => /usr/lib/libiconv.so.2 (0xb7f96000)
	libvga.so.1 => /usr/local/lib/libvga.so.1 (0xb7f1a000)
	libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0xb7f03000)
	libXau.so.6 => /usr/local/lib/libXau.so.6 (0xb7f00000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7efb000)
	libSDL-1.2.so.0 => /usr/local/lib/libSDL-1.2.so.0 (0xb7e4b000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7e36000)
	libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7e13000)
	libX11.so.6 => /usr/local/lib/libX11.so.6 (0xb7d07000)
	libz.so.1 => /lib/libz.so.1 (0xb7cf8000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7cf4000)
	libm.so.6 => /lib/libm.so.6 (0xb7cd1000)
	libc.so.6 => /lib/libc.so.6 (0xb7bd6000)
	/lib/ld-linux.so.2 (0xb8070000)
where libvga might be pulled in by libsdl1.2/SDL-1.2 .
The other libSDL_* libs may not be necessary.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#9 Post by goingnuts »

Thanks for sharing your scripts and findings! I have tried to get some of the tools from 1.18 working and now I have the "wartool": Can extract all the original graphics and sounds from WC2 giving the possibility to play the original campaigns. Attached an image of freecraft running with the "new" data-set. There are also a tool called startool - best guess is that we also can get freecraft to play starcraft...
I will post the wartool and additional scripts when they are more polished.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

That's completely different data files your screenshot is showing . Nice !

I am wondering if it is possible to use the freecraft GUI to create new directories, instead of using rox to navigate there. All he .pud puzzledata files are .gz . Wondering what BZLIB should do for freecraft.

BTW : freecraft should have a default key binding for the "Print Key" to make screenshots that get laid into the top level of the $HOME directory under names "screen[NR].png" (mine does work) :

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#11 Post by goingnuts »

BTW : freecraft should have a default key binding for the "Print Key" to make screenshots that get laid into the top level of the $HOME directory under names "screen[NR].png" (mine does work) :
Cant get that working...

As for choosing which data-dir to use inside freecraft I think it is not possible. We can create menu-actions where "-d datapath" is part of the command as an alternative.

I did try to recursively convert gz to bz2 but bz2 seems to have problems with files containing spaces. We should be able to reduce size on disk by 10-15% if bz2 is used.

Another approach could be to reduce number of colors in all the png-files. A command line tool is needed here - anyone got one laying around?

I have tried to find the original starcraft on the web but have failed until now - any hints here are welcome.

Attached archive holds source, scripts and data for my modified wartool to get access to the original WC2 graphics and campaigns.

If you do not have the original WC2 cdrom you can find different sources on the web. I have used this for my testing. It does not hold the expansion pack so I haven't been able to test if wartool also works if expansion is present...

The freecraft AI is really hard to beat...
There are two possibilities to make the game more "human":

Code: Select all

-f factor
              With  this  parameter  you will set up the relative cost for the
              computer’s units.  Default is 100. If you set this to  a  higher
              value,  computer  will have to spend more resources for creating
              units, and viceversa.
-s number
              Number  of  frames before AI awakes. This is useful if the AI is
              beating you hard, and you want to make it sweet like a cat.  The
              higher,  the  easier will be the game against the AI. Default is
              to sleep 0 time frames.
Update 20130501: Removed attached files as forum no longer support the download. For download go here.
Last edited by goingnuts on Wed 01 May 2013, 18:23, edited 2 times in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#12 Post by goingnuts »

I have uploaded a new static build which support CD-music and mp3&ogg sound formate. The CD-support enables you to play music from your CD-drive...
mp3/ogg sound support enables conversion of the sound files from wav to mp3/ogg which can reduce used space on disk for the sound-files.
Below example data from sound directory (original WC2data) - sizes before and after conversion:

wav.gz: 3465K
wav: 4597K
mp3(16KBits 11.025KHz): 1108K
mp3(32KBits 11.025KHz): 1994K
ogg(mono, 11025KHz 29000bps):2542K

Script to unpack/convert your data:

Code: Select all

#!/bin/sh
#save space on disk for freecraft audiofiles - goingnuts 20120816
#recursive gunzip wav files for freecraft
#and convert to mp3 or ogg
CURDIR=$(pwd)
#get command line start dir
[ ! ${1} = "" ] && STARTDIR=${1} || STARTDIR=${CURDIR}
#get command line outputformate
[ ! ${2} = "" ] && OUTPUT="${2}" ||	OUTPUT="mp3"
if [ -d "${STARTDIR}" ]; then
	cd "${STARTDIR}"
else
	echo "directory does not exist"
	exit
fi
find . -print0 | while read -d $'\0' file; do 
	EXTENSION="${file##*.}"
	FILENAME="${file%.*}"
	case $FILENAME in
		*.wav)	echo $FILENAME
				if [ "${EXTENSION}" = "gz" ]; then
					gunzip -q "$file"
					if [ "${OUTPUT}" = "mp3" ]; then
						lame -V2 --silent "${FILENAME%.*}.wav" "${FILENAME%.*}.mp3"
						rm -f "${FILENAME%.*}.wav"
					fi
					if [ "${OUTPUT}" = "ogg" ]; then
						oggenc --quiet "${FILENAME%.*}.wav"
						rm -f "${FILENAME%.*}.wav"
					fi					
				fi
			;;
	esac
done
#modify ccl/sound.ccl
if [ "${OUTPUT}" = "mp3" ]; then
	echo "hacking sound.ccl to use mp3"
	if [ -d /usr/share/games/freecraft/default/ccl ]; then
		cd /usr/share/games/freecraft/default/ccl
		sed -i 's/.wav/.mp3/g' sound.ccl
		cd $CURDIR
	fi
fi
if [ "${OUTPUT}" = "ogg" ]; then
	echo "hacking sound.ccl to use ogg"
	if [ -d /usr/share/games/freecraft/default/ccl ]; then
		cd /usr/share/games/freecraft/default/ccl
		sed -i 's/.wav/.ogg/g' sound.ccl
		cd $CURDIR
	fi
fi
exit
Now I only needs a way to reduce the png images...for the original WC2 graphichs the total size is 4580K. If images reduced to 20 colors the estimated size reduction is - 25% (=3435K)...

Post Reply