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

Avoid visplane overflow with little cost #108

Open
RamonUnch opened this issue Oct 6, 2022 · 2 comments
Open

Avoid visplane overflow with little cost #108

RamonUnch opened this issue Oct 6, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@RamonUnch
Copy link
Contributor

I was playing around in some slightly limit removing wads and I saw that the check for visible plane overflow was removed in fastdoom.
In any cases with vanilla the behavior is annoying because you get a crash as soon as there are more than MAXVISPLANES.
There is an easy fix which is to add a simple check at the begining of R_FindPlane:

visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel)
{
    visplane_t *check;
    lastvisplane = min(lastvisplane, visplanes + MAXVISPLANES-1);

the min function being branchless the cost is quite small, around 0.1% on demo1 and demo4 -nosound with DOSBox 386@33000 cycles.
I could not measure any impact on demo3 nor demo2. I guess there are too few visplanes for any effect.
The benefit is that you just get visual glitches when the map goes over-detailed instead of a crash. This makes more wads playable.
I am not sure this should be included in FastDoom but given you raised the sprite limit, I thought you might be interested.

@viti95
Copy link
Owner

viti95 commented Oct 6, 2022

Maybe it's better to make the visplanes unlimited, I already did a fully working implementation (there is a branch) for it. I remember it was minimally slower, and the main benefit is that it used less memory in general. Don't remember exactly why I didn't merged it at the end.

@RamonUnch
Copy link
Contributor Author

Unlimited would be even better indeed! especially if performance hit is minimal. Being able to use less memory on vanilla levels is also a plus.

@viti95 viti95 added the enhancement New feature or request label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants