Aug 8, 2024

Wasted Two Nights on Non-Existent Problems

Working out some kinks in my level editor, I finally got around to incorporating vertical stages. Vertical screens are 240 pixels high, whereas horizontal screens are 192 pixels high. My level editor uses the horizontal screen dimensions as a baseline, which scaled up nicely on my monitor. A tile assembly is 32x32 pixels in size and each screen contains an 8x6 array of tile assemblies. Since vertical screens are 240 pixels high, every eighth row of tile assemblies gets cut in half and the next row gets moved up. 

I wasted two evenings wracking my brain over the math needed to display a vertical level inside my level editor with that cutoff. The conundrum, I thought, was my code reading the tile data needed to get shifted up two rows of tiles further for each 256 pixels mapped. I eventually got that figured out. However, this method caused a couple new issues to appear. My editor has 32x32 pixel lattice across the canvas, which looked nice on horizontal levels, but these recent changes made it look weird on vertical levels. On top of that, I now had to deal with the matter of placing tile assemblies into the level, properly aligned with the now unsightly lattice. 

I was just about to throw my hands up in frustration and rewrite the editor to pre-map all the tiles to a big buffer, then copy that buffer to the sprites in a simple left-to-right order (that would have been another headache in itself). Then I had a sudden epiphany: I could save the realignment for the "preview" feature I included. This would leave the canvas resembling the one in the CV3 editor ReVamp, but I was okay with that. I realized I inadvertently wrote the "preview" function to use 256 pixels as the height of a vertical screen. As soon as I changed it to 240 pixels, everything fell into place on the preview screen. All that hard work for nothing! Oh well.

Now, how I'll actually get this properly slotted into my game, I haven't completely figured out yet. This is definitely one of the downsides to using tile assemblies instead of a straightforward tilemap. But hey, that's part of the fun I subjected myself to. 


On a personal note, my wife and I have two new boy kittens! They make it frustratingly difficult to focus on my program, on top of my wife's incessant pleas for attention and everyday adulting. 



1 comment:

  1. Hola felicitaciones por tu trabajo! me entusiasma mucho lo que estas haciendo,llevo mucho tiempo utilizando revamp y la idea de un nuevo editor de niveles para castlevania 3 me interesa mucho,intente con Cadeditor..pero no logra cubrir el tema de las puertas,una pregunta tu editor puede colocar varios caminos conectando varias areas entre si?

    ReplyDelete

©TheouAegis Productions™. Powered by Blogger.