zslevi0
Posts: 3
Joined: Wed Nov 13, 2013 3:54 pm

Serious Sam: TSE

Thu Dec 21, 2017 10:45 am

Hey Everyone,

I've seen somewhere a video of someone playing Serious Sam on an RPi 3, which was one of my favourite childhood games, so I thought I'd give it a try too. Croteam published the source code of their first Serious Engine, someone modified it to make it work on Linux, then ptitseb modified it to run well on ARM code (mainly for Open Pandora).
I compiled and tested it, and it is working amazingly well, on 1024x600 on Quality settings it runs between 40-60 fps, which is enough for an enjoyable gameplay. I thought I'd share how I got it to work since this is currently the best game on RPi in my opinion.

I used this version: https://github.com/ptitSeb/Serious-Engine

Prerequisites:
- Raspberry Pi 3
- Raspbian Stretch (latest)
- Original Serious Sam game files (I have the original CD and copied the files from it.)
- Network connection
Installing:
- Install raspbian on a microSD card then start your RPi.
- Update your system:

Code: Select all

sudo apt update
sudo apt upgrade
- Update the firmware:

Code: Select all

sudo rpi-update
- Select proper OpenGL driver & set GPU memory to 128M:

Code: Select all

sudo raspi-config
Advanced Options --> Memory Split --> 128
Advanced Options --> GL driver -> GL (Full KMS)
Reboot when finished.
- Install the necessary dependencies:

Code: Select all

sudo apt install flex bison cmake libvorbis-dev libogg-dev libsdl2-dev
- Download the engine:

Code: Select all

git clone https://github.com/ptitSeb/Serious-Engine.git
- Then go to Serious-Engine/Sources directory
- Edit build-linux64.sh file, and comment out the first two lines of code and add NCPU=5 like this:

Code: Select all

#NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
#let NCPU=$NCPU+2
NCPU=5
- Set the flag to Release in build-linux64.sh then save. IT IS IMPORTANT! If you do not set it to Release then the average fps will be half of what it should be.
- Just type in the following and wait to finish:

Code: Select all

./build-linux64.sh
- After the compilation finished, copy executables and libs:

Code: Select all

cp cmake-build/ssam ../Bin/
cp cmake-build/Debug/* ../Bin/Debug/
- Copy original game files into Serious-Engine directory (*.gro files, Levels, Demos etc.)

That is it, now you can start the game from Serious-Engine directory using this command:

Code: Select all

Bin/ssam
Here's a video of the first run: https://www.youtube.com/watch?v=MDKdhcvZ4Ec

First Ecnounter also works, you just need to use -DTFE=True flag in build-linux64.sh file.
Please keep in mind that the game has some issues, e.g. NETRICSA/Menu Animation is not working properly, some rendering glitches, missing graphical effects.
Last edited by zslevi0 on Wed Jan 03, 2018 9:23 am, edited 1 time in total.

ptitSeb
Posts: 146
Joined: Tue May 19, 2015 2:49 pm

Re: Serious Sam: TSE

Fri Dec 22, 2017 1:07 pm

Nice tuto.

I was wondering what was wrong with latest code that broke RPi build, but I think I found it. If you can try with latest sources code from the github repo :)

Also, sliglty chnages the build-linux64.sh so you can pass the "-DTFE=true" to it.

About the graphical glitches, I'm surprised. On the Pandora (and ODroid IIRC), I don't have any graphical glitches now. It's all working correctly. So maybe this is linked to the OpenGL driver? If you can try using GLES driver (closed sources?) and with gl4es and see if you still have graphical issue with this configuration.

zslevi0
Posts: 3
Joined: Wed Nov 13, 2013 3:54 pm

Re: Serious Sam: TSE

Wed Dec 27, 2017 9:58 pm

ptitSeb wrote:
Fri Dec 22, 2017 1:07 pm
Nice tuto.

I was wondering what was wrong with latest code that broke RPi build, but I think I found it. If you can try with latest sources code from the github repo :)

Also, sliglty chnages the build-linux64.sh so you can pass the "-DTFE=true" to it.

About the graphical glitches, I'm surprised. On the Pandora (and ODroid IIRC), I don't have any graphical glitches now. It's all working correctly. So maybe this is linked to the OpenGL driver? If you can try using GLES driver (closed sources?) and with gl4es and see if you still have graphical issue with this configuration.
Ohh, thank you for having a look at it :) I will try it in the following days and post the results.

salvaliebana
Posts: 59
Joined: Wed Sep 13, 2017 3:27 am

Re: Serious Sam: TSE

Fri May 18, 2018 2:36 am

what do you mean with "set the flag to release"??

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Mon Dec 24, 2018 4:01 am

It refers to that line in build-linux64.sh that says cmake -DCMAKE_BUILD_TYPE=Debug .. $1: change Debug to Release. Though judging from your video you already got things figured out.
ptitSeb wrote:
Fri Dec 22, 2017 1:07 pm
try using GLES driver (closed sources?) and with gl4es
I tried gl4es with ssam, but wouldn't recommend it for others. The first problem I had to sort out was that if I don't configure enough GPU memory the whole system will lock up on loading. After giving 256 MB to the GPU it launches, but every second or so the game unexplicably lags then I recover by either waiting several seconds or pressing Esc, Esc.

Whereas with the Mesa VC4 driver it's quite playable. Framerate varies from 20 to 60 fps but I haven't noticed any obvious graphical glitches with NETRICSA or otherwise. Thanks for sharing, zslevi0!

User avatar
Gavinmc42
Posts: 4016
Joined: Wed Aug 28, 2013 3:31 am

Re: Serious Sam: TSE

Mon Dec 24, 2018 6:14 am

Whereas with the Mesa VC4 driver it's quite playable. Framerate varies from 20 to 60 fps but I haven't noticed any obvious graphical glitches with NETRICSA or otherwise. Thanks for sharing, zslevi0!
Don't remember playing Serious Sam, but the specs for SS1 look pretty low and the source is available :D
20-60fps on Raspbian with OpenGL on?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

nerdberryit
Posts: 2
Joined: Sat Jul 27, 2019 3:26 pm

Re: Serious Sam: TSE

Sat Jul 27, 2019 3:37 pm

Hello. First of all, my compliments about this tutorial :-)

I following all the described steps and the compilation starts but it doesn't end because I get an error:

"make: *** [Makefile:130: all] Error 2"

Any idea about it?
I'm compiling on a Raspbian 10 Buster.

User avatar
leilei
Posts: 20
Joined: Wed Jun 26, 2019 2:26 am

Re: Serious Sam: TSE

Sat Jul 27, 2019 10:41 pm

Is it actually playable now? Last time I tried, I couldn't get anywhere near loading any of the first encounter and the second encounter I could only run the first level and deathmatch (at a grand total of around 17fps in 640x480 with no way of altering video settings without crashing)

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Sun Jul 28, 2019 3:23 am

nerdberryit: Tested this out again, and it appears broken on Raspbian using the instructions above. Not because of Buster though. Looking at recent commits it was the merging of notaz's assembly optimizations on May 31st. To avoid that for now you can build off the earlier commit 8e38e5a.

I never saw the same error as you, so you might encounter that again. According to your error output, CMake managed to generate a Makefile with a parse error. Troubleshoot with:

Code: Select all

    cd cmake-build && make VERBOSE=1
That'll avoid any -j parallelism and give you verbose output so you can see exactly which Makefile fails last, then look at the contents around its line 130 or wherever the error message points to.

leilei: salvaliebana's video that I linked above is roughly how it ran for me on a Pi 3B+ back then. Are you saying your experience was much worse, or about the same? I recall I was testing with the default Mesa 13 on Stretch and I suspect salvaliebana was using Mesa 17. Also, as mentioned above make sure to configure in Release not Debug.

With improvements from the VC6 hardware, Mesa 19, and merging of notaz's assembly optimizations this should only get better.

nerdberryit
Posts: 2
Joined: Sat Jul 27, 2019 3:26 pm

Re: Serious Sam: TSE

Mon Aug 05, 2019 7:13 pm

jdonald I try to run the suggested commands (cd cmake-build && make VERBOSE=1) and I got this output:

make[2]: *** [CMakeFiles/ssam.dir/build.make:2202: CMakeFiles/ssam.dir/Engine/Templates/BSP.cpp.o] Error 1
make[2]: uscita dalla directory "/home/pi/Serious-Engine/Sources/cmake-build"
make[1]: *** [CMakeFiles/Makefile2:144: CMakeFiles/ssam.dir/all] Error 2
make[1]: uscita dalla directory "/home/pi/Serious-Engine/Sources/cmake-build"
make: *** [Makefile:130: all] Error 2

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Mon Aug 05, 2019 7:43 pm

Apparently there was a compilation error in BSP.cpp. You need to scroll up a few lines to see it, then post it here.

Note ptitSeb merged my fix for Raspbian Buster a few days ago, so now the tip of master should be good (run git pull ).

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Sun Sep 01, 2019 8:15 am

I have been trying to build this game for along time and the github page is not helping me. I always end up with this message. It does not say anything about an error.

The message,

Code: Select all

STUBBED: load window icon in /home/pi/downloads/ssam/Sources/SeriousSam/MainWindow.cpp, line 168.
STUBBED: Need SDL invisible window or something in /home/pi/downloads/ssam/Sources/SeriousSam/MainWindow.cpp, line 327.

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Sun Sep 01, 2019 2:19 pm

Welcome. This happened to me a couple months ago, and after debugging it revealed I had missed a subfolder name on one of the copy steps.

It's generally a problem that FatalError() usually just exits without printing anything so it's unclear with anything like this. You could have similarly copied the shared objects to the wrong place, or it's missing a .gro file somewhere, or something else entirely.

You can try adding a printout of strFormat in this function, or build with -DCMAKE_BUILD_TYPE=RelWithDebInfo and set a breakpoint there.

Building locally always takes a while, so if you do iterate on things be sure to install ccache and configure with -DUSE_CCACHE=ON

When you solve the problem, please fill us in on what it turned out to be.

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Mon Sep 02, 2019 5:15 am

I genuinely don't understand anything.

Edit : I think I have tried to build with RelWithDebInfo but I get the same message.

Edit 2: I am trying to build tfe not tse.

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Mon Sep 02, 2019 5:45 am

Well, RelWithDebInfo won't do you any good if you don't know how to use gdb...

Think of it this way: Edit Serious-Engine/Sources/Engine/Base/ErrorReporting.cpp. After this part:

Code: Select all

/*
 * Report error and terminate program.
 */
static BOOL _bInFatalError = FALSE;
void FatalError(const char *strFormat, ...)
{
Add a line that says:

Code: Select all

    printf("FatalError: %s\n", strFormat);
And before that function, add the line:

Code: Select all

#include <cstdio>
Now if you build and rerun, it should at least give you a little more info on where it's crashing.

Or you can keep on rebuilding if you so choose, but it'll be quite painful if it fails again.

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Mon Sep 02, 2019 11:35 am

I have done the edits to the cpp file and I started the build file like this,

Code: Select all

./build-linux64.sh -DTFE=TRUE -DUSE_CCACHE=ON
And I got this error message,

Code: Select all

make: *** [Makefile:130: all] Error 2
And yes, this is my 10th attempt in building this and I am happy in seeing a different error message than the previous one. What mistake did I do?

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Tue Sep 03, 2019 2:36 am

Okay I just tested this. Seems to compile much more quickly on my Pi 4, probably owing to 2 GB of memory thereby avoiding swapping.

The game works for me, but it's worth pointing out that zslevi0’s instructions are slightly out of date. The part that says cp cmake-build/Debug/* ../Bin/Debug/ is different from README.md and would put the three *.so files in the wrong folder. The correct equivalent command is:

Code: Select all

cp cmake-build/Debug/* ../Bin/
If I force mistakes like copying the *.so files / *.gro files to the wrong places, ./ssam properly pops up an informative error dialog too.
slowedsix654123 wrote:
Mon Sep 02, 2019 11:35 am
I started the build file like this,

Code: Select all

./build-linux64.sh -DTFE=TRUE -DUSE_CCACHE=ON
Unfortunately one issue with build-linux64.sh is that it doesn't recognize more than one argument, so you need to edit the script directly to make -DUSE_CCACHE=ON take hold. Hope you also made sure to run:

Code: Select all

sudo apt-get install -y ccache
Not mandatory, just a good idea if you keep rebuilding things 10 times over. ccache won't solve the root problem. Neither will RelWithDebInfo by itself or switching to TFE.
And I got this error message,

Code: Select all

make: *** [Makefile:130: all] Error 2
Most likely a typo in your C++ code edits. If you scroll up a bit in this thread, nerdberryit had the same question and the answer is still to run:

Code: Select all

(cd cmake-build && make VERBOSE=1)
to force a sequential build and make the first compilation error appear at the bottom.

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Tue Sep 03, 2019 11:12 am

The cmake-build folder gets formed only after the building is successful. The .so files also get formed after successful building. I didn't even get the building successful.
Maybe its the double arguments causing the problem. Is there any way to add -DTFE=TRUE or -DUSE_CCACHE=ON directly to the .sh file?

And where do you get time to write such giant messages? :?:

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Tue Sep 03, 2019 1:47 pm

Short message now!

The unused second argument is not the core problem. You need to run the sequential build command above (after a failed parallel build) to identify your compiler error.

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Thu Sep 05, 2019 10:30 am

How did you build it right?

slowedsix654123
Posts: 6
Joined: Sun Sep 01, 2019 7:50 am

Re: Serious Sam: TSE

Thu Sep 05, 2019 11:17 am

Noooooo,

I did everything you said and the same STUBBED error comes.


Why are we still here? Just to suffer?

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Thu Sep 05, 2019 9:02 pm

In another thread I recently mentioned that providing long error-prone build steps without binaries was a disservice. Yet I see we've been doing that here.

I've packaged up my working binaries so please try these out: ssam-tse_1.10-669dc91_armhf.tar.xz

If it still fails on your system then the problem is something unrelated to the build (see included README-tse-binary.md for tips).

By the way, at least two STUBBED warnings are expected. It's the early termination after them that's not.

nex86
Posts: 11
Joined: Sat Aug 06, 2016 10:39 pm

Re: Serious Sam: TSE

Fri Sep 20, 2019 4:08 am

I'm getting a bus error with the pi4 on buster

Code: Select all

STUBBED: load window icon in /home/pi/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 168.
STUBBED: Need SDL invisible window or something in /home/pi/Serious-Engine/Sources/SeriousSam/MainWindow.cpp, line 327.
STUBBED: !!! FIXME: get the code back in from Ryan's original port. in /home/pi/Serious-Engine/Sources/Engine/Base/Stream.cpp, line 921.
STUBBED: Report actual SDL device name? in /home/pi/Serious-Engine/Sources/Engine/Sound/SoundLibrary.cpp, line 269.
STUBBED: co-opt the existing T-buffer support for multisampling? in /home/pi/Serious-Engine/Sources/Engine/Graphics/SDL/SDLOpenGL.cpp, line 113.
STUBBED: this can't possibly be right, yeah? in /home/pi/Serious-Engine/Sources/Engine/Base/SDL/SDLEvents.cpp, line 147.
STUBBED: SDL2 can handle these events in /home/pi/Serious-Engine/Sources/SeriousSam/SeriousSam.cpp, line 1027.
STUBBED: Not 64-bit clean in /home/pi/Serious-Engine/Sources/EntitiesMP/Player.es, line 6561.
Bus error
Also tried Donald's precompiled binaries, didn't work.

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: Serious Sam: TSE

Sat Sep 21, 2019 3:35 am

Well you're certainly getting further than slowedsix654123. I just tested those binaries on a different SD card. Works fine with kernel 4.19.73 both 32-bit and 64-bit.

If you get the same error both by building from source and running the pre-compiled binaries, then at least we know it's not due to a regression on the Serious-Engine codebase. There's something particular to your environment.

If you're willing to debug, compile it with -DCMAKE_BUILD_TYPE=Debug, copy ssam and the *.so files to the right place, and see if the same problem recurs. If so, run it in gdb:

Code: Select all

sudo apt install -y gdb
gdb Bin/ssam
and get a backtrace:

Code: Select all

run
bt

WinderWorrior
Posts: 1
Joined: Wed Nov 06, 2019 11:44 pm
Location: UK

Re: Serious Sam: TSE

Thu Nov 07, 2019 12:39 am

Hi Pi heads

NOTE! Before you get started although I explain how to build both SeriousSam TFE and SeriousSam SE. only SeriousSam SE works properly but i feel its worth building just in case a work around is figured that way you will have the files ready!

Lets make this easy assuming you have tried all the above steps and end up getting the following error "make: *** [Makefile:130: all] Error 2"

Lets now follow the below steps to fix it...

1. Go to the Serious-Engine directory just use file manager and delete all the contents so the directory is empty.

2. In a fresh Terminal type the below then hit enter.

Code: Select all

 git clone https://github.com/ptitSeb/Serious-Engine.git 
The above is the culprit for error "make: *** [Makefile:130: all] Error 2" if your git clone url is pulling from the master repository in git this error occurs we have to use the pandora repository. Which is what is supplied here.

3. While still in the same terminal type the below and press enter.

Code: Select all

 cd ~/Serious-Engine/Sources 


DONT CLOSE TERMINAL!

4. Back in File Manager go to the Serious-Engine directory again and go into the Sources directory then edit the "build-linux64.sh" file using Text Viewer to make that clear right click and open with TEXT VIEWER. ;)

5. In Text Viewer make sure build-linux64.sh is identical to the following below (CHECK OVER EVERYTHING)

Code: Select all

#!/bin/bash
#NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
#let NCPU=$NCPU+2
NCPU=5
echo "Will build with 'make -j$NCPU' ... please edit this script if incorrect."

set -e
set -x

rm -rf cmake-build
mkdir $_
cd $_
#cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 ..
#ninja

# This is the eventual path for amd64.
cmake -DCMAKE_BUILD_TYPE=Release .. $1

# Right now we force x86, though...
#cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 ..
echo "ECC first"
make ecc
echo "Then the rest..."
make -j$NCPU
6. Once the build-linux64.sh file is correct we need to run it so head back to your Terminal instance that i told you not to close :) and enter

Code: Select all

 sudo apt install flex bison cmake libvorbis-dev libogg-dev libsdl2-dev
Also just in case do this too...

Code: Select all

 sudo apt-get install g++
7. At this point you have two options which you can build SeriousSam FE or SeriousSam SE
For SeriousSam FE enter this in your terminal instance, which again I told you not to close.

Code: Select all

 ./build-linux64.sh -DTFE=TRUE -DUSE_CCACHE=ON 
then press enter.

You should now have a successful build for the first game,
You can grab the files from /home/pi/Serious-Engine/Sources/cmake-build
Just use file manager to get them and store them safe.
The files you want are..... ssam-tfe and the Debug folder.
At this point I would go create two folders in Documents called SS1 and SS2
You can paste the files you just grabbed into SS1 seen as tho these files are for First Encounter.

8. For SeriousSam SE follow the steps again in 7. but this time enter this in your terminal instance,
Which again I told you not to close.

Code: Select all

 ./build-linux64.sh 
then press enter.

You should have a successful build now for the second game ,
You can grab the files from /home/pi/Serious-Engine/Sources/cmake-build
Just use file manager to get them and store them safe.
The files you want are..... ssam and the Debug folder.
You can paste the files you just grabbed into SS2 seen as tho these files are for Second Encounter.

9. Final step -
So i had both the Windows games from GOG installed on my Windows machine as you would expect.
I copied the GOG folder from "c:/ProgramFilesx86/GOG" and put it on a USB drive then I placed the USB drive in the Pi,
From here I copied the GOG folder from the USB to my Documents folder on Raspbian.
Then I went into SS1 we created earlier and opened the Debug folder and copied the contents to the root of the SS1
This way I could then grab the 4 files and place them in the Bin folder of the first game.

To clarify in SS1 folder I copied
ssam-tfe
libEntities.so
libGame.so
libShaders.so

To /home/pi/Documents/GOG/Serious Sam The First Encounter/Bin

You can probably work out how the second game works at this point,
To play the game just double click on ssam-tfe and click execute.

Boom. Hopefully this helps.

All tested on Pi4 4GB

WinderWorrior

Return to “Gaming”