OpenLRR icon indicating copy to clipboard operation
OpenLRR copied to clipboard

Replace Direct3D Retained Mode (D3DRM)

Open trigger-segfault opened this issue 4 years ago • 2 comments

Describe the issue

Direct3D Retained Mode (D3DRM) is a deprecated high-level graphics library that LRR is primarily built off of. Dependence on this library is the biggest aspect holding the game back from rewriting and replacing all 2D and 3D graphics functionality.

The existence of D3DRM locks the game into using DirectDraw for 2D graphics, which is a major factor in the game's performance problems on modern systems.

Removing D3DRM is essential in order to extend many of the game's graphical limitations, and provide support for other platforms.


Information

  • Because of the D3DRM's age, there is much less documentation on the API, and what it really is doing underneath.
  • Game logic is indirectly dependent on D3DRM, as 3D positioning (and other similar information) is entirely housed within the D3DRM interfaces. Changing this will require Containers to store this information on their own.

List of modules to rewrite

The game side of LRR is entirely isolated from all D3DRM APIs thanks to the engine/gfx/ modules. Replacing D3DRM requires modifying all of the internals for these modules, while still providing the same API functions that the game depends on.

  • engine/gfx/AnimClone (internal to engine: Containers only)
  • engine/gfx/Containers (a do-all structure that can act as various types of D3DRM visuals)
  • engine/gfx/Lws (LightWave scene, internal to engine except for Lego_Initialise/Shutdown)
  • engine/gfx/Materials (single use case/single function)
  • engine/gfx/Mesh (primarily relies on Direct3D Immediate Mode)
  • engine/gfx/Viewports (some reliance on Direct3D Immediate Mode, to cooperate with Mesh)
  • engine/audio/3DSound
  • engine/Main (provides Direct3DRM interfaces)

trigger-segfault avatar Oct 11 '21 23:10 trigger-segfault

Hi, I have ben working on an implementation for a similar project for Lego Island. https://github.com/isledecomp/isle-portable/tree/master/miniwin/miniwin/include

It's source compatible with and currently has an implementation of DirectDraw and a skeleton of D3DRM. This means that it's good enough to bring up the game on both Mac and Linux and get the 2D portion of the game rendering while still allowing you to also build against the original DirectX / WinAPI.

Image (Lego Island running on Linux)

If you can retool OpenLRR to use CMake (here is an example from Lego Island) as a build system (works with Visual Studio as well) then I'm happy to help with getting things up and running, getting things in to shape and sync things as progress is made on the D3DRM implementation.

AJenbo avatar May 21 '25 15:05 AJenbo

It's now fully featured with high resolution and widescreen support

Image

Image

AJenbo avatar Jun 24 '25 00:06 AJenbo