GearHead is a great Roguelike Mecha RPG game by Joseph Hewitt. It's open-source, written using cross-platform Pascal code, and can be compiled by FPC. See the official GearHead page, GearHead 1 and GearHead 2 GitHub repositories.
Contents:
We no longer host here GearHead binaries for Linux, because you can get official GH binaries from better places:
Get the GearHead for Linux from the official GearHead 1 releases on GitHub or official GearHead 2 releases on GitHub.
You can also get GearHead from your official distro packages: Debian includes both GearHead 1 and 2, Ubuntu too, others likely too.
For instructions how to compile GearHead yourself, see the description in the GearHead repositories on GitHub.
Compiling for Mac OS X: These are the issues to watch for:
You need to use command-line option -Px86_64
with FPC, to link with 64-bit libraries.
You need to use command-line option -WM10.12
with FPC, to avoid error "ld: warning: object file (/usr/local/lib/libSDLmain.a(SDLMain.o)) was built for newer OSX version (10.12) than being linked (10.5)". It is possible that on different Mac OS X versions you will need to adjust this (it should be synchronized with how HomeBrew compiles SDL libraries).
FPC must be able to find your X server libraries. Enable this by using the
-Fl/opt/x11/libor
-Fl/usr/X11/lib/
command-line options. Personally, I found it most comfortable to add this line -Flxxx
to the /etc/fpc.cfg
file, this way you don't need to repeat these options in all fpc
invocations. See also my Castle Game Engine info about Mac OS X for some notes about compiling Mac OS X programs that link to X server.
You need to use {$linklib SDL_image}{$linklib SDL_ttf}
in the code. This avoids linking errors that IMG_Load and TTF_xxx stuff cannot be found. Alternatively, this could be done by command-line FPC options -k-lSDL_image -k-lSDL_ttf
.
You need to do SetExceptionMask
in code, just like OpenGL units are doing. This avoids crashing with "invalid floating point operation" at start.
The issues 1-3 are "peculiarities" of Mac OS X. The issues 4-5 should be fixed in FPC SDL units sources some day (TODO: submit them).
Here's the precise instruction how you can compile and run on Mac OS X:
# Get the code with 2 fixes for Mac OS X. git clone https://github.com/michaliskambi/gearhead-1 # Compile console version. fpc gharena.pas -ogharena-console # Test console version in the Terminal. # Make sure your terminal window has at least the minimum size (80x25). ./gharena-console # Clean. rm -f *.ppu *.o # Install SDL reqiurements using HomeBrew. brew install sdl sdl_ttf sdl_image # Compile SDL version. # # About -Px86_64: # The architecture (x86_64) must match the architecture # of SDL you installed using HomeBrew. # It's simplest to just use x86_64 on modern Mac OS X versions. # # About -WM10.12: # The libraries you installed using HomeBrew were linked to support # only new Mac OS X versions. You need to link your program like this too, # otherwise you get error: # ld: warning: object file (/usr/local/lib/libSDLmain.a(SDLMain.o)) was built for newer OSX version (10.12) than being linked (10.5) fpc -Px86_64 -dSDLMODE -WM10.12 gharena.pas # Test it! ./gharena # Troubleshooting: if the application crashes: # # Note that the SDL application clears the console afterwards. # To see the errors run like this: ./gharena > /tmp/gh-errors.txt 2>&1 cat /tmp/gh-errors.txt # Now the same for GearHead 2: git clone https://github.com/michaliskambi/gearhead-2 # Compile and test console version. fpc -dASCII gearhead2.pas -ogearhead2-console ./gearhead2-console # Clean, compile and test SDL version. rm -f *.ppu *.o fpc -Px86_64 -WM10.12 gearhead2.pas ./gearhead2
If you have questions, feel free to contact me (Michalis).