Skip to content

Ghoster738/Future-Cop-MIT

Repository files navigation

Future Cop: MIT

Open Source Game Engine Project

About

This is an incomplete re-implementation attempt of the Future Cop: LAPD game, developed by Visceral Games (named EA Redwood Shores at the time) and released in 1998 for the PlayStation, Mac OS and Windows platforms.

Right now there is no gameplay yet. However, there is a map viewer that can display the level geometry, a model viewer that can view the models (with animations if available), and a mission reader/ripper that can extract various resources from the game files.

Disclaimer: This project no way is affliated with the Massachusetts Institute of Technology (MIT) except that its license is choosen by Ghoster738 for this project.

System Requirements

There are no clearly defined system requirements at this time, however the project's aim is to run on very low spec computers by today standards (but not on the original computers that ran Future Cop when it was released). This should encompass most of today's devices, as the project successful compiled on a Raspberry PI 4.

Although another aim is to create portable code, this code will not work on the PlayStation 1 due to its lack of C++17 support - as developing for C99 would be harder with the constant worry of memory management. However, the code might be able to run on the Raspberry PI Zero.

Original Game Data

All these tools (and the actual game when ready) require the presence of the original game data in order to function.

See the autoloading system for a simple way to use it, or use the parameters for the individual programs.

Third-Party Libraries Used

These are the third party libraries that this project uses.

Build instructions

Linux

These build instructions are for Ubuntu, might work on Ubuntu derivatives.

  1. Install build tools and packages:

    A. Arch-based Linux Distributions through pacman

    This command will install the estential packages required by Future Cop M.I.T. Note: You might not have sudo, but at this point you probably know how to use su. However, remember to use root only for pacman.

    cmake is what this project uses for cross-platform build automation. make which is generated by camke is used to build the project. gcc is the compiler that is used for this project. It is required for this project to be compiled

    sudo pacman -S make cmake gcc
    

    This project requires these libraries.

    sudo pacman -S glm sdl2 jsoncpp
    

    Optional: install additional tools and packages:

    • zlib for compression.

    • libpng for PNG export support.

    To install libpng and zlib use this command. pacman would install zlib automatically due to libpng using it.

    sudo pacman -S libpng
    

    Optional but recommended: install git for repository cloning and build versioning.

    sudo pacman -S git
    

    B. Debian-based Linux Distributions through APT

    This command will install the essential packages required by Future Cop M.I.T.

    sudo apt install build-essential cmake libglm-dev libsdl2-dev libjsoncpp-dev
    
    • Optional: install additional tools and packages:
    • libz-dev for compression, but libpng-dev requires it so apt would install this with libpng-dev.
    • libpng-dev for PNG export support. libpng requires zlib so pacman and APT would install this with libpng.
    • git for repository cloning and build versioning
    sudo apt install libpng-dev git
    
  2. Get or clone the source code:

    • Clone:

      A. If you want everything then clone then use this command. On a folder or directory where you want to host the source code.

       git clone https://github.com/Ghoster738/Future-Cop-MIT.git
      

      B. If you want only just enough to compile for yourself then clone then use this command. On a folder or directory where you want to host the source code.

       git clone --depth 1 https://github.com/Ghoster738/Future-Cop-MIT.git
      

      Get into the source code and get its submodules. Submodule mINI is required for compilation:

       cd Future-Cop-MIT
       git submodule update --init --recursive --progress --depth 1
      
    • Download the latest source code. (Warning: using git is strongly recommended, because of the ease of automatically downloading the submodules.)

    For the direct download all that is required is to get mINI and put it into the submodules mINI directory.

    Open the terminal inside the extracted folder where you can find this readme.

  1. Prepare an out of source build:

    Note: If you downloaded Future-Cop-MIT manually then open the terminal inside the extracted folder where you can find this readme.

    mkdir -p build/linux
    cd build/linux
    
  1. Configure the build (add your options if needed):

    A. If the gcc version 9.1 or above use this command:

    cmake ../.. -DCMAKE_BUILD_TYPE=Release
    

    B. Pre 9.1 of gcc would need this command to compile:

    cmake ../.. -DFCOption_PREGCC_9_1_LIBRARIES=ON -DCMAKE_BUILD_TYPE=Release
    
  2. Build it with this command (-j is optional, but it would make compiling faster):

    make -j<Number of CPU Cores>
    

    For example, if the computer has 8 threads then you would use this command:

    make -j8
    

Windows

On Windows

⚠️ There are no build instructions for Windows at this time.

Cross-Compiling under Linux with MinGW-w64

  1. Follow linux instructions from 1 - 2. Section 1 on Linux shows how to setup part of the packages used to build the project. Section 2 on Linux shows how to get the source code.

  2. Get MinGW-w64.

    A. Arch-based Linux Distributions through pacman

    sudo pacman -S mingw-w64-gcc
    

    B. Debian-based Linux Distributions through APT: Disclaimer: This command is not tested.

    sudo apt install mingw-w64 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-tools
    
  3. Prepare an out of source build:

    Note: If you downloaded Future-Cop-MIT manually then open the terminal inside the extracted folder where you can find this readme.

    mkdir -p build/windows
    cd build/windows
    
  4. Get the toolchain file from this link link from Peter Spackman. Place it into the windows directory we created last step.

    Name the file "mingw-w64-x86_64.cmake" into the build/windows directory. Use the 'ls' command to verify that the toolchain file is there.

    ls
    
  1. Create the build setup.

    1. rootpath is useful for placing library install paths. make is used as a destination to compile this project and the libraries it uses.
    mkdir make rootpath
    
    1. setup the make directory with paths. jsoncpp, libpng, and zlib directories hold the libraries used by the project. prime holds this project. Note: SDL2 is excluded on purpose because the vendored SDL2 option on Future Cop MIT is simpler to use.
    cd make
    mkdir jsoncpp libpng prime zlib
    
  2. Compile and "install" jsoncpp. This library is required to get this project working!

    First go into jsoncpp directory.

    cd jsoncpp
    

    Then run cmake. This command turns on the post build unit test on purpose because the unit tests requires WINE to run in order to get the tests working.

    cmake -DCMAKE_TOOLCHAIN_FILE=../../mingw-w64-x86_64.cmake -DCMAKE_INSTALL_PREFIX=../../rootpath -DJSONCPP_WITH_PORT_BUILD_UNITTEST=OFF ../../../../submodules/jsoncpp
    

    If cmake is successful use this command. Note: Normally install would require root access, but the install prefix is set to rootpath directory.

    make -j<Number of CPU Cores> install
    

    Note: Replace "<Number of CPU Cores>" with a number.

    make -j8 install
    

    Get out of the directory to make path.

    cd ..
    
  3. Compile and "install" zlib. This library is optional, but libpng needs this to work.

    First go into jsoncpp directory.

    cd zlib
    

    Then run cmake. This command turns on the post build unit test on purpose because the unit tests requires WINE to run in order to get the tests working.

    cmake -DCMAKE_TOOLCHAIN_FILE=../../mingw-w64-x86_64.cmake -DCMAKE_INSTALL_PREFIX=../../rootpath ../../../../submodules/zlib
    

    If cmake is successful use this command. Note: Normally install would require root access, but the install prefix is set to rootpath directory.

    make -j<Number of CPU Cores> install
    

    Get out of the directory to make path.

    cd ..
    
  4. Compile and "install" libpng. This library is optional, but needed for png export.

    First go into jsoncpp directory.

    cd libpng
    

    Then run cmake. This command turns on the post build unit test on purpose because the unit tests requires WINE to run in order to get the tests working.

    cmake -DCMAKE_TOOLCHAIN_FILE=../../mingw-w64-x86_64.cmake -DZLIB_INCLUDE_DIR=../../rootpath/include -DZLIB_LIBRARY=../../rootpath/bin/libzlib.dll -DCMAKE_INSTALL_PREFIX=../../rootpath ../../../../submodules/libpng
    

    If cmake is successful use this command. Note: Normally install would require root access, but the install prefix is set to rootpath directory.

    make -j<Number of CPU Cores> install
    

    Get out of the directory to make path.

    cd ..
    
  5. Final compile step.

    First go into prime directory.

    cd prime
    

    This is the minimal steps for the windows build with no png support.

    cmake -DCMAKE_TOOLCHAIN_FILE=../../mingw-w64-x86_64.cmake -DJSON_CPP_INCLUDE_DIR=../../rootpath/include -DJSON_CPP_LIBRARY=../../rootpath/bin/libjsoncpp.dll -DFCOption_GLM_VENDORED=ON -DFCOption_SDL2_VENDORED=ON ../../../../
    

    This is the full build steps for the windows build with png support

    cmake -DCMAKE_TOOLCHAIN_FILE=../../mingw-w64-x86_64.cmake -DZLIB_INCLUDE_DIR=../../rootpath/include -DZLIB_LIBRARY=../../rootpath/bin/libzlib.dll -DPNG_PNG_INCLUDE_DIR=../../rootpath/include -DPNG_LIBRARY_RELEASE=../../rootpath/bin/libpng16.dll -DJSON_CPP_INCLUDE_DIR=../../rootpath/include -DJSON_CPP_LIBRARY=../../rootpath/bin/libjsoncpp.dll -DFCOption_GLM_VENDORED=ON -DFCOption_SDL2_VENDORED=ON ../../../../
    

    Finally, compile the program with this command.

    make -j<Number of CPU Cores>
    
  6. Running the executables requires certain libraries in the same location as the executables to run.

    These are libraries in the same location as the executables that have been compiled.

    cp /usr/x86_64-w64-mingw32/bin/libgcc_s_seh-1.dll libgcc_s_seh-1.dll
    cp /usr/x86_64-w64-mingw32/bin/libwinpthread-1.dll libwinpthread-1.dll
    cp /usr/x86_64-w64-mingw32/bin/libstdc++-6.dll libstdc++-6.dll
    

    This library is required to get the project to running.

    cp ../../rootpath/bin/libjsoncpp.dll libjsoncpp.dll
    

    This library is required to get the project to running. If you had not compiled the project with zlib and libpng, then you do not have to include these two libraries.

    cp ../../rootpath/bin/libzlib.dll  libzlib.dll
    cp ../../rootpath/bin/libpng16.dll libpng16.dll
    
  7. Optional Running your hard work on Linux.

    Get wine to test/run the executable. If you already have wine skip this step.

    A. Arch-based Linux Distributions through pacman

    Use these instructions from archlinux.org to install wine. You only need the 64 bit version of wine to run this project.

    B. Debian-based Linux Distributions through APT:

    Use these instructions from makeuseof.org to install wine. You only need the 64 bit version of wine to run this project.

    Now, you can run my project on linux.

    wine FCopMIT.exe
    

Mac OS

⚠️ There are no build instructions for Mac OS at this time.

Tools overview

This repository contains a map viewer, a model viewer, and a mission file ripper that can read game data from all platforms Future Cop was released on, with the Windows version being the best in terms of reading and understanding game data.

Note that these tools are not capable of making new mission files, they only decode and export. If you want to make a new map, use BahKooJ's FC3DEditor.

FCMissionReader

This is a pure terminal program built in order to showcase the decoding ability. It exports the game resources from the game files to a common formats (.png for images, .wav for sounds, .json for actors, etc)

Usage

FCMissionReader [-h] [-i <path>] [-o <path>] [-r] [-d] [-c]

Parameters

  Parameter   Description
-h Display the help screen.
-i <path> Mission file to be read, up to two files are supported.
-o <path> Path to the folder where to write the decoded data. Warning: This should be an existing directory, and it should be empty.
-r Export the raw resources of the mission file
-d Export the resources of the mission file into more common data formats.
-c Determine and write the similarities between two inputs.

Examples

FCMissionReader -i path/to/mission/File1 -i path/to/mission/File2
FCMissionReader -i path/to/mission/File -o path/to/existing/directory
FCMissionReader -i path/to/mission/File -o path/to/existing/directory -r
FCMissionReader -i path/to/mission/File -o path/to/existing/directory -d

FCopMIT

The primary executable of this project.

Usage

FCopMIT [-h|--help]
        [--width <number>] [--height <number>]
        [--res <number>x<number>]
        [--fullscreen|--window]
        [--config <path>] [--user <path>]
        [--win-data <path>] [--mac-data <path>] [--psx-data <path>]
        [--path <file path>] [--global <file path>]

Parameters

         Parameter          Description
-h, --help Display this help screen and exit.
--width <number> Window width, in pixels.
--height <number> Window height, in pixels.
---res <number>x<number> Window width and height in pixels, as a single parameter.
--fullscreen Full screen mode.
--window Window mode.
--user <path> Path to directory - savegames and screenshots
--config <path> Path to game configuration directory
--win-data <path> Path to directory - Future Cop LAPD original Windows data
--mac-data <path> Path to directory - Future Cop LAPD original Macintosh data
--psx-data <path> Path to directory - Future Cop LAPD original Playstation data
--export-path <path> Path to directory - path to where exported models go from the model viewer
--global <file path> Path to the global file which every map uses.
--path <file path> Path to the mission file which contains the rest of the data like the map.

Examples

FCopMIT --window --res 1024x768
FCopMIT --fullscreen --res 1920x1080
FCopMIT --global /path/to/global_mission --path "/path/to/mission"

The ID system

This is a list of level names that are used internally.

Crime War Precinct Assault
griffith-park pa-urban-jungle
zuma-beach pa-venice-beach
la-brea-tar-pits pa-hollywood-keys
venice-beach pa-proving-grounds
hells-gate-prison pa-bug-hunt
studio-city pa-la-centina
lax-spaceport
lax-spaceport-part-2
long-beach

Loading game data

By placing the game data in a certain directory (depending on the platform) the FCopMIT will load and parse data.

Please see the documentation file named Paths

Note that paths are case-sensitive on Mac and Linux:

Resource types

Internal

This is a list of internal resources that can be read and understood - there are still some gaps in understanding all of them, noted with italics.

Type Description
ACT The "actors" of the game. As of now only one type of act can be read.
ANM Animated 64x48 images. It is only used in Crime War for some reason.
BMP Textures. Incomplete understanding so far of the Windows and Mac OS format.
FNTP Font resource.
MSIC Music resource.
NET Navigation node data for ground allies and enemies.
OBJ Model information, with animation. Incomplete understanding of some polygon data.
PTC Map tile index information.
PYR Billboards or the particle textures.
SNDS Voice resource.
TIL Map cluster of tiles. Format is a bit weird, but ingenious nevertheless.
WAV Sound effects resource.

Exported

This is list of exported resource formats and the corresponding internal format for the original game data.

  • Audio resources - exported to WAV audio:
    • WAV : Very easy to convert
    • SNDS: PCM audio
    • MSIC: Also PCM audio
  • Image resources - exported to QOI (or PNG if support is enabled):
    • ANM: All the animation frames are exported in a single image with the individual frames being stacked vertically.
    • BMP: A single 256x256 image for each resource.
    • PYR: This gets separated into textures.
    • FNTP: Font data exported as raster image.
  • Model resources - exported to glTF format:
    • OBJ: A single 3D model per resource is created.
    • TIL: A single 3D model of the tile clusters.
  • Font resources - exported to BMFont format:
    • FNTP: Font data exported as character descriptions.
  • Meta resources - exported to JSON format to make the exports more readable:
    • ACT: Only what seems to be "prop" types from the game are exported at this time.
    • NET: Only coordinates and some other properties are exported at this time.

Thanks

Users

  • BahKooJ for various information about Future Cop.

  • Killermosi/kkmic for improving parameter system, the filesystem, and the options system.