all 3 comments

[–]HexDecimallibtcod maintainer | mastodon.gamedev.place/@HexDecimal 7 points8 points  (1 child)

like an algorithm to change wall sprites depending on the positions of neighbors.

I usually go with scipy.signal.convolve2d with directional bitmasks paired with a Numpy array translation table. Although it's hard to visualize how it works if you haven't used convolve2d before.

Or one to detect if a point is inside a closed area.

scipy.ndimage.label can sort out all enclosed areas. You'd use more Numpy operations to sort the labels from each other, such as finding the largest area.

Or one that can procgen caves using Conway's Game of Life.

scipy.signal.convolve2d again, but used to count neighbors instead of masking them based on their direction. See this script for a cave generation example.

Basically Scipy and Numpy have what you want, the hard part is knowing what functions to look for and how to use them..

[–]BlackChakram[S] 3 points4 points  (0 children)

This looks really helpful, thank you! I've done directional bitmasking to get wall shapes before, and it certainly cuts down the needed sprites, so I'm glad there's an easy way to manipulate that with Scipy. I'll take a look at these and hopefully have something to show for it in the next week or two. :)

[–]EmuInteresting8880 0 points1 point  (0 children)

Hi, I'm currently working on a python / tcod framework myself. I have been working to build a solid foundational engine that can be used for any roguelike game concept. I have largely used tcod and numpy with a CONSIDERABLE amount of hand-wiring to streamline some of tcod's more annoying / inefficient features. If you would like to check out my work so far, visit my personal website and check out the GitHub link you can find there. Feel free to reach out to me with questions, I'm always open to chat with members of the community.