Sorry to disappoint those of you that may have been looking forward to me making more disassemblies, but I took a several month long break from February to June. It's been a while since I felt I needed a nice long break, and with how much stuff I've been doing these past few years, this was a long time coming. XD Regardless, I did work a bit on improving the Goof Troop disassembly as well as start on another disassembly that I'm going to keep a secret for now (all I'll say is that it's for a cancelled game). I also worked on my experimental SMW Sprite Draw Engine patch, and managed to improve its performance a decent amount. I'll have more to talk about those when I finish them, however. Anyway, for this C3, I'm going to show off my hack again, as I've made some significant changes to it, mostly in the past month. Without further ado:
While working on MYSQ, I attempted to optimize the spotlight code since it was causing slowdown when the follower is told to stand still. The code for this sprite feels like one of those "we had 5 more minutes before we needed to ship the game" things with how it was coded. It uses a bunch of scratch RAM addresses unique to it, the loop that buffers the windowing HDMA data runs even when the lights are off, and the buffering loop is unoptimized in general (not helped by the check for whether the lights are on/off). It's bad enough that the SMW devs opted to only update the windowing HDMA every 4 frames just to minimize the effects of how poorly optimized it is. The SA-1 patch does allow this sprite to run at 60 FPS without slowdown issues, but since my hack doesn't use the SA-1, I needed to figure out a solution to this (not to mention the SA-1 mearly masks the poor optimization rather than address it). And my solution was, in addition to optimizing the code, to use interlacing. By alternating between updating the even/odd scanlines on a given frame, I instantly doubled performance without affecting the appearance of the spotlight all that much (the edges of the window now have these little "notches", and turning on/off the spotlight now takes an extra frame to fully turn on/off, but that's a worthwhile tradeoff to significantly reducing this sprite's overhead and to be able to have the spotlight update at 60FPS). Combine this with the code optimizations and the spotlight's performance impact is about 40% of what it originally was. Goes to show what a difference some optimization and a bit of creativity can accomplish.
Since making a patch of this was fairly easy, I figured I ought to release it. Even those of you using the SA-1 patch will still appreciate this patch, since it frees up a few BW-RAM addresses and gives the SA-1 a bit more time for other things when using the spotlight.
DPBOX asked me for my opinion on which one of his ideas he had for a beam attack would make for the best looking one. I chose to surprise him with a fully coded effect, with a couple of extra things he didn't even suggest that I felt would make the beam look better and more powerful (specifically the flashing and the screen shaking), which he was quite impressed by. ^_^ I already figured out windowing from having to mess with the spotlight sprite, so this took me less than an hour to pull off.
To be fair, I really should play your hack at some point. I had some issues where I couldn't run the hack last time I tried it, though but maybe it works now, I don't know.
Originally posted by yoshifanatic
I certainly was wondering, how much of the code was really unoptimised (this does look like to be something which can be made be a line with fixed point numbers, after all), though interlacing is also interesting (even though you're essentially doing it like SMW except update and write only half the frames).
Originally posted by yoshifanatic
Interesting.
Woah, I’m happy to see the hack release, and the ASM looks top-notchEvery dream is but another reality, never forget…
My In-Progress Hack
Really interesting to read about the technical aspects of MYSQ. Hopefully people will be able to appreciate that aspect along with the hack itself! Always nice to see one of your threads at C3, even if we're not getting a bunch of disassemblies this time around (and that break is well deserved, anyways).
Man, the technical aspects of MYSQ are insane. You got like 300 exits and samples taking up 1 meg. The spotlight optimization patch and beam attack are also very cool! People could especially benefit from the former, though I think it would be completely useless in SA-1 since the spotlight is already smooth (and optimized perhaps?)My Mode 0 guide.
My Discord server. It has a lot of archived ASM stuff, so check that out!
Originally posted by ninj
That beam attack looks fucking sick, I love it
Originally posted by solgaleo35
Woah, I’m happy to see the hack release, and the ASM looks top-notch
I'm glad you like it! ^_^
Originally posted by MarioFanGamer
To be fair, I really should play your hack at some point. I had some issues where I couldn't run the hack last time I tried it, though but maybe it works now, I don't know.
I can't say with certainty that I fixed whatever problem prevented it from working when you last tried to play it. However, I assume it must be some weird emulation issue, since I know my hack runs on actual hardware.
Originally posted by MarioFanGamer
I certainly was wondering, how much of the code was really unoptimised (this does look like to be something which can be made be a line with fixed point numbers, after all), though interlacing is also interesting (even though you're essentially doing it like SMW except update and write only half the frames).
While it is fundamentally being handled in a similar way to the original, the nice thing about my patch is that all the optimized code fits in the original location of this sprite's code. If I used a lookup table, that may potentially have required freespace.
Also, part of the slowness was due to the loop being unoptimized:
- Those scratch RAM addresses unique to this sprite use the global direct page RAM addresses rather than the slower absolute address ones unique to this sprite.
- I removed a couple of redundant checks since SBC functions almost the same as CMP, and the code needed to do SBC on A anyway.
- I unrolled the loop a bit for buffering the empty scanlines so that part is done quicker.
- I removed the check for whether the lights are off from within the loop and instead used a separate, faster loop for when the lights are off.
- I changed how the scanline positions are calculated so that instead of INC followed by a check for whether it should DEC twice, I simply used a direct page address that is used to add or subtract to the position based on a calculation made outside of the loop.
The lion's share of improvement still comes from the interlacing, but I'd argue that's what the devs should have done originally if they had been given the time to do it. Programming requires compromises in order to make whatever you're doing work with the target hardware. Sometimes simple optimizations aren't enough and you have to get a bit creative to improve performance. With my solution to improving performance, the tradeoff of using this patch is very minor (ie. Some barely visible notches on the spotlight's edges and an extra frame to turn on/off), which I think is a fair trade for more than double the original performance.
Originally posted by DeppySlide
Really interesting to read about the technical aspects of MYSQ. Hopefully people will be able to appreciate that aspect along with the hack itself! Always nice to see one of your threads at C3, even if we're not getting a bunch of disassemblies this time around (and that break is well deserved, anyways).
I'm quite happy with how MYSQ is coming along, both on the technical and gameplay fronts. And there is still plenty more I have left to do. For example, I plan on implementing an intro cutscene for if you wait on the MYSQ title screen, more custom made bosses (Wendy, Morton, Roy, MSQ Bowser are the main ones I need to do, but the Deadly Drinks. Inc reznors and various YSQ bosses could also use an update), a bonus world for getting all Yoshi coins in both games, revamping various MSQ levels, and any other random things I can think of.
Also, maybe I'll have a disassembly to show off for next C3? I do have a couple ideas on what the next few will be besides the one I worked on secretly.
Originally posted by Anas
Man, the technical aspects of MYSQ are insane. You got like 300 exits and samples taking up 1 meg. The spotlight optimization patch and beam attack are also very cool! People could especially benefit from the former, though I think it would be completely useless in SA-1 since the spotlight is already smooth (and optimized perhaps?)
Small correction, but MYSQ has 180 exits, not 300. Other than that, I'm glad to hear you like it! ^_^
Super cool that now the spot light is running on better code now and that you were able to optimize it. It looks so much smoother now.
Once again I find myself deeply impressed by your stuff. You not only have the technical know-how to make cool stuff happen, but also great ideas that make use of them. That Wario + Lemmy boss battle was somehow some of the hypest things I've ever seen in SMW.Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
As a quick update, I've been hard at work making improvements to MYSQ in my dev build. I could take a break, but I'm still motivated to keep going. So, in addition to a few minor bug fixes, I've implemented parallax scrolling HDMA that accounts for vertical scroll on a few backgrounds:
Also, I've added reset doors to all the 'Key X' levels and Ruined Castle (they function like the ones in Key Plains, where they are just an outline and can't be entered until you reach the key/Spunky).
Originally posted by Final Theory
Super cool that now the spot light is running on better code now and that you were able to optimize it. It looks so much smoother now.
I'm glad you like it! ^_^
I'm a bit surprised that nobody else had made a patch like this before. Perhaps the SA-1 patch being able to process the spotlight very quickly even at 60 FPS meant there wasn't much need to optimize it? But, I suppose that's one perk of me not using the SA-1 patch for my hack. I have to get creative to do things that seem impractical without the SA-1.
Also, I don't know if you checked out the MYSQ changelog, but I implemented my own water droplet sprite. It's a custom coded one that's handled much differently from the one in the sprite section that I helped explain to you how it worked. Mine is an extended sprite that searches for a nearby valid ceiling tile to drop from when spawned in through LevelASM.
Originally posted by RPG Hacker
Once again I find myself deeply impressed by your stuff. You not only have the technical know-how to make cool stuff happen, but also great ideas that make use of them. That Wario + Lemmy boss battle was somehow some of the hypest things I've ever seen in SMW.
I'm glad to hear that! ^_^
I'm surprised by how I'm still able to find new things to improve with MYSQ. Most of the MYSQ changelog is stuff I did in only the past month (the only exceptions being the separation mechanics and the echo sound stuff). A decent chunk of things, like the random water droplet effect, were things that I implemented on a whim as soon as I got the idea and I felt it would make my hack better or more polished by implementing it. I imagine that long break I took helped a lot, too, since the biggest obstacle I face with my projects is motivation. XD
Also, regarding the Lemmy Boss, the premise was an idea that my cousin gave me when he and his family visited me a year ago (he also gave me the idea that eventually became my Larry boss). It was a bit tough to decide exactly how I was going to handle a chase sequence boss fight. But, what I ended up doing worked out pretty well. I think the thing I like the most about this setup is the fact that, despite the fact that Lemmy is focusing most of his attacks on Wario, Wario is completely unfazed by every single one (meanwhile, Mario/Luigi/Yoshi are the ones getting caught up in these attacks). I can't think of many other boss fights off the top of my head where the boss isn't even focusing most of their attacks on you, but you still get caught up in them anyway. XDMy Hacks: Mario's Strange Quest V1.6 Yoshi's Strange Quest V1.3 / V1.3.1 Beta 4.6 Mario & Yoshi's Strange Quests (2/10/2023 Build)
Click the character on the right side of my layout to visit my Discord server and discuss and play and look at and get updates and sneak peeks of the games and other things I'm making.