BlindMindStudios / StarRuler2-Source

4X Space Strategy game Star Ruler 2's open source distribution.
http://starruler2.com
Other
1.45k stars 244 forks source link

Any blocker for macOS compilation? #4

Open Dimillian opened 5 years ago

Dimillian commented 5 years ago

I didn't had time to look and the code and dependencies yet, but I was waiting for ages to play it natively on macOS.

Any blocker anyone already saw before I try to work on a compilation flow for macOs?

DaloLorn commented 5 years ago

Yes, but you'd need to ask one of the devs to give you a thorough breakdown of it. (I only remember that there was something...)

Dimillian commented 5 years ago

Well, I'll try tonight anyway, looking at dependencies, look like everything will link Ok on Mac. Maybe I'll have to tweaks code then.

DaloLorn commented 5 years ago

Well, if you do get it to work, I know someone who might be interested in getting it. (Assuming he's still interested in the game... it's been a while since I talked to him about it, mostly because I never know when he has access to a Windows machine.)

ThyReaper commented 5 years ago

There shouldn't be any major blockers for compiling on macOS, but the libraries in use had some issues of incompatible behavior, mostly around mouse interactions.

daviewales commented 5 years ago

I've got it building on Mac, using brew libraries. Only issue I've found so far is that the mouse is invisible.

Menu loaded on Mac

TLDR:

It may be possible to switch from gcc-ar and gcc-ranlib to ar and ranlib with environment variables (AR=ar, etc) however I haven't investigated this yet. This would avoid the need to change all the Makefiles.

End TLDR

For more details, the notes I made while working on this are pasted below:

joelpurra commented 5 years ago

Got the game to run on macos as well -- thanks for the steps, @daviewales! Managed to simplify them quite a bit; just copy-paste the below in a terminal window in a directory with the source code.

Can other macos users confirm that the game runs?

# NOTE: ensure dependencies are installed.
# https://brew.sh/
brew install cmake freetype gcc glew libogg libpng libvorbis openal-soft zlib

# NOTE: create symlink aliases for missing executables.
mkdir -p "$HOME/bin"
ln -s "/usr/bin/ar" "$HOME/bin/gcc-ar"
ln -s "/usr/bin/ranlib" "$HOME/bin/gcc-ranlib"

# NOTE: set/add/override compiler and dependency paths.
export CC="g++-8"
export CXXFLAGS="-I$(brew --prefix libpng)/include -I$(brew --prefix glew)/include"
export LDFLAGS="-I$(brew --prefix libpng)/lib -L$(brew --prefix glew)/lib"

# NOTE: build using linux/macos makefile.
# NOTE: just ignore ld warnings about libpng/glew directories not found.
make -f "./source/linux/Makefile" compile

# NOTE: start the game!
./bin/osx64/StarRuler2.bin

The game starts, can click around in the menu, start to the tutorial etcetera. Didn't test gameplay yet.

./bin/osx64/StarRuler2.bin terminal output
Initializing sound
Initializing window system
Loading engine settings
Initializing OpenGL Engine
Registering mods
Starting 9 threads on 8 processors.
Loading mod(s)
OpenGL vendor 'ATI Technologies Inc.', renderer 'AMD Radeon R9 M370X OpenGL Engine'
       version '2.1 ATI-1.68.20'
Loaded in 1.5 seconds
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Shadow scripts: 347ms load, 3038ms compile
libpng warning: iCCP: known incorrect sRGB profile
Client scripts: 366ms load, 7034ms compile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
Server scripts: 341ms load, 8053ms compile
Loaded in 8.4 seconds
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
Finished computing hulls in 12841.7ms

Caught Segfault at 0x0

Stack trace:
 0   StarRuler2.bin                      0x0000000105c63a0d _Z11print_tracev + 29
 1   ???                                 0x00000001152f6bbf 0x0 + 4650396607

No active script context to log.
Abort trap: 6
daviewales commented 5 years ago

Excellent work! I knew there were a lot of ways to streamline it, but just haven't had the time.

I've noticed the retina scaling issue only occurs in windowed mode. But the cursor disappears in full screen mode! So we can't win, without having a serious look at the code.

I suspect we need to think carefully about the glfw cursor mode.

Have a look at the output of

grep -rI cursor .

(Run from top level directory of project)

On 29 September 2018 2:36:15 am AEST, Joel Purra notifications@github.com wrote:

Got the game to run on macos as well -- thanks for the steps, @daviewales! Managed to simplify them quite a bit; just copy-paste the below in a terminal window in a directory with the source code.

Can other macos users confirm that the game runs?

# NOTE: ensure dependencies are installed.
# https://brew.sh/
brew install cmake freetype gcc glew libogg libpng libvorbis
openal-soft zlib

# NOTE: create symlink aliases for missing executables.
mkdir -p "$HOME/bin"
ln -s "/usr/bin/ar" "$HOME/bin/gcc-ar"
ln -s "/usr/bin/ranlib" "$HOME/bin/gcc-ranlib"

# NOTE: set/add/override compiler and dependency paths.
export CC="g++-8"
export CXXFLAGS="-I$(brew --prefix libpng)/include -I$(brew --prefix
glew)/include"
export LDFLAGS="-I$(brew --prefix libpng)/lib -L$(brew --prefix
glew)/lib"

# NOTE: build using linux/macos makefile.
# NOTE: just ignore ld warnings about libpng/glew directories not
found.
make -f "./source/linux/Makefile" compile

# NOTE: start the game!
./bin/osx64/StarRuler2.bin

The game starts, can click around in the menu, start to the tutorial etcetera. Didn't test gameplay yet.

  • The screen seems to be 1/4th of the size of the expected viewport.
    • Might it be an issue with @2x/retina displays?
    • Perhaps there's an easy enough patch for detecting/fixing it?
  • The mouse pointer is visible, but due to the resized graphics the pointer "location" has a 2x scaled offset.
  • The game crashes with a segfault upon exit, but it doesn't affect the experience.
./bin/osx64/StarRuler2.bin terminal output
Initializing sound
Initializing window system
Loading engine settings
Initializing OpenGL Engine
Registering mods
Starting 9 threads on 8 processors.
Loading mod(s)
OpenGL vendor 'ATI Technologies Inc.', renderer 'AMD Radeon R9 M370X
OpenGL Engine'
      version '2.1 ATI-1.68.20'
Loaded in 1.5 seconds
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Shadow scripts: 347ms load, 3038ms compile
libpng warning: iCCP: known incorrect sRGB profile
Client scripts: 366ms load, 7034ms compile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
Server scripts: 341ms load, 8053ms compile
Loaded in 8.4 seconds
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
Finished computing hulls in 12841.7ms

Caught Segfault at 0x0

Stack trace:
0   StarRuler2.bin                      0x0000000105c63a0d
_Z11print_tracev + 29
1   ???                                 0x00000001152f6bbf 0x0 +
4650396607

No active script context to log.
Abort trap: 6

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/BlindMindStudios/StarRuler2-Source/issues/4#issuecomment-425493818