wheybags / freeablo

[ARCHIVED] Modern reimplementation of the Diablo 1 game engine
GNU General Public License v3.0
2.16k stars 195 forks source link

Clipping issues #455

Open vieiraa opened 4 years ago

vieiraa commented 4 years ago

Parts of the player's sprites can be seen through a wall:

image

AJenbo commented 4 years ago

This is a hard one to solve, the problem stems from walls and floors being on the same tile. This makes it close to impossible to draw the tiles in an order that doesn't cause issues like this. The original game checked if you were moving in a diagonal and if that was the case it would redraw the tile you were moving in to. But this actually created new issues where it could draw on top of sprites on the other side of the wall.

DIABLO_20190428_063210

In the following video, you can see how the original render first renders the hero sticking through the wall, and then tries to cover it up but renders on top of the bookcase when doing do. https://youtu.be/9JN_8shuKy0

Additionally, this also means that true transparency cannot be used since this method results in the same transparent tile being rendered multiple times.

p.s. the movement tracking fails when actors make sharp turns at walls, this can easily be done as you pass by Farnham's house: https://youtu.be/smZgepWpEA0

wheybags commented 4 years ago

My plan is to eventually use a set of handmade masks to split walls out of the tileset, to solve this 100%. I also have ambitions of using it to render the game in pseudo 3d, so we can get proper dynamic lighting, but that's definitely a "maybe later" job :p

1 Feb 2020 5:45:52 pm Anders Jenbo notifications@github.com:

This is a hard one to solve, the problem stems from walls and floors being on the same tile. This makes it close to impossible to draw the tiles in an order that doesn't cause issues like this. The original game checked if you were moving in a diagonal and if that was the case it would redraw the tile you were moving in to. But this actually created new issues where it could draw on top of sprites on the other side of the wall.

[https://user-images.githubusercontent.com/15209402/56859862-422f2280-6956-11e9-9e68-87837b4de583.png] [https://user-images.githubusercontent.com/15209402/56859862-422f2280-6956-11e9-9e68-87837b4de583.png]

In the following video, you can see how the original render first renders the hero sticking through the wall, and then tries to cover it up but renders on top of the bookcase when doing do. https://youtu.be/9JN_8shuKy0 [https://youtu.be/9JN_8shuKy0]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [https://github.com/wheybags/freeablo/issues/455?email_source=notifications&email_token=AAIK5GWF2CNLZIIZPCCYN2DRAWRL7A5CNFSM4KOTPIP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRBH6Q#issuecomment-581047290] , or unsubscribe [https://github.com/notifications/unsubscribe-auth/AAIK5GUPAHGXXKMIK7TPKELRAWRL7ANCNFSM4KOTPIPQ] . [https://github.com/notifications/beacon/AAIK5GUNN3Z74WQYYDP2TZ3RAWRL7A5CNFSM4KOTPIP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRBH6Q.gif]