Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend motion prediction support #177

Open
wants to merge 52 commits into
base: main
Choose a base branch
from

Conversation

Jarcho
Copy link

@Jarcho Jarcho commented Sep 7, 2022

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.

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 22, 2022

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!!!

@Jarcho
Copy link
Author

Jarcho commented Sep 23, 2022

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
Copy link
Author

Jarcho commented Sep 23, 2022

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.

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 23, 2022

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...

@Jarcho
Copy link
Author

Jarcho commented Sep 24, 2022

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.

@Marcelo20XX
Copy link

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?

@Jarcho
Copy link
Author

Jarcho commented Sep 25, 2022

I can at least look in to things.

@jaydee2k
Copy link

jaydee2k commented Sep 25, 2022

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...

@Jarcho
Copy link
Author

Jarcho commented Sep 25, 2022

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.

@jaydee2k
Copy link

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...

@Jarcho
Copy link
Author

Jarcho commented Sep 25, 2022

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

@CaptainRay1993
Copy link

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?

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 26, 2022

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...

@CaptainRay1993
Copy link

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

@jaydee2k
Copy link

jaydee2k commented Sep 26, 2022

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.

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 26, 2022

There is some polish needed for the hovering text MoP to work properly, it still has this bug: #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...

@whipowill
Copy link

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.

@Jarcho
Copy link
Author

Jarcho commented Sep 27, 2022

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.

@Marcelo20XX
Copy link

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?

@tomasz1986
Copy link

tomasz1986 commented Sep 27, 2022

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.

@CaptainRay1993
Copy link

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.

@whipowill
Copy link

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.

@Marcelo20XX
Copy link

Marcelo20XX commented Sep 27, 2022

@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...

@tomasz1986
Copy link

tomasz1986 commented Sep 28, 2022

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.

@Jarcho
Copy link
Author

Jarcho commented Oct 13, 2022

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.

@Marcelo20XX
Copy link

Marcelo20XX commented Oct 13, 2022

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?

@tomasz1986
Copy link

I've just tried the new build out. It does feel smoother than the last one. However, the terrain still feels unstable when the character is moving, resulting in it looking blurry. I can observe this, e.g. when looking straight at the terrain in front of the moving character.

d2dx_log.txt

For the record, the last version that doesn't display this kind of effect is https://github.com/Jarcho/d2dx/releases/tag/2022-11-02 (and, of course, the official releases from this repository). There, I can look at the terrain in the same situation and it remains stable all the time, even when the character is running quickly.

@Jarcho
Copy link
Author

Jarcho commented Dec 11, 2022

New build. I don't know if this will fix blurriness or not. The change to the motion prediction is pretty small this time.

@tomasz1986
Copy link

I've tried out the new build but I can't really feel any difference between it and the last one.

d2dx_log.txt

@Jarcho
Copy link
Author

Jarcho commented Dec 23, 2022

New build.

Were you using the new upscale method? It would be the default without a config file.

@Jarcho
Copy link
Author

Jarcho commented Dec 24, 2022

New build.

This doesn't fully fix the jiggling text labels, but it should be pretty close.

@Jarcho
Copy link
Author

Jarcho commented Dec 24, 2022

New build.

This only really has an effect at lower frame rates.

@tomasz1986
Copy link

tomasz1986 commented Dec 25, 2022

Unfortunately, the situation seems to have got even worse now 🙁. The same blurry/unstable background when running is still present, and on top of that the game has started to visibly stutter every few seconds (even though the FPS remains at stable 162 all the time). I've tested both with my old config file and without any (i.e. using the default settings) but there was no difference.

Here is the log file, although it appears extremely small compared to the previous ones.

d2dx_log.txt

@Jarcho
Copy link
Author

Jarcho commented Dec 25, 2022

Just added the profiled version. Can you run that post the log?

@tomasz1986
Copy link

tomasz1986 commented Dec 25, 2022

Here you go, although for some reason the game started in 640x480 resolution, which I then changed to 800x600. Also, I haven't observed the stuttering this time… No difference regarding background still being blurry while running.

d2dx_log.txt

Just a side question, as this isn't strictly related just to the PR itself, but I'd like to try doing some testing myself to find out which exact change is responsible for the difference/regression regarding terrain blurriness. What is the easiest way to compile the whole thing? Unfortunately, there don't seem to exist specific instructions anywhere. I'm more comfortable with building from the command line if that's of any significance.

@eleriaqueen
Copy link

eleriaqueen commented Dec 27, 2022

Hello, I just tested the latest build (d2dx-2022-12-24) and I too can see some slight blurriness on the BG when moving (with Scaling Mode 3) but it's so slight it doesn't bother me at all, but it looks as if the area close to the character shows some pixelation as if "unstable" when moving though, not sure how to describe it.

On another note, would be cool if you (Jarcho) could fix the high CPU usage when window is minimised / tabbed-out from.
Thank you for your hard work.

Edit : Tabbing out during startup cinematics seems to affect the predictor in a weird way (Log Included) :

Sizes: desktop 1920x1080, window 800x600, game 640x480, render 800x600
MotionPredictor: Expecting frame update
MotionPredictor: Predict at 1111/2621 (+-2147483648) of a frame
MotionPredictor: Predict at -469/2621 (+-2147483648) of a frame

d2dx_log.zip

@Marcelo20XX
Copy link

Here you go, although for some reason the game started in 640x480 resolution, which I then changed to 800x600. Also, I haven't observed the stuttering this time… No difference regarding background still being blurry while running.

d2dx_log.txt

Just a side question, as this isn't strictly related just to the PR itself, but I'd like to try doing some testing myself to find out which exact change is responsible for the difference/regression regarding terrain blurriness. What is the easiest way to compile the whole thing? Unfortunately, there don't seem to exist specific instructions anywhere. I'm more comfortable with building from the command line if that's of any significance.

The easiest way to compile the project is using Visual Studio and just choose release mode...

@Jarcho
Copy link
Author

Jarcho commented Dec 29, 2022

d2dx-test.zip

This partially reverts back to the older frame time tracking and removes the motion prediction. Hopefully this one ends up smooth.

@bolrog
Copy link
Owner

bolrog commented Mar 17, 2023

Very cool! I'd love to merge this, is it stable? I noted you had continued working on your branch.

I just don't have the time to work on this project anymore, so I'd be happy if someone carried it on.

@Jarcho
Copy link
Author

Jarcho commented Mar 18, 2023

The branch currently is not. I was working under the assumption you weren't coming back to this.

I can roll it back to something stable some time this weekend.

@Jarcho
Copy link
Author

Jarcho commented Mar 22, 2023

@bolrog Split off a few of the changes into different PR's. This was done mostly by cherry picking, but I haven't tested them. Hopefully they all compile and work.

@Jarcho
Copy link
Author

Jarcho commented Apr 9, 2023

New release

Unlike the last few build this uses the old motion prediction code. This still includes all the other bug fixes and improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment