Who even lives here?
So here's my idea on how to identify who owns which house in Project Special K.
In Animal Crossing, the field map can have up to (*checks notes*) 46 structures. This includes houses for up to eight players and ten villagers, things like the airport, tailor shop, and residential services, conveyances like bridges and inclines, and dynamic things like Redd's trawler. If a given item in that list of 46 is zero, there's no building.
It should be noted that there are eighteen distinct building IDs for players and villagers. So for example Audie is villager #5 on my island, so her house is listed as building type 13 (the villager houses start at 9). What her house looks like is determined elsewhere.
But that's all exteriors.
For Project Special K, I have this hitherto unused piece of structure and code to handle house interiors, but the important connection here is how to determine whose house it is. There's no practical reason to have only up to ten villagers when there's the possibility of having a playable area up to let's say 32×32 acres, after all.
So with an arbitrary amount of potential villagers, you can't really have a fixed amount of building IDs to determine the resident from. You can't just say "this is building ID 13 so I'll just subtract 9 to get a villager index". Not when building 19 is Nook's Cranny.
Hell, the amount of non-residential buildings can vary! We have mod support after all.
So my thought was to have the house specify the hash of the villager or player who lives there. Both the exterior field object, so it knows which models to use, and the interior abstract bundle of rooms. When they match, they can easily figure out where to put the player when going in or out of a house.
But what about the player's house?
Initially, I had a special hash value (-2) to indicate that a house belongs to the player, but I'd like to think ahead for multiplayer support a little bit at least. So instead, I added a flag "is a player's house", and intend to use a proper hash for the owner.
Problem is, even though a given villager has a perfectly good hash (based on their ID, so Audie is "acnh:wol12", or hash 0x07689165), the player has none. They have a name, but there's no guarantee it's unique. Can't use their looks, since things like skin and hair color, facial and hair styles and such can be changed on a whim.
I'm open for ideas. Anything that generates a 32-bit value with low risk of repeats is good. Something that can be run just once when starting a new game, but shouldn't be the same if you start over and enter the same things in character creation...








