Today I finally made it so that when you defeat an enemy in my SNES game, it will prevent that enemy from spawning back in for a short time. Originally it would come back in as soon as the edge of the screen touched the column they were placed on in the level.

It was tricky to figure out exactly how I wanted to approach this in a way that was actually efficient, and I ended up doing something that's probably about as fast as it could be, at the cost of half a kilobyte of RAM (or lower since it's proportional to the max number of actors I want to allow per level, and I have that limit silly high currently)

I'm trying to get myself to favor solutions that are fast at the expense of some ROM or RAM because neither are really resources I need to conserve that much. I have about 55% of the RAM just doing nothing and I already have all the critical stuff in so it's fineee.

A feature I've been thinking about for awhile that would potentially take up a chunk of RAM is adding in some indirection when drawing level tiles/blocks, with a pointer for each one to let me redefine their appearance. Super Mario World does that, and it redefines what its 512 block IDs actually mean across tilesets.

I can think of a few situations where that would be helpful but with the overhead and the additional complexity I've just let it sit because I still haven't hit a situation where I feel like I *need* it.
#snesdev

Most of the things I can think of that would be solvable by letting a single block have multiple appearances would also be solved by having multiple different blocks with the same behavior and just putting the correct one in the level. The level format is designed to make it totally ok to have hundreds of block types after all.

The main issue comes in when I want to have something have a special interaction with a given kind of block, and multiple IDs means multiple checks, but that's a problem I can just directly tackle and solve itself.

Follow

@NovaSquirrel You could have each block have an attribute that can be checked against, depending on how you're implementing things. Or you can group things so that the check becomes a check for a range of IDs instead of a list of them, which might be simpler.
-F

@Felthry Yeah I'm using ranges for some things, like "is this a slope?" which gives me the fastest checks since the ID itself is enough.

There's also a per-block "category" or "class" field which I'm using for things like "is this water/collectible/a button?"; I guess there could be a category for variations of the same block.

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!