Skip to content

kevinctracy/mc2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MechCommander 2 (macOS)

This builds on the original maintainer's work to add macOS compatibility, including Apple Silicon support and a packaged .app / .dmg. See BUILD-MAC.md to build from source.


Mech Commander 2 open source engine + Linux port.

website

!NB: as russia conducts war in Ukraine I have no time to support this project until we will get rid of orcs. You are encouraged to help.

Disclaimer: I consider this project finished for now, there is a lot more to do for someone who wants to improve the game, but all functionality (except networking) is implemented and I've passed the game on my Linux box. Also found original game bugs and crashes are fixed.

This port is an open source implementation of a closed MC2 engine code using available interface (.h) files. Currently game can be run on Linux, Windows, and Apple Silicon macOS in 64bit mode. Fixed a lot of bugs (including ones present in original game). Sound system is not fully implemented (panning, doppler, etc. not supported yet)

TODO:

  • fix remaining memory leaks (finish implementation of memory heaps)
  • make nice data packs, so not only me can play the game :-) (in progress, see data repo
  • actually finish all missions in the game
  • make sure no files are created outside of user directory
  • reduce draw calls number
  • reimplement/optimize priority queue
  • finish moving lighting to shaders (move whole lighting there, not only shader-based drawing of CPU-prelit vertices like I do now)
  • Update graphics to 2018 2020 2021
  • Add network support?
  • I am sure there is more

Licensing

  • Original game was released under Shared Source Limited Permission License (please refer to EULA.txt)
  • My code is licenced under GPL v.3 (see license.txt)
  • All third party libraries use their own licenses

Building on Windows

Updated detailed build manual for Windows can be found in BUILD-WIN.md

To build on windows use CMake

Ensure, that you have all necessary dependencies: SDL2, SDL_mixer, SDL_ttf(for tools), zlib, glew I recommend to get zlib sources and build them by hand (do not forget to copy zconf.h) One can also use 3rdparty.zip package in the repo for simpler setup, it contains all needed 3rdparty libraries

Just for a reference here is how my 3rdparty tree may look like

|   
+---bin
+---cmake
    |    sdl2_mixer-config.cmake
    |    sdl2_ttf-config.cmake
    |    sdl2-config.cmake
    |    
+---include
|   |   zconf.h
|   |   zlib.h
|   |   
|   +---GL
|   |       eglew.h
|   |       glew.h
|   |       glxew.h
|   |       wglew.h
|   |       
|   \---SDL2
|           all sdl headers (SDL_mixer.h and SDL_ttf.h should be there as well)
|           
\---lib
    +---x64
    |       glew32.lib
    |       glew32s.lib
    |       SDL2.dll
    |       SDL2.lib
    |       SDL2main.lib
    |       SDL2test.lib
    |       SDL2_mixer.dll
    |       SDL2_mixer.lib
    |       SDL2_ttf.lib
    |       SDL2_ttf.dll
    |       zlib.dll
    |       zlib.lib
    |       zlibstatic.lib
    |       
    \---x86
            glew32.lib
            glew32s.lib
            SDL2.dll
            SDL2.lib
            SDL2main.lib
            SDL2test.lib
            SDL2_mixer.dll
            SDL2_mixer.lib
            SDL2_mixer.dll
            zlib.dll
            zlib.lib
            zlibstatic.lib

You may already have your dependencies installed in other place(s), so just make sure CMake knows where to find them.

Now:

git clone https://github.com/alariq/mc2.git
cd mc2
md build64
cd build64
cmake.exe -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=c:/path_to_your_dependencies/ -DCMAKE_LIBRARY_ARCHITECTURE=x64 ..

(to generate project for VS1027 for 64bit build) (prefer absolute path)

or for 32bit build:

cmake.exe -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=c:/path_to_your_dependencies/ -DCMAKE_LIBRARY_ARCHITECTURE=x86 .. (prefer absolute path)

for 6bit build and VS2022:

cmake.exe -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH=c:/path_to_your_dependencies/ -DCMAKE_LIBRARY_ARCHITECTURE=x64 .. (prefer absolute path)

Now run generated solution and try to build it!

Now build string resources

First use script in test_scripts/res_conv/res_conv.pl to generate strings.res.cpp and strings.res.h files or just take them from that folder Then copy them to ./res folder Then:

cd res
md build64
cd build 64
cmake.exe -G "Visual Studio 15 2017 Win64" -DCMAKE_LIBRARY_ARCHITECTURE=x64 ..

put resulting dll along with executable file

Building data

Data files are located in a separate repository Building data is just a matter of executing make command. You can find instruction on how to do it there. But first one needs to build all necessary tools. There are 2 projects which have to be built:

  • data_tools
  • text_tool

All steps are same as for the main application. As a result you'll have next binaries: aseconv, makefst, makersp, mpak, text_tool. Copy those to the build_scripts folder in mc2srcdata repository.

Once everything in place, you can launch build scripts as described in corresponding README.txt file.

Building and running on Apple Silicon macOS

The macOS port builds natively on ARM64 Macs and uses SDL2 plus Apple's OpenGL compatibility stack. The game still needs the original/runtime data files built from the separate mc2srcdata repository.

Install build dependencies with Homebrew:

brew install cmake sdl2 sdl2_mixer sdl2_ttf glew zlib

Build the engine and tools:

git clone https://github.com/alariq/mc2.git
cd mc2
cmake -S . -B build-mac -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build-mac -j"$(sysctl -n hw.ncpu)"

The build produces the game binary at build-mac/mc2, the resource library at build-mac/out/res/libmc2res_64.dylib, and the data build tools under build-mac/out/data_tools and build-mac/out/text_tool.

To prepare game data:

  1. Clone/build the mc2srcdata repository.
  2. Copy the generated tools into the data repo's build_scripts directory: aseconv, makefst, makersp, pak (called mpak in older docs), and text_tool.
  3. Run the data repo's build script as described by its README.
  4. Copy the generated runtime files next to build-mac/mc2.

At minimum the runtime directory should contain mc2, libmc2res_64.dylib, the generated *.fst archives, the generated .cfg files such as system.cfg, options.cfg, and prefs.cfg, plus any generated data/, assets/, shaders/, and testtxm.tga files/directories.

Run from the runtime directory so relative paths resolve correctly:

cd build-mac
./mc2

macOS runtime notes:

  • Fullscreen is the default. To start windowed before launching, edit options.cfg and set b FullScreen = FALSE.
  • In-game, open Options -> Graphics and use Display: Fullscreen or Display: Windowed to switch modes.
  • The Graphics options screen also exposes common resolution sizes plus display modes reported by SDL.
  • To show the FPS overlay before launching, edit options.cfg and set b ShowFPS = TRUE; it can also be toggled from Options -> Graphics.
  • Fullscreen captures/hides the OS cursor. Windowed mode avoids mouse capture so macOS window switching remains usable.

Building on Linux

You, probably already know hot to do it. If not, please, see windows building section, the process is quite similar.

About

Mech Commander 2 open source engine + OpenGL Linux port

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C++ 92.1%
  • C 7.6%
  • CMake 0.1%
  • Shell 0.1%
  • GLSL 0.1%
  • Perl 0.0%