With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

Port to Raspberry Pi?

Postby Munny Shot » Thu Nov 08, 2012 7:30 pm

I'm interested in a port of Smokin' Guns to the Raspberry Pi (ARM11 aka ARMv6). Can anyone tell me if this is currently being considered?

I'm keen to assess the suitability of the Raspberry Pi to provide a low-powered, always-on Smokin' Guns server platform. I'm hoping that the recently released 512MB model B slighty overclocked will provide enough headroom to host at least four players successfully. I think this task is worthwhile particularly as ARM-powered machines are tipped to gain wider acceptance in the near future.

Unfortunately I have no programming ability myself, but I can certainly make my own 512MB Raspberry Pi available for compiling plus testing if that helps (with some necessary guidance)?
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby TheDoctor » Thu Nov 08, 2012 10:16 pm

What do you want to run on such a platform? The server? The client and server of SG is directly tied to ioquake3 engine. If ioq3 runs on Rasperry Pi, most likely SG will, eventually.
Image
User avatar
TheDoctor
Smokin' Amigo!
 
Posts: 818
Joined: Sun Jun 06, 2010 3:31 am



Re: Port to Raspberry Pi?

Postby Munny Shot » Fri Nov 09, 2012 2:41 pm

Thanks for the response. As I said above
to provide a low-powered, always-on Smokin' Guns server
I thought it would be cool if I could host a 24/7 machine that sips around 3-4W total |D

I know from reading around that SG runs on top of ioquake. However I am not a coder, so I don't know how to differentiate between the vanilla ioquake engine and the Smokin Guns specific code. Is it, for example, a simple matter of compiling the CPU specific root binaries and then copying the .cfg and .pk3 in the 'baseq3' and 'smokinguns' subdirectories?
Cheers.
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby /dev/random » Fri Nov 09, 2012 8:59 pm

Munny Shot wrote:I know from reading around that SG runs on top of ioquake. However I am not a coder, so I don't know how to differentiate between the vanilla ioquake engine and the Smokin Guns specific code. Is it, for example, a simple matter of compiling the CPU specific root binaries and then copying the .cfg and .pk3 in the 'baseq3' and 'smokinguns' subdirectories?
Cheers.


It does not run "on top of ioquake3", it uses a customized version of the ioquake3 engine. As far as I know there are no big changes in SG's server code compared to ioq3.

I've read that modified versions of the ioquake3 client (e.g. kwaak3) run on various ARM devices. If I had to guess, I'd say most of the modifications are porting the OpenGL and input code to the specific hardware, the server code should not need any modifications.
As such the next task would be getting a SDK for your hardware, i.e. a (cross-)compiler and headers for a few system libraries (which are POSIX anyways).
Once you've got all that and compiled your sg_ded, it should really just boil down to; copy binary, copy regular pk3, create a config and run it forever :)
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Fri Nov 09, 2012 10:05 pm

OK, thanks for your thoughts. It certainly makes sense that the server only role wouldn't require any graphic components since it's not involved in rendering the game, merely keeping track of players positions for the local client to render.

However I really have no understanding as to how the game is contructed or the extent of the modifications made when "vanilla" quake was modified to become SG which is why I thought I'd ask the devs advice here. If it's a case of go grab the source, set the configfile for ARM and compile then add a few (platform agnostic) customisations to become SG then that sounds (fairly) straightforward :) If not then .....?
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby /dev/random » Fri Nov 09, 2012 10:58 pm

Unfortunately the link from http://www.raspberrypi.org/archives/1139 seems to be broken. Here's a tutorial with working mirror http://mitchtech.net/install-quake-3-on-raspberry-pi/
If you can get that ioq3ded.arm to run, then we can also create a sg_ded.arm :)

Which OS are you running on your Pi? Maybe you already have everything you need to build your own binaries from https://github.com/raspberrypi/quake3 via http://www.raspbian.org/RaspbianQuake3 (needs Debian. Which OS are you using?).
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Sat Nov 10, 2012 1:49 am

Currently using Raspbian (Debian Wheezy optimised for "hard float" on ARMv6) with all the X dependencies stripped out. Thanks for taking the trouble to post links however I'm already aware of the work done to port Quake 3 to Raspberry Pi from reading the Raspi forums. I figured SG was 'doable' in principle hence why I posted my query here.

Again the problem I run up against is knowing exactly where the S.G. code differs from vanilla Quake. Do I assume from what you've said that I merely follow the example offered here but substituting the S.G. git repository? If that's all there is to it then you've answered my query :) Cheers.
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby /dev/random » Sat Nov 10, 2012 1:06 pm

I'll need to look into the "Rasperry" Git repo more closely, but I think it's like I already guessed, there are most likely no changes to the server code. Which means that you should be able to just use the SG code and compile it according to the tutorial (assuming it's still up to date).

That being said, I'll try to find a full diff and will report back with instructions suited to build just the dedicated server.


Regarding https://github.com/raspberrypi/quake3 :
According to README_VC all changes are properly #ifdef'ed. I've skimmed over the changes and it looks like the only relevant one for building a dedicated server is the following. The Makefile changes are for building the client only.
Code: Select all
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 0fea8e8..e79e9a1 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -205,6 +205,11 @@ typedef int intptr_t;
 #include <ctype.h>
 #include <limits.h>
 
+#ifdef VCMODS_REPLACETRIG
+#define sin(f) sinf(f)
+#define cos(f) cosf(f)
+#endif
+
 #ifdef _MSC_VER
   #include <io.h>


The following are the build instructions from http://www.raspbian.org/RaspbianQuake3 trimmed down to build a dedicated server only;

Make sure you're up-to-date:
Code: Select all
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update 192

Reboot.

Install required packages:
Code: Select all
sudo apt-get install git gcc build-essential


Download the Smokin' Guns source code:
Code: Select all
mkdir ~/src && cd ~/src
git clone git://github.com/smokin-guns/SmokinGuns.git smokinguns
cd smokinguns


Create a build.sh with the following content
Code: Select all
#!/bin/bash
# this script builds ioq3ded
# invoke with ./build.sh
# or ./build.sh clean to clean before build

# directory containing the ARM shared libraries (rootfs, lib/ of SD card)
ARM_LIBS=/opt/vc/lib

# directory to find khronos linux make files (with include/ containing
# headers! Make needs them.)
INCLUDES="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads"

# prefix of arm cross compiler installed
#CROSS_COMPILE=bcm2708-

# clean
if [ $# -ge 1 ] && [ $1 = clean ]; then
   echo "clean build"
   rm -rf build/*
fi

make -j4 -f Makefile ARCH=arm \
   CC=""$CROSS_COMPILE"gcc" BUILD_CLIENT=0 BUILD_GAME_QVM=0 \
   CFLAGS="-DVCMODS_REPLACETRIG $INCLUDES" \
   LDFLAGS="-L"$ARM_LIBS" -lvchostif -lvmcs_rpc_client -lvcfiled_check -lbcm_host -lkhrn_static -lvchiq_arm -lvcos -lrt"

exit 0

(I'm uncertain about the libs in LDFLAGS. I've removed those which are obviously OGL/SDL ones)

Apply the VCMODS_REPLACETRIG .diff from above.

Do a ./build.sh

Once compilation is finished, try starting the executable with ./build/release-linux-arm/smokinguns_dedicated.arm
If it does not fail immediately but instead complains about missing files, then we're ready to create a Smokin' Guns package by using the official pk3 files.
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Sat Nov 10, 2012 4:06 pm

Thanks for the effort you're putting in here - it's appreciated. I can't do much today I'm afraid but I'll certainly have a crack at it tomorrow and report back.
Cheers.
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby /dev/random » Sat Nov 10, 2012 8:35 pm

Hey, I've found something of interest for you https://www.edis.at/en/server/colocatio ... spberrypi/ :)
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Sun Nov 11, 2012 12:09 am

Thanks mate but already ahead of you! :lol:
(Pretty compelling proposition now eh?)
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Wed Nov 14, 2012 3:52 am

I didn't get the free time I was hoping to spend on this over the weekend so a bit of a delay I'm afraid. I had several goes yesterday evening but each time I saw compilation warnings (in response to the graphics being snipped possibly?) followed by critical errors towards the end e.g.:
Code: Select all
LD build/release-linux-arm/smokinguns_dedicated.arm
/usr/bin/ld: cannot find -lvchostif
/usr/bin/ld: cannot find -lvmcs_rpc_client
/usr/bin/ld: cannot find -lvcfiled_check
/usr/bin/ld: cannot find -lbcm_host
/usr/bin/ld: cannot find -lkhrn_static
/usr/bin/ld: cannot find -lvchiq_arm
/usr/bin/ld: cannot find -lvcos
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-arm/smokinguns_dedicated.arm] Error 1
make[2]: Leaving directory `/home/pi/src/smokinguns'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/home/pi/src/smokinguns'
make: *** [release] Error 2
pi@raspberrypi ~/src/smokinguns $

Although I wasn't sure, I figured that perhaps my stripped down OS was lacking some libraries or components that the compilation process required. So tonight I decided to try again but with a default Raspbian image. The warnings were still present .... but this time it seems to have worked. e.g. I have a new executable and when I run it I get:
Code: Select all
pi@raspberrypi ~/src/smokinguns $  ./build/release-linux-arm/smokinguns_dedicated.arm
Smokin' Guns 1.1 linux-arm Nov 14 2012
----- FS_Startup -----
Current search path:
/home/pi/.smokinguns/smokinguns
./build/release-linux-arm/smokinguns
/home/pi/.smokinguns/baseq3
./build/release-linux-arm/baseq3

----------------------
0 files in pk3 files
Couldn't load default.cfg
pi@raspberrypi ~/src/smokinguns $


This looks like what you alluded to, which is great :)
Presumably now it's a question of copying over configs and pk3 files. Does SG expect the same files and configs as expressed in the Raspbian Quake 3 guide, or are there some subtle differences (I'm guessing the latter)?
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby TheDoctor » Wed Nov 14, 2012 5:45 pm

Munny Shot wrote:Does SG expect the same files and configs as expressed in the Raspbian Quake 3 guide, or are there some subtle differences (I'm guessing the latter)?


How about you download the OS independent archive and copy your executable to it? Beforehand, you may delete any existing *.exe *.dll and linux binary of said archive to not get confused.
Image
User avatar
TheDoctor
Smokin' Amigo!
 
Posts: 818
Joined: Sun Jun 06, 2010 3:31 am



Re: Port to Raspberry Pi?

Postby Munny Shot » Wed Nov 14, 2012 7:33 pm

Thanks for your reply. FWIW I sent that at 2am local time this morning. Once I had thought about it today I figured I could probably do that (thanks to all you good fellas efforts to date) :) I'll set this up later, invite a few people to test it out and report back with my findings. Cheers.
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Re: Port to Raspberry Pi?

Postby Munny Shot » Thu Nov 15, 2012 1:38 am

Well the good news is the R-Pi SG server functions! :) I'll have to wait until the weekend before I can stress test it with a few friends of course, but tonight I was able to join a game I hosted on the Pi and run around popping off a few bots. So it looks promising :twisted:

Thanks again for all the help you've provided, chaps. I reckon you've earnt at least three fingers of ol' red-eye in the saloon.
User avatar
Munny Shot
Drifter
 
Posts: 22
Joined: Tue Oct 09, 2012 6:09 pm



Next

Return to Code

Show Sidebar
Show Sidebar

User Control Panel

cron