Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I'll have to admit - I don't really grasp what this plugin is useful for. I can imagine why one would want to track the path the player (or some NPC?) took, but what I don't get is:

  • Why would you want that path representation to be a homology? I understand representations that don't care if that the player went somewhere if they came back to a place they were before, and I understand representations that care about places the player has been even if they came back, but I can't imagine how it'd be useful to represent that the player has been somewhere and came back IFF they took a different route when coming back.
  • Wouldn't most path representation care more about areas than about points? That is - want to represent that the player has been in room A, then in room B, then in room C, and not that the player has circled point B twice and then circled point A in the other direction.

Of course, maybe I'm just biased because I didn't like Algebraic Topology when I took that class so many years ago...

In a more practical note - is a String really the best way to represent the path? Wouldn't it make more sense to provide an iterator over the points, and use a custom struct that will also tell you the orientation the entity circled around each point?

(+1)

Great questions! You're totally right that in lots of ordinary cases, this plugin provides machinery that doesn't fit, but that's not why I made the plugin. (Also, if you look at the development roadmap in the README, you'll see that I have plans to include more traditional path algorithms.) There are a few reasons I prioritized this niche case during development:

  • Checking which rooms you've been, and in which order, etc. is something that's too broad and dependent on the game, and can usually be set up easily with a sensor collider and some bitflags. I wanted my path plugin to provide something that was more unique and provided something that would otherwise be too much a pain to implement yourself during development.
  • It's fun! I'm a mathematician. I'm not really much of a game developer as it stands. I wanted to be able to record the homotopy type of a moving object. Now you can, too. If it's not useful to you, that's OK, but I think it can be!

There are also a few specific use cases I had in mind:

  • Imagine you're developing a tricky logic puzzle in a game like Baba is You, and you want to make sure that your intended solution is the only solution. You could place puncture points in such a way that the player's path (up to homotopy) will record whether they took your intended route, instead of finding an unintended route or a bug which trivialized the level.
  • Physics engine debugging. Here's an example: imagine you have a rope following the player, and that rope moves according to a physics engine, and you want to make sure it correctly wraps around some posts. To check this, you can record the path of the player and make sure that the rope's placement in the world, when treated as a path, is homotopic to the path the player takes.

However, there are use cases I can imagine outside of the context of debugging. You could utilize this plugin to introduce new mechanics into a game: 

  • One classical example that comes to mind is the Mario 1 castles in worlds 7 and 8, where you have to navigate the platforms in the correct order to progress. The checks they do for that are extremely buggy, and the notion of having taken the "right path" wouldn't even be well-defined if you were able to backtrack to the left. A puzzle like this becomes a LOT cleaner to implement with this plugin, and I plan on including that as an example in the crate in the future.
  • Let's go back to the rope example: let's say you've got a farming game, and you want the player to be able to build a rope fence. Maybe the game mechanic for doing so is to start with the rope in the player's hand, do a full loop around post A, do a full loop around post B, and then pull it taut (by, e.g., walking a little away from post B). That's a perfect micro use case for this plugin.

As for your point about the use of String: the word() method gives a representation of the loop as an element of the fundamental group π_1. The tools are already there to accomplish what you suggest, but I prioritized debugging over expanding the public API when making this.

Also, one minor point -- it's not homology, because the order of traversal does matter. H^1 is the abelianization of pi_1, so if it recorded the homology, going around A and then B would be the same as B then A.