Skip to content

iomohaa/mohpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MOHPC

1. Introduction

This C++ library permits reading Medal of Honor: Allied Assault (all versions) assets. It’s working fine on a big project (MOHUE) and is considered stable.

Some info about abbreviations:

MOHAA / AA

Medal of Honor Allied Assault

MOHAAS / SH

Medal of Honor Allied Assault: Spearhead

MOHAAB / BT

Medal of Honor Allied Assault: Breakthrough

The name of the library come from the fact that, in mohaa win32 binaries, the path for debugging symbols points to z:\mohpc\. As a consequence, it is assumed for the codename of the game to be mohpc.

2. Requirements

All
  • CMake 3.10 or higher

Windows
  • A compiler, like Visual Studio, that has full support for C++17

Unix
  • GCC 8.x or higher (C++17 compiler)

  • stdc++fs library on Unix

This library relies between STL and custom mfuse::con::Containers. Third-party components are downloaded and compiled automatically.

For any issue about missing thirdparty libraries:

  • jpegsr9d (used for reading JPEG image files) can be downloaded from here.

  • libmad, used for reading mp3 files, can be downloaded from here, version 0.15.1b.

  • zlib, important for reading compressed archives, like pk3 files, can be cloned with git from here by using the v1.2.11 branch/tag.

  • GameSpy SDK, used to query the server list from master server and to send an authorize request to SH/BT servers, can be cloned from here.

3. Compatibility

This library can be built on Windows and Unix systems, for any architecture. It is also endian-portable, which means this library can be used on both Little-Endian and Big-Endian processors.

It works well on Windows but there is no reason it shouldn’t work as well as on Windows on Unix systems.

4. Features

  • Assets reader.

  • Collision test.

  • Model renderer.

  • Networking / Player movement.

4.1. Supported asset types

  • BSP (map)

  • DCL (decal)

  • Model and animation

    • SKB (model)

    • SKD from all expansions (model)

    • SKC from all expansions (animation)

    • TIKI files

  • Images

    • JPEG

    • TGA

    • DDS

  • Sounds

    • .wav

    • .mp3

  • Shaders parsing

4.2. Networking

  • Connect to server.

  • Query server list from master server.

  • Query LAN server list.

  • Query server status/info.

  • Handlers for monitoring events.

4.2.1. Supported protocols versions and versions

The client can connect to any server running on one of the following protocols:

5

MOHAA Demo 0.05 (SP version).

6

MOHAA 1.0.

8

MOHAA 1.1 / above.

15

MOHAAS 2.0.

16

MOHAAS Demo 2.11 | MOHAAB demo 0.30.

17

MOHAAS 2.11 / above | MOHAAB 2.30 / 2.40b.

Note: Breakthrough shares the same protocol as Spearhead, excepts it adds "Breakthrough" clientType value when connecting.

Note 2: Protocol version 5 is assumed to be supported, but the SP demo was not compiled with remote network support.

4.2.2. In-game

  • Download is supported.

  • Entities/snapshots fetching.

  • Full support for realtime packets/messages processing.

  • Game events parsing, callbacks & notifications.

  • Interpolation/Extrapolation support.

  • Player movement prediction and local collision support.

  • Radar support which requires the server to be running at least SH 2.0. It used to keep track of teammates when the server is not sending players to the client (non-pvs).

  • User input support (all inputs are supported).

5. Example

The following example demonstrates how to load an asset and test collision:

#include <MOHPC/Managers/AssetManager.h>
#include <MOHPC/Managers/FileManager.h>
#include <MOHPC/Managers/ShaderManager.h>

int main(int argc, char *argv[])
{
    MOHPC::AssetManager AM;
    MOHPC::FileManager* FM = AM.GetFileManager();
    // setup the game directory
    // will load all pak files from Allied Assault, Spearhead and Breakthrough.
    FM->FillGameDirectory("D:\\Path\\To\\Mohaa");
    //FM->FillGameDirectory("/home/mohaa/") // the path to mohaa in unix systems

    // load a map (mohdm6)
    MOHPC::BSPPtr bspLevel = AM.LoadAsset<MOHPC::BSP>("/maps/dm/mohdm6.bsp");

    // setup collision
    MOHPC::CollisionWorldPtr cm = MOHPC::CollisionWorld::create();
    bspLevel->FillCollisionWorld(*cm);

    // trace through world
    MOHPC::Vector start(0, 0, 0);
    MOHPC::Vector end(0, 0, -500);
    cm.CM_BoxTrace(&results, start, end, MOHPC::Vector(), MOHPC::Vector(), 5, MOHPC::ContentFlags::MASK_PLAYERSOLID, true);

    // fraction should be less than 1 because of the terrain
}

5.1. TODO

This README will change over time. The library is also subject to change overtime. It will also need more unit tests. A documentation will come, but it is not the priority.

About

Library for reading assets from Medal of Honor: Allied Assault, featuring simulation of moh:aa network and more

Resources

License

Stars

Watchers

Forks

Packages

No packages published