Moving Traps & Graphical Fixes


This build was somewhat focused on bug fixing, but also introduces a new mechanic to allow for more challenging and unique levels in future.

Spritesheet Bleed (& Automated Solution)

In previous builds, a flickering effect occurred between tiles, as the game uses a Tilemap to build levels. The flickering effect appeared as transparent lines between tiles, sometimes showing up white, and commonly occurring while the camera was moving quickly. After some research, the error was found to be something known as Spritesheet Bleed, that occurs due to floating point errors when rendering tiles, and causes a pixel from an adjacent tile being rendered in the wrong place.

A common solution to this is adding margins of the same colour around a given tile, as demonstrated below.


These extra pixels make sure that, if the bleeding happens, it will still be the correct colour.

This is fine, and easy to do if done before-hand, and the number of tiles is small, but otherwise it can be quite time consuming. However, a blog post (https://charliejwalter.net/spritesheet-bleed/) offered an automatic solution that makes use of the Image modification/comparison program ImageMagick (https://imagemagick.org/index.php). The tool is three commands that may be run in sequence in a bash terminal. However, much of the calculation needs to be done manually, and it isn't available for WIndows without the use of a virtual bash console, which I didn't feel like messing around with.

Instead, I converted the script, and added some trivial automation of the calculations to make it easier to use in the form of a shell script. The code is available in the attached files. The only change needed is to change line 14 to include the location of your ImageMagick executable.

Usage: bleed_fixer.bat [spritesheet name] [output name] [tile size] [column count] [row count] [cleanup]

The "cleanup" value, when set, removes all the extra files the program runs when generating the new spritesheet. If omitted, the script will generated 2 images for every tile in your original tilesheet (one without margins, and one with margins).


An example of the fix that bleed_fixer automates

@ECHO OFF
set input_file=%1
set output_file=%2
set tile_size=%3
set column_count=%4
set row_count=%5
set delete_sprites=%6
if "%1"=="" set input_file="spritesheet.png"
if "%2"=="" set output_file="spritesheet_margins.png"
if "%3"=="" set tile_size=16
if "%4"=="" set column_count=10
if "%5"=="" set row_count=10
doskey magick = C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\magick.exe
set /A tiles_total = column_count * row_count - 1
set /A tiles_times_three = tile_size * 3
@ECHO ON
magick convert -crop %tile_size%x%tile_size% %input_file% sprite_unmargined.png
magick convert sprite_unmargined-%%d.png[0-%tiles_total%] -set option:distort:viewport %tiles_times_three%x%tiles_times_three%-%tile_size%-%tile_size% -virtual-pixel Edge -filter point -distort SRT 0 +repage sprite_margined.png
magick montage sprite_margined-%%d.png[0-%tiles_total%] -tile %column_count%x%row_count% -geometry %tiles_times_three%x%tiles_times_three%+0+0 -background none %output_file%
@ECHO OFF
if defined delete_sprites (
    del sprite_unmargined*.png
    del sprite_margined*.png
)

Moving Traps

This build introduces a system of path following for traps. In this build, the only moving part implemented is a fireball that floats through the air and needs to be dodged. It may in future be used to create moving platforms, though it should be noted that moving platforms are less impactful in this game, as the player can fly, and as such it will likely be used primarily for moving traps, though there may be more than just fireballs in future.


Feedback

Some of the parts that can be beaten without flight feel like they take away from the magic aspect of the game

This was intended to add more depth to the game, but this was a fairly consistent piece of feedback. While they won't be removed from the game, I may make challenging flight-less sections shorter, and will keep it in mind for future levels.

Some respawn points feel like they're in the wrong place

Going forward, this is one of the things I need to refine the most; people tend to disagree about too many/too few checkpoints. Hopefully the settings feature I hope to add will include an option for checkpoint density, which will act as a difficulty setting. Further, time trials (which will not have checkpoints) will make extra challenges available to those who want it.

Get Magic Is Hard

Leave a comment

Log in with itch.io to leave a comment.