Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Support #52

Open
2 of 3 tasks
marmichalski opened this issue Oct 5, 2020 · 29 comments
Open
2 of 3 tasks

MacOS Support #52

marmichalski opened this issue Oct 5, 2020 · 29 comments
Assignees

Comments

@marmichalski
Copy link
Contributor

marmichalski commented Oct 5, 2020

Hi,

I am working on making this work with macOS.

Would you be accepting PR's? If so, my to-do list is as follows:

  • Make the source compile on mac (Add macOS support #70)
  • Add DPI awareness (currently hardcoded for testing purposes 😛)
  • Prepare build env for mac, either with premake or cmake (Add cmake #68)

carmage3d

@codenamecpp
Copy link
Owner

codenamecpp commented Oct 5, 2020

Hi!
Sure, it would be great to support more operating systems :)

@naymapl
Copy link

naymapl commented Nov 9, 2021

Any news about macos version ??

@marmichalski
Copy link
Contributor Author

marmichalski commented Nov 9, 2021

Any news about macos version ??

Hi,

I haven't really found time for it. Making the source compile is quite straightforward. There is no DPI awareness though, but that might not be a problem for you, depends on your configuration. If you have any issues, I can help you either with a patch diff, if I still have the source, or guiding you a bit.

I would love to work on it again, but unfortunately I probably will not have time 😢. If it ever happens, I'll be sure to open a pull request.

This was referenced Dec 1, 2021
@marmichalski
Copy link
Contributor Author

marmichalski commented Dec 1, 2021

@naymapl I have opened a PR with macOS support. To see how you can compile it, check the github workflow yaml. There is no DPI awareness, so if you're using the retina display (scaled), the game window will not be rendered on the whole surface.

@naymapl
Copy link

naymapl commented Dec 2, 2021

@marmichalski thanks for reply. I want to build my own version but I'm not programmer - how to build my own mac version with cmake ? I found this https://github.com/codenamecpp/carnage3d/runs/4388703194?check_suite_focus=true but have no idea how to build it on my own mac. I'm all ready on mac mini m1 12.0.1 macOS but have in home some old mac pro from 2013 and 2015 - Is it run on arm ar I need to build it on Intel machine ? Thank you for any tutorial or code to make it build. Have a nice day Marcin.

@marmichalski
Copy link
Contributor Author

marmichalski commented Dec 2, 2021

Hey, I will be adding the instructions to the readme soon. In short, this should be enough:

  • Setup homebrew:
  • Install dependencies (and cmake):
    • brew install cmake glew glfw3 glm box2d
  • Setup and cd into build dir
    • mkdir build && cd build
  • Generate build files:
    • cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_BOX2D=No
  • Compile:
    • make -j4 (Where 4 is the threads count you want to use, you can check available with sysctl -n hw.logicalcpu)
  • Done. You should have your carnage3d binary compiled

The workflow file I've mentioned is this one: https://github.com/codenamecpp/carnage3d/pull/70/files#diff-8ec8dd620a1a6790f6910af016dd60b1b41485535d15fe2ebb0265593147e57dR58

@naymapl
Copy link

naymapl commented Dec 2, 2021

@marmichalski - hey - thanks for reply. I try to make it build but got few errors. Few of them I sorted allready but now I have issue with build:

cmake .. -DCMAKE_RELEASE_TYPE=Release -DWITH_BOX2D=No 
                                                                                                                                               
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenAL: /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/OpenAL.framework
-- Found Box2D: /opt/homebrew/lib/libbox2d.a (Required is at least version "2.4.0")
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/OpenGL.framework
-- Found GLEW: /opt/homebrew/lib/libGLEW.dylib
-- With bundled Box 2D: NO
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_RELEASE_TYPE


-- Build files have been written to: /Users/naymapl/carnage3d/build

make -j4                                                                                                                                                                                                
[  1%] Building CXX object CMakeFiles/carnage3d.dir/cmake_pch_arm64.hxx.pch
In file included from <built-in>:1:
In file included from /Users/naymapl/carnage3d/build/CMakeFiles/carnage3d.dir/cmake_pch_arm64.hxx:5:
/Users/naymapl/carnage3d/src/stdafx.h:55:10: fatal error: 'GL/gl.h' file not found
#include <GL/gl.h>
         ^~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/carnage3d.dir/cmake_pch_arm64.hxx.pch] Error 1
make[1]: *** [CMakeFiles/carnage3d.dir/all] Error 2
make: *** [all] Error 2

@marmichalski
Copy link
Contributor Author

marmichalski commented Dec 2, 2021

Whoops. Sorry, the parameter is CMAKE_BUILD_TYPE.

And about the error, did you checkout to (or download) the PR branch? Because this include is dfifferent when __APPLE__ is defined (https://github.com/codenamecpp/carnage3d/pull/70/files#diff-e9c682daf5243ad471bbc443ec0b31d50b68080d624259af82010df3a8c8436fR56)

@naymapl
Copy link

naymapl commented Dec 2, 2021

@marmichalski - maybye I'm stupid but When i clone refactore_peds_a branch got this issue:

First i clone branch

git clone --branch refactore_peds_ai https://github.com/codenamecpp/carnage3d.git

then:

cd carnage3d
mkdir build && cd build
cmake .. -DCMAKE_RELEASE_TYPE=Release -DWITH_BOX2D=No
                                                                                                                                     
CMake Error: The source directory "/Users/naymapl/carnage3d" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

I try with -CMAKE_BUILD_TYPE but got error is well:

cmake .. -DCMAKE_RELEASE_TYPE=Release -DWITH_BOX2D=No -CMAKE_BUILD_TYPE                                                                                                                      

loading initial cache file MAKE_BUILD_TYPE
CMake Error: Error processing file: /Users/naymapl/carnage3d/build/MAKE_BUILD_TYPE
CMake Error: The source directory "/Users/naymapl/carnage3d" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

For sure I make something wrong :D

@marmichalski
Copy link
Contributor Author

git clone --branch refactore_peds_ai https://github.com/codenamecpp/carnage3d.git

This branch has no macOS support. Either clone my fork and checkout to osx branch, or checkout to the PR https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@codenamecpp
Copy link
Owner

I didn't update refactore_peds_ai branch yet, it experimental and maybe broken right now, stick with master branch.

@naymapl
Copy link

naymapl commented Dec 2, 2021

Hi - I think is build well. Now i need to organize my old gta files and take a look for it. I let you know but looks like will working. Thank you so much for help and have nice day :D

Carnage3D 0.0.4
System initialize
Working directory: '/Users/naymapl/carnage3d/build/gamedata'
Cannot open config file 'config/sys_config.json'
Init MemoryManager
Frame heap memory size: 12582912
GLFW version string: 3.3.5 Cocoa NSGL EGL OSMesa dynamic
OpenGL 3.2 (Core profile)
OpenGL Vendor: Apple
OpenGL Renderer: Apple M1
OpenGL Version: 4.1 Metal - 76.1
GLSL Version: 4.10
Graphics Device caps:
 - max array texture layers: 2048
 - max texture buffer size: 268435456 bytes
Cannot read shader source from shaders/texture_color.glsl
Cannot read shader source from shaders/gui.glsl
Cannot read shader source from shaders/city_mesh.glsl
Cannot read shader source from shaders/sprites.glsl
Cannot read shader source from shaders/particle.glsl
Cannot read shader source from shaders/debug.glsl
Audio device description: Słuchawki zewnętrzne
Audio Device caps:
 - max sources mono: 0
 - max sources stereo: 0
Location of gta gamedata is not specified
Set valid gta gamedata location via sys config param 'g_gtadata'
Cannot open texts file 'ENGLISH.FXT'
Fail to load game texts for current language
Map name is not specified
Fail to start game
Cannot initialize game
System shutdown

@marmichalski
Copy link
Contributor Author

Run make get_demoversion in root project directory, edit gamedata/config/sys_config.json, set g_gtadata to demoversions/GTAECTS/GTADATA

@naymapl
Copy link

naymapl commented Dec 2, 2021

Got error:

make get_demoversion                                                                                                                                                               

mkdir -p gamedata/demoversions
cd gamedata/demoversions
wget "https://web.archive.org/web/20200930091556/https://www.rockstargames.com/gta/demos/gtaects.zip" -O gamedata/demoversions/gtaects.zip
/bin/sh: wget: command not found
make: *** [get_demoversion] Error 127

@marmichalski
Copy link
Contributor Author

brew install wget

@naymapl
Copy link

naymapl commented Dec 2, 2021

Thanks - I download data but still is missing "config/sys_config.json" file.

Carnage3D 0.0.4
System initialize
Working directory: '/Users/naymapl/carnage3d/gamedata/gamedata'
Cannot open config file 'config/sys_config.json'
Init MemoryManager
Frame heap memory size: 12582912
GLFW version string: 3.3.5 Cocoa NSGL EGL OSMesa dynamic
OpenGL 3.2 (Core profile)
OpenGL Vendor: Apple
OpenGL Renderer: Apple M1
OpenGL Version: 4.1 Metal - 76.1
GLSL Version: 4.10
Graphics Device caps:
 - max array texture layers: 2048
 - max texture buffer size: 268435456 bytes
Program linkage message: 'WARNING: Output of vertex shader 'FragColor' not read by fragment shader
WARNING: Output of vertex shader 'Position' not read by fragment shader
'
Render program loaded shaders/texture_color.glsl
Render program loaded shaders/gui.glsl
Render program loaded shaders/city_mesh.glsl
Program linkage message: 'WARNING: Output of vertex shader 'SpriteTextureSize' not read by fragment shader
WARNING: Output of vertex shader 'Position' not read by fragment shader
WARNING: Output of vertex shader 'SpriteTexelSize' not read by fragment shader
'
Render program loaded shaders/sprites.glsl
Render program loaded shaders/particle.glsl
Render program loaded shaders/debug.glsl
Audio device description: Słuchawki zewnętrzne
Audio Device caps:
 - max sources mono: 0
 - max sources stereo: 0
Location of gta gamedata is not specified
Set valid gta gamedata location via sys config param 'g_gtadata'
Cannot open texts file 'ENGLISH.FXT'
Fail to load game texts for current language
Map name is not specified
Fail to start game
Cannot initialize game
System shutdown

@marmichalski
Copy link
Contributor Author

Yes. It's covered in README. You have to copy the template file. https://github.com/codenamecpp/carnage3d#configure

@naymapl
Copy link

naymapl commented Dec 2, 2021

@marmichalski thank you so much - I config everything but now got error:

Carnage3D 0.0.4
System initialize
Working directory: '/Users/naymapl/carnage3d/gamedata/carnage3d'
Init MemoryManager
Frame heap memory size: 12582912
GLFW version string: 3.3.5 Cocoa NSGL EGL OSMesa dynamic
OpenGL 3.2 (Core profile)
OpenGL Vendor: Apple
OpenGL Renderer: Apple M1
OpenGL Version: 4.1 Metal - 76.1
GLSL Version: 4.10
Graphics Device caps:
 - max array texture layers: 2048
 - max texture buffer size: 268435456 bytes
Program linkage message: 'WARNING: Output of vertex shader 'FragColor' not read by fragment shader
WARNING: Output of vertex shader 'Position' not read by fragment shader
'
Render program loaded shaders/texture_color.glsl
Render program loaded shaders/gui.glsl
Render program loaded shaders/city_mesh.glsl
Program linkage message: 'WARNING: Output of vertex shader 'SpriteTextureSize' not read by fragment shader
WARNING: Output of vertex shader 'Position' not read by fragment shader
WARNING: Output of vertex shader 'SpriteTexelSize' not read by fragment shader
'
Render program loaded shaders/sprites.glsl
Render program loaded shaders/particle.glsl
Render program loaded shaders/debug.glsl
Audio device description: Słuchawki zewnętrzne
Audio Device caps:
 - max sources mono: 0
 - max sources stereo: 0


Current gta gamedata location is: '/Users/naymapl/carnage3d/gamedata/demoversions/GTAECTS/'
libc++abi: terminating with uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in directory_iterator::directory_iterator(...): Not a directory [/Users/naymapl/carnage3d/gamedata/carnage3d]
[1]    33583 abort      /Volumes/Macintosh\ HD/Users/naymapl/carnage3d/gamedata/carnage3d

@marmichalski
Copy link
Contributor Author

marmichalski commented Dec 2, 2021

Where are you running the binary (carnage3d) from? It looks like you moved it into the gamedata folder?
Just run it from the build, bin or root dir. If you are already doing that, I'm not sure why it finds that strange working directory.

Also, your gamedata looks wrong. You probably should not specify an absoulte path, this is what mine spits out: Current gta gamedata location is: 'demoversions/GTAECTS/GTADATA'

@codenamecpp
Copy link
Owner

Yep, working directory looks odd - it should ends with 'gamedata' but there is extra 'carnage3d' for some reason

@naymapl
Copy link

naymapl commented Dec 2, 2021

Hi. Now everything runing but I have this same issue like with re3 gta - screen is just for 1/4 of real window:

Zrzut ekranu 2021-12-2 o 11 51 28

@codenamecpp
Copy link
Owner

Did you set 'r_fullscreen' to 'true' in sys_config.json ?

@marmichalski
Copy link
Contributor Author

marmichalski commented Dec 2, 2021

Yes. That's expected and mentioned. This is scale factor / dpi awareness issue (I think, I'm no expert 😎).

@naymapl
Copy link

naymapl commented Dec 2, 2021

Even I try diffrent res or full screen still this same. Any Idea how to fix this issue ?

@naymapl
Copy link

naymapl commented Dec 2, 2021

When I change res for 4k 3840x2160 and full screen -> then run game -> then swith alt-tab to home -> then come back to game runing in correct full screen. This working for me in re3 gta is well. Thank you for help anyway.

Will nice to finish this project - looks nice and smooth.

@naymapl
Copy link

naymapl commented Feb 27, 2022

Hello @codenamecpp - any new progress with the engine game ?

@codenamecpp
Copy link
Owner

Hi, @naymapl

Unfortunately I didn't have enough spare time to work on project and now there is war going on in my country so I don't know what will happen next...

@Richard-L
Copy link

Many thoughts with you 🙏

@naymapl
Copy link

naymapl commented Feb 28, 2022

@codenamecpp all the best for you and your family and hope so this war finish quckly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants