MM2MS Projector

Originally created by slacky. This is basically the same thing with some pre-calculated math

The MM2MS Projector is usually used through MM2MS, but can be used by itself if you want and know what you are doing.

By itself, the projector is basically a 3D engine, very similar to what the game uses:

_images/mm2ms_ape_rendered.png

It can be used to calculate the position of 3D coordinate and accurately display them in the right place in it’s 3D space:

_images/mm2ms_ape.png
_images/mm2ms_wireframes.gif

It’s projection is so close to what the game uses that it can render it’s models very accurately, for example, this is the model of the OSRS cow being rendered without colors:

_images/rscow.gif

When playing with the projector it might be useful to image your head a 3D grid with infinity cross sections.

Imagine a 2D grid like this:

_images/mm2ms.png

But imagine it with infinite crossings, so each pixel of the squares can have a X and Y crossing.

Now imagine and infine amount of those grids stacked up on top of that one and below, with vertical lines creating Z axis intersections.

That’s what a 3D grid is.


TMM2MSProjector

Main record responsible for MM2MS projection.


If you want to play with this and understand it better, you may need to override some functions like TMM2MSProjector.UpdateViewMatrix and TMM2MSProjector.SetupProjection.

A good strategy is to create overrides and/or link some of the fields availble to the keyboard so you can edit them and see how the projection is affected in real time, e.g.:

{$DEFINE WL_DISABLE_FAKE_INPUT}
{$I WaspLib/osrs.simba}

begin
  while True do
  begin
    Options.GetZoomLevel(False);

    if Keyboard.IsKeyDown(EKeyCode.NUM_1) then
      MM2MS.Projector.ViewEye.X += 1;

    if Keyboard.IsKeyDown(EKeyCode.NUM_2) then
      MM2MS.Projector.ViewEye.X -= 1;

    //basically TMM2MSProjector.UpdateViewMatrix:
    MM2MS.Projector.ViewMatrix := TMatrix4.LookAtRH(
      MM2MS.Projector.ViewEye, MM2MS.Projector.ViewTarget, MM2MS.Projector.ViewUp
    );

    Minimap.DebugTiles();
  end;
end.
_images/mm2ms_tweaking.gif