d2dx icon indicating copy to clipboard operation
d2dx copied to clipboard

Extend motion prediction support

Open Jarcho opened this issue 1 year ago • 87 comments

Fixes #172 Fixes #166 Fixes #167 Fixes #165 Fixes #159 Fixes #155 Fixes #141 Fixes #99 Fixes #95 Fixes #38

Mostly fixes #105

Adds motion prediction to 1.10 and ports the motion prediction for text to all versions.

Jarcho avatar Sep 07 '22 20:09 Jarcho

I didn't test it on 1.09d yet but if the text works it will be amazing! Congratulations for a job well done @Jarcho ...

Now, since this project is mostly abandoned by its original author, could you please perhaps fix the bug with MoP disabling after playing for some time, its the only thing ruining the experience for everyone else right now and thanks again!!!

Marcelo20XX avatar Sep 22 '22 23:09 Marcelo20XX

I haven't had that happen to me yet, so it's going to be a pain to debug. I know the motion prediction code has some n^2 parts to it which cause the frame rate to drop below 25fps on busy scenes which might be related.

Unit ID's are shortened to u16's instead of u32's which might also be the cause of the issue. Could try using the full u32 id and see if that ends up fixing it.


I'm working slowly on writing a different glide wrapper in my spare time. No idea when I'll have that done though.

Jarcho avatar Sep 23 '22 02:09 Jarcho

Can you try this and see if it works? Note the builtin res mod is removed on this build. You'll need to provide your own version.

Jarcho avatar Sep 23 '22 06:09 Jarcho

I was back from work and I immediately saw you updated your repo, thanks my man!!! the belt and floating text issues are fixed. I am currently testing LoD 1.09d but I can be your beta tester for other patches too. Regarding the long session error, that's my main interest, I tried myself a couple of times to fix it but my knowledge of the D2 code isn't enough for it so I am finger crossing for a chance at a fix...

EDIT: I ran a test with the Sorceress on the entire ActV which was my previous field for testing the MoP issue and after having complete the entire act without the bug triggering I think its safe to assume the bug is fixed. The entire run took me 2 hours, where previously I triggered the bug after 20-30 mins playing this act...

Marcelo20XX avatar Sep 23 '22 22:09 Marcelo20XX

That would mean the unit id's exceeding 16 bits was the issue. That doesn't fix the issue with frames dropping on busy scenes, but that needs a rewrite of the motion prediction code. Not something that will happen for a while.

If it ends up happening you can post back and I'll look into it some more.

Jarcho avatar Sep 24 '22 20:09 Jarcho

Exactly, I was having the FPS reverted back to 25FPS on busy scenes i.e. when fighting against Crushing Beast with an Imp mounted casting Inferno on Act V...

Thanks again for the fix and be sure I will report back if I have the issue happening again...

Btw, do you accept reporting other bug issues?

Marcelo20XX avatar Sep 24 '22 22:09 Marcelo20XX

I can at least look in to things.

Jarcho avatar Sep 25 '22 03:09 Jarcho

Can you try this and see if it works? Note the builtin res mod is removed on this build. You'll need to provide your own version.

Thanks a ton! Amazing work. Only thing your pre release build isn't working but when I compile from your source everything works perfectly with newest version of SGD2Freeres.

Your pre release build doesn't seem to recognize d2dx.cfg somehow...

jaydee2k avatar Sep 25 '22 13:09 jaydee2k

The pre-release isn't quite the same as the source here. The source still uses the integrated res mod whereas the prerelease has it stripped out. You'd need to provide your own copy of SGD2FreeRes.dll alongside it.

Jarcho avatar Sep 25 '22 18:09 Jarcho

Yeah I know, I'm already using an external version of SGD2Freeres. Strangely only the compiled source is working for me. Works like a charm.

Pre release one ignores my d2dx.cfg and isn't using motion prediction. I have no idea why...

jaydee2k avatar Sep 25 '22 19:09 jaydee2k

Strange. Ignoring d2dx.cfg would result in both being enabled so that's not the problem.

Jarcho avatar Sep 25 '22 19:09 Jarcho

Can you try this and see if it works? Note the builtin res mod is removed on this build. You'll need to provide your own version.

I tried to compile your d2dx-test-motion-prediction source in vs 2022 but got an error as followed:

Screenshot (47)

Any idea?

CaptainRay1993 avatar Sep 26 '22 05:09 CaptainRay1993

Just ignore that error, only thing it does is to copy the file glide3x.dll after compilation to a certain folder, the compiled file will be inside the Release folder. Also compile the source on "Release" mode not Debug...

Marcelo20XX avatar Sep 26 '22 06:09 Marcelo20XX

Thanks for your reply. I added float-point scaling factor from #133 and recompiled and it just works!

CaptainRay1993 avatar Sep 26 '22 07:09 CaptainRay1993

I found a bug left with motion prediction for text in 1.09d. When you are walking and selecting npcs or containers like chests there will be still no motion prediction for these texts. Just a little annoyance. In 1.13d theres motion prediction for these texts too.

jaydee2k avatar Sep 26 '22 09:09 jaydee2k

There is some polish needed for the hovering text MoP to work properly, it still has this bug: https://github.com/bolrog/d2dx/issues/105

The text sometimes jumps randomly in all versions and there is no MoP for Shrines too. Can you take a look at this @Jarcho thank you in advance...

Marcelo20XX avatar Sep 26 '22 15:09 Marcelo20XX

Can you guys provide a compiled download of glide3dx.dll for us? Or give us instructions? The file I found here does not work in that it doesn't give me widescreen resolutions.

whipowill avatar Sep 26 '22 23:09 whipowill

You'll need a copy of SGD2FreeRes for that version. This is the latest: https://github.com/mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution/releases/tag/3.0.2.6. Both SGD2FreeRes.dll and SGD2FreeRes.mpq need to be placed alongside glide3x.dll.

Jarcho avatar Sep 27 '22 00:09 Jarcho

Also @Jarcho , I know this is not a bug but more of a feature, but since it can be a quick change to the source... Could you perhaps fix the Cinematics videos showing with letter boxes on both the horizontal and vertical axis? I mean since they are close to 16:9 shouldn't be full screen for people that plays on widescreen resolutions?

Marcelo20XX avatar Sep 27 '22 06:09 Marcelo20XX

Is the compiled glide3x.dll limited to a particular patch? I've tried using it with 1.13c/d and 1.14d and the game does launch with it, but it runs without any motion prediction at all. This is with or without SGD2FreeRes.dll and SGD2FreeRes.mpq. For the record, I only play using the default 800x600 resolution.

tomasz1986 avatar Sep 27 '22 07:09 tomasz1986

Can you guys provide a compiled download of glide3dx.dll for us? Or give us instructions? The file I found here does not work in that it doesn't give me widescreen resolutions.

You can try my build which updates built-in SGD2FreeRes to the latest version and includes changes from #177 and #133.

CaptainRay1993 avatar Sep 27 '22 14:09 CaptainRay1993

You'll need a copy of SGD2FreeRes for that version. This is the latest: https://github.com/mir-diablo-ii-tools/SlashGaming-Diablo-II-Free-Resolution/releases/tag/3.0.2.6. Both SGD2FreeRes.dll and SGD2FreeRes.mpq need to be placed alongside glide3x.dll.

I did get this to work but it seems to ignore my d2dx.cfg file? So I'm getting widescreen resolutions but not smooth FPS.

whipowill avatar Sep 27 '22 19:09 whipowill

@whipowill You can unzip this to your root folder: https://github.com/bolrog/d2dx/files/9659733/MoP_1.13c.zip or try @CaptainRay1993 fork repository release until Jarcho gets a release. Either way the zip is preconfigured to Widescreen and Motion Prediction enabled...

Marcelo20XX avatar Sep 27 '22 21:09 Marcelo20XX

The @CaptainRay1993's fork works great for me, and it does respect d2dx.cfg too. It basically seems to behave exactly the same as the official glide3x.dll. I haven't played the game enough yet to test whether the fps drop bug has been fixed though.

tomasz1986 avatar Sep 28 '22 09:09 tomasz1986

Also @Jarcho , I know this is not a bug but more of a feature, but since it can be a quick change to the source... Could you perhaps fix the Cinematics videos showing with letter boxes on both the horizontal and vertical axis? I mean since they are close to 16:9 shouldn't be full screen for people that plays on widescreen resolutions?

This is a small pain. The videos are displayed via screen-blitting and the two intro videos are 4x3.

Jarcho avatar Oct 13 '22 13:10 Jarcho

Can we change it so it crops the letterboxes, I did this for the Diablo 1 Source on the Devilution X project, but I didn't find where to do that here...

Also we can leave alone the two intro videos as they can be easily skipped via a simple modification on the D2Launch.dll (if anyone wants to know how, you can ask me)

Another possibility could be, show them as stretched and then overscan the top and bottom part of the image?

Marcelo20XX avatar Oct 13 '22 23:10 Marcelo20XX

I think you misunderstood something. What d2dx gets for display is a 640x480 buffer per video frame with no direct way to distinguish which video is playing. This is for the intro videos and cinematics. Both intro videos are actually 640x480 videos. The cinematics are 640x292. Removing the black border on the cinematics itself is easy, but it requires a way to distinguish which video is currently playing

Jarcho avatar Oct 14 '22 21:10 Jarcho

Assume the video played is a cinematic, it could be implemented as a toggle if the user wants the vanilla behavior, because there is a way to disable the intro videos by patching the D2Launch.dll file...

Could you show me how to do this as a proof of concept? And thank you for addressing this issue...

Marcelo20XX avatar Oct 14 '22 23:10 Marcelo20XX

Here the video and the main screen are stretched d2dx.zip Taken from ZYEL452-beta1-public

madbmax avatar Oct 16 '22 07:10 madbmax

@madbmax Thanks for the file but it is not what I was asking for, there is still letterboxes at the bottom and at the top, but surely is a step on the right direction, I think @Jarcho has a solution for this issue but he doesn't want to apply it to the intro videos too...

Marcelo20XX avatar Oct 17 '22 08:10 Marcelo20XX