The reader is basically expected to have the same detailed knowledge about the SNES as the writer. One could write a document or two about the whole rendering system (and the other parts).byuu wrote:Which leads us to the problem with source code comments:I can never think of a comment that won't be either so terse as to be pointless, or so verbose that the comments will be 5-10x larger than the code, making the functions as a whole very difficult to read.Yeah, it could've used a comment or two - but most of the functions require "inside knowledge" like that.
It depends on how you render it. My approach was to treat each priority as an extra layer, but that's slow.spiller wrote:"Four times for each OAM priority"???! Does this mean that [my interpretation of] Anomie's explanation is wrong and there really are four sprite layers and not one like it says?![]()
ARGH!
See my explanation above - look only at the sprite with the lowest index at the current position, and then use its priority for the layering.
What byuu said: "it worked a hell of a lot better to not focus on speed at all on the initial implementation". Besides, there are not many SNES Java emulators. It would be interesting to know what speed a complete emulator could achieve.spiller wrote:I've confirmed that a per pixel top-down style render is out of the question. It wasn't even a competition. Even not properly working and not supporting modes apart from 0, or background tile priorities, or 16-pixel tiles, or more than 2 layers, or sprites, or any other logic at all, it was just appallingly slow. Given the extraordinary amount of per pixel work that was required I'm not remotely surprised. But now I have no ideas left.
What you'll probably see is that you can write many functions that do almost the same - i.e. removing branches. Maybe that could speed things up, even if it means more to write.