shundread

LD 42

Macabre Hollow - a bug-free* dungeon crawling game

Fight enemies, raise attributes, collect items. Unless I'm too distracted this shouldn't be too hard to make within the time limit and should still allow me enough time to have fun with it.

Macabre Hollow - Heading to DNF?

So I had a writer's block and made a (lousy) menu. :þ

Will still try to squeeze in some basic gameplay in the next 2 hours, and if successful will sloppily attach the game to my server and up the repo on bitbucket in the remaining time.

Small, non-functional fix for silly development environment bug

As I'm relatively happy with the result of my work in this LD, I'm in the process of remaking the game in a far more structured manner, hoping to give it better graphics, and gameplay, as well as adding music, sound and many more levels to make use of the happy accidents of the game design.

While setting up the new project, I noticed that there is no reason whatsoever to pull in all those babel packages into the dev dependencies, as I never use anything other than typescript in my project. So for the sake of anyone hoping to look into the source of the entry I've pushed a new branch fix/dependencies where the project setup is fixed, and also includes the mobile scaling fix.

fixes.png

Those will be merged back into the main branch once LD42 ends.

Static-check for resources

So the other day I wasted some time looking for bugs on my code because I was looking at the wrong place. Namely, I was trying to get a simple logo display for the remake of Macabre Hollow and was just getting a blank screen instead.

The reasons for my predicament were (from most immediate to least immediate reason):

  • Banner sprite was being created with an undefined texture
  • I was attempting to access my banner logo with the wrong path
  • My text editor didn't see a problem with it, because the underlying data structure declared an index for name -> PIXI.Texture
  • My compiler accepted it because nobody really had any reason to see a problem with it
  • PIXI.js lets you create Sprites with undefined textures, they're just invisible, sizeless objects

So, my code was set to catch me using defined types other than PIXI.Texture, but it was also set up to tell the editor not to look too hard into it.

Today I spent a bit of time ensuring no further time is spent typo-ing names of textures:

spritesheets.png

Now I get on my editor:

  • Linter warnings for trying to access spritesheetName.bogusName
  • Helpful suggestions for image names to use when typing spritesheetName.

As useful as I think the tool is, the source for the tool itself is rather trash, so I'm not releasing it as its own tool in the current form. So I'll just share the relevant section of make-graphics.sh here (Linux shell script):

```shell

Spritesheet constant type annotation and declaration

generateSpritesheetConstant() { spritesheet=${1} printf "Generating typescript spritesheet definition for ${spritesheet}..."

files=$(cd graphics/"${spritesheet}" && ls ./*.png)

outputFile="work/${folder}.ts" { echo "" echo "export const ${spritesheet}: {" } >> "${outputFile}"

# Field types for file in ${files} do trimmed=$(echo "${file}" | sed "s/.png//" | sed "s!./!!") echo " ${trimmed}: undefined | PIXI.Texture;" >> "${outputFile}" done

echo "} = {" >> "${outputFile}"

# Field values for file in ${files} do trimmed=$(echo "${file}" | sed "s/.png//" | sed "s!./!!") echo " ${trimmed}: undefined," >> "${outputFile}" done

echo "};" >> "${outputFile}" echo "Done" }

for folder in ${folders} do generateSpritesheetConstant "${folder}" done

Combining spritesheets onto a single file

spritesheetFile="./src/spritesheet.ts" rm -f --verbose "${spritesheetFile}"

{ echo "// Auto-generated file, do not edit directly but run make-graphics.sh instead" echo "" echo "// External libraries" echo 'import * as PIXI from "pixi.js";' cat work/* } >> "${spritesheetFile}" echo "Generated ${spritesheetFile}"

```

This is what heaven looks like:

happiness.png