andwn / cave-story-md

A fan port of Cave Story for the Sega Mega Drive
564 stars 34 forks source link

Sprites sometimes show as whiteboxes #321

Open soniccd123 opened 4 years ago

soniccd123 commented 4 years ago

Tested in real hardware, played the whole game and everything worked just fine, beautiful port by the way, but sometimes one or two sprites get corrupted. As i could notice, it seens to be just one frame of animation when it is on an animated objetc, other times is a droped item, some scrolling background, the weapon projectile sprites or a HUD element. Almost always is just one sprite that gets corrupted in the scene and it shows as a whitebox or garbage lines with the size of the sprite. Most of the time pausing and unpausing the game solves the problem, but not rarely a new sprite gets corrupted. Entering again a room or scene when theres a door available also fixes the corrupted sprites.

andwn commented 4 years ago

I think I know why this happened actually, forgot to do something that prevents an issue like this on some specific hardware models. Mind trying a patched ROM if I upload one here?

soniccd123 commented 4 years ago

No problems! I'll happly test it and report back. If you need hardware specifics, i'm playing in a japanese Mega Drive model 1 (HAA-2510) with a 32X attached using a simples flashcart that i made (EPROM and FeRAM), i dont know exactly which motherboard revision, but if its important, i can look into it.

andwn commented 4 years ago

So yeah definitely forgot to pause the Z80 when doing DMA which can cause graphical issues. Don't remember which consoles it affects exactly but supposedly earlier model 1s are part of that group. Hopefully this build will fix that. If not, then maybe it isn't what I thought it was after all.

doukutsu.bin.zip

soniccd123 commented 4 years ago

Hello, i have tested Egg Corridor and Grasstown and the problem seen to be almost gone. I had just two situations where the HUD level bar became white and another one that the gun projectile became corrupted. I will play more later to see if theres more situations

andwn commented 4 years ago

Ok, at least I'm on the right track. I bet it's just that there are more places I use DMA to upload graphics and need to take care of those too.

Might need to find a Japanese model 1 one of these days, but don't know if all of them do this or just the earlier board revisions. The spritesmind folks probably know.

andwn commented 4 years ago

Oh, and thank you for confirming!

mastercheff commented 3 years ago

Hello, I have a PAL Mega Drive VA6 modded for ntsc display, last couple of days i started playing this with version 0.6 , sprites were often corrupted. Now today checked the 0.7 release , its better : with fireball glitch is mostly gone , but still occurs on power triangles and enemy sprites... Otherwise, magnificent work Sir, I enjoy it a ton since genny/md lacked proper metroidvania

Edit: some evidence here https://share.icloud.com/photos/0pP2T1IjobDi-tU0rYDVQntjQ

mastercheff commented 3 years ago

Yesterday i tinkered a bit with ROM supplied within this topic. There are noticeable differences in behavior: fireball projectiles are less glitchy, but instead rocket launcher trail is all white boxes. Also in 0.7 when You spam fireball while exiting a room, projectiles appear in the new room (in build of 4 august they stay in the room where You fired it and reappear correctly with quick re-entering). The area I focused on is Labirynth W,H

Edit: and a blue screen, too https://share.icloud.com/photos/0Y7fNjJV4yrqh_J6FVSmGWIDQ

andwn commented 3 years ago

I think the white boxes are because I forgot to pause the z80 when loading sprite sheets during map load. That other thing your are describing is something different. I think the bullet array just needs to be cleared when the room loads too.

mastercheff commented 3 years ago

Aye, thanks for responding - now I know the overlord is watching this, thumbs up and fingers crossed. I'm realtively fresh to the mega drive. Gunstar Heroes will keep me occupied for now :)

nor2101 commented 3 years ago

I'd like to add my two cents. I have a PAL Mega Drive Model 1 VA6 with selectable dual main system oscillators and region/language switch. I play the game (v0.7.0) in NTSC mode, and while it works flawlessy most of the time, I have the same graphical glitches described here. I have not tested in PAL mode yet.

mastercheff commented 3 years ago

I got around this annoyance with pausing and unpausing the game, clears right up (0.7)

crocket commented 2 years ago

Cave Story (en) 0 7 0-211028-133259

Mainly, the level bar becomes white often after I get damaged or change weapon if weapons are at the same level.

crocket commented 2 years ago

Now, I understand why the level bar becomes white. If I switch between weapons of the same level, the game thinks I haven't switched weapons and shows animation for weapon level point change. If I change back to the previous weapon while the level bar is white, the level bar stays white for ever.

The code for level bar detects level change, but not weapon change. When I switch between weapons of the same level, the game should not show level point change animation.

mastercheff commented 2 years ago

Hi I've seen there's been some progress lately, @andwn Would You consider an insider build to fool around? ( Yes I have bought Dezatopia and Mecha Ritz on Steam to show my support :) ) . Just yesterday I recieved new and fresh 8bitdo m30 gamepad , would love to jump in right into CS cheers

andwn commented 2 years ago

I was paid a flat sum to work on those lol. Here's what's currently in my build folder though: doukutsu-20220118.zip

Expect something to be broken somewhere I haven't even played past Egg Corridor, apart from testing random places from level select.

mastercheff commented 2 years ago

Thanks a lot sir, I played this build for some time yesterday, managed to get from waterway to the final boss -normal ending. The whiteboxes bug is mostly gone , visual corruption now happens on the outside edge of dialogue box (not always) , parallax clouds in outer wall area (minor) and water effects in waterway

https://share.icloud.com/photos/0afB4Aq_nWK0eRVa7yj1uPy0w

Overall it's much improved, and a blast to play

andwn commented 2 years ago

Yeah, the water tiles were being uploaded to the wrong place after I un-split the tiles, that was my mistake not a hardware issue luckily.

mastercheff commented 2 years ago

will try to dig some more when I have the time (it's working weekend for me - little or no time for gaming)

mastercheff commented 2 years ago

Today I started fresh from the beginning, aside from egg corridor background wonkiness (photo), it's all good zero issues all through sand zone so far

https://share.icloud.com/photos/0c86LVVAJSHpVoAiuBMPTz_3g

sometimes (outro sequence with kazuma and clouds) textbox outline blends well, in other instances it's not coherent, and occasional blinking but You may be well aware of it. If You accept PP donations I'm eager to throw some $ it's my favourite mega drive homebrew

andwn commented 2 years ago

Yep, turns out I wasn't stopping the Z80 when loading the backgrounds and credits images still...

The window thing is just kind of the way it is. The window layer overlaps the layer the map gets drawn on. I was considering changing the border to be flat instead of a zigzag in order to hide it.

mastercheff commented 2 years ago

latest batch of glitchizz

https://share.icloud.com/photos/01axvFonGgmtm6fK8diXcIaQg

I made a de-facto full run of the game, off the mecha-x boss to the normal ending, then starting fresh now in outer wall. No bloodstained sanctuary yet, stupid me did get Booster v0.8 ( the pun )

andwn commented 2 years ago

Trying something with the window now. Made the border flat to hide the overlap. Most of those graphical issues with the backgrounds/tiles should also be fixed.

doukutsu-en.bin.zip

Darknior commented 2 years ago

WOAW excellent, you have fixed so many problems :) The last version 0.7.0 from 2020 is really old ... will you release a new official beta version ? Thanks a lot

mastercheff commented 2 years ago

I can feel the 1.0 is around the corner , 2.2.22 perhaps ? In other news, i swapped 8bitdo m30 dpad membrane for genuine saturn one it fits snug - less stiff, better diagonals

mastercheff commented 2 years ago

One more thing. I like the way MD/GEN renders this at 60hz 240p. In other versions (recent ps1, original freeware pc game , xbox port) running the game at 60 hz ruins fluidity, game was supposed to run 50. In THIS version it's much better or just GENESIS DOES

mastercheff commented 2 years ago

https://share.icloud.com/photos/061-1Ta66Jv0dBVAiwzcyq0zA

first one was pretty epic. i spammed pause unpause with map X button (plantation area), rendering takes a while, it started glitching for about 20 seconds with different colors and patterns than stopped on whats in the photo. all footage from 31.1 test build

andwn commented 2 years ago

Here's an attempt to fix the map thing.

doukutsu-en.bin.zip

mastercheff commented 2 years ago

map glitch is fixed, confirmed. Corruption on HP bar first slot save file persists on every bootup (even soft reset doesn't help) . Yesterday white box on Jellies/metroids happened only once - fingers crossed it's getting there

mastercheff commented 2 years ago

rn, a softlock

https://share.icloud.com/photos/091Wstld6SHvaRLxM6JGpFaWw

after beating monster X , without using Clinic Key first , can't progress right / left

edit: happens after using clinic key too

I would test it further if I was able to enter cheat codes? quick succession on the title screen? it's not my style but for science...

andwn commented 2 years ago

The barrier is still solid after going away? I changed something about the way flags work to save memory recently and that could be why. Balrog fell through the floor after I made the change and I had to fix that so I guess Monster X is the next problem.

There is a level select on the title screen, same key combo as sonic, but you're kind of stuck with whatever power ups I had during the particular playthrough I used to generate the "cheat saves".

mastercheff commented 2 years ago

yes invisible wall ... made another lap to sand zone , 0 glitches so far . and finally fired up sanctuary via cheatcode 🥇 running great

mastercheff commented 2 years ago

https://share.icloud.com/photos/0c6RQzqabmJRi8iwL4xcpYI_Q

Text window is acceptable now even with water layer. With the level select I made it through the core fight without issues, water current on the other hand... further testing in ~18 hrs

Be safe from the dreaded lurgy

andwn commented 2 years ago

Ok this should fix the Monster X barrier and save select.

doukutsu-en.bin.zip

mastercheff commented 2 years ago

barrier still persists, and some fresh buggies

https://share.icloud.com/photos/060WpXsZMQfWV2cLogoTTSG0Q

after work I will sit down with level select and the 1.02.22 build it just happens to be the most stable

:edit on consecutive bootups text got readable again, save select still glitchy

andwn commented 2 years ago

I dunno I fought Monster X a couple times and could leave the arena without any invisible barriers stopping me after making those changes. Maybe I uploaded the wrong file?

doukutsu-en.bin.zip

mastercheff commented 2 years ago

monster x barrier - fixed save file select - fixed

will report later on water current and late game bosses

mastercheff commented 2 years ago

https://www.icloud.com/photos/#080kJK5W6Ie_HmW22-Uw2fpVA

only happened early in the session -rockets and also late into it (took me over 1h to plantation ) weapons changing randomly on right/left footstep, with audio buzzing too

no incidents on bossfights , only slightly audio hanging when entering certain doors (Labirynth M, Waterway)

is it damn You Zilog ;) situation or just limited memory ?

if it's too much feedback and/or headache for You, I can slow down obviously :)

mastercheff commented 2 years ago

https://share.icloud.com/photos/05eHr8alnuxo-Uvh79azJKFlA

Fresh run from the beginning. First balrog didn't spawn or collapsed through the floor ( had my thumb on A button pressed - might have missed it) reset helped. Smooth sailing until frog boss when fireball lv.3 didnt render its trail (pic). After that it was glitch free until Waterway. I stopped in plantation, will report on luckily both endings soon

As of right now it's beat the game edition again, which is super dope imho 👍

mastercheff commented 2 years ago

barrier2

another invisible barrier is in the last cave :)

andwn commented 2 years ago

Ok this one should fix Balrog and those barriers. At least it did for me but "reset worked" has me wondering.

doukutsu-en.bin.zip

mastercheff commented 2 years ago

The only weirdness i encountered while doing ma pignon sequence. Ballos last form has some serious chug to it but it's as impressive as Alien Soldier, ****ton of sprites

void

BOTH ENDINGS WORK

re Balrog thing. I can reproduce it now constantly , if A button is pressed during dialogue with witch, mimiga and Balrog, he falls down and disappears. without skipping works as normal

andwn commented 2 years ago

And now why the hell does the room with water hang for 5-10 seconds drawing the background over and over again. What did I even do

mastercheff commented 2 years ago

Well thats a bummer... The only console i own is a model 1 VA6 pal megadrive (deliberate choice - better sound)...

thing is, all of retail games i throw at it - ntsc jap/us work without a hiccup. Some homebrew efforts like the recent Megaman sequel wars (last demo with 5 levels) give similar visual glitches to csmd (before recent changes) I hope i didn't screw Your project too much

Had to take day off with testing, will do another playthrough

edit: from start to last cave (hidden) zero glitches except two : santa's house is locked after obtaining the key (teleporting out to artur's house and back solved this) and water current animation

sgdk 1.7 whaaat

andwn commented 2 years ago

I actually figured out the water background thing last night. The code that updates the background tiles based on the water position ran before the object containing the water position existed (bad pointer) so the value was some random garbage.

mastercheff commented 2 years ago

Some time in the future I plan to mod the console with 50/60hz switch, playstation cave story (https://github.com/fgsfdsfgs/doukutsupsx) runs much much better in pal mode indeed

as for CSMD i plan to do some casual runs in the upcoming days. Yesterday's run was all cutscenes on fast forward button, the only one that glitched is the first balrog

andwn commented 2 years ago

Yeah, still not sure how fast forward is messing up those cutscenes in particular. Might have to do with Balrog falling while the text box is filling up, and instantly skipping it makes the "Balrog dropping" object change to the normal Balrog object too early. Will figure something out for those in one of my next bouts of free time.

mastercheff commented 2 years ago

I did 100% of content lately, so here goes

https://share.icloud.com/photos/05b_VDfwpF5W7_QAOQAL2dRGA

nemesis weapon has problems shooting up and down, shooting L/R is is clear of corrupted sprites (strangely, when doing sanctuary with Curly it rendered OK up if I remember correctly) otherwise, except maybe waterway it's ready for next major release imho

andwn commented 1 year ago

A junk shop in Akiba happened to have a couple VA0s in stock so I'm now a proud owner of this disasterpiece. Going to try and do most of my testing on it from now on and catch any more places where I forget to stop the Z80 before DMA causing the white boxes.