Oafkad Posted March 29 Posted March 29 I had been mulling all the different ways that we could validate if the actor receiving an event response is the one that should be responding. But seeing as our act calls are unique per actor I can just do a simple equivalency check. if (data != Accessor.ReturnComponent<HandlerMoosecat>()) { return; } It is literally this easy. At the start of my act function I just compare the incoming data to the same data that is on this state machine. If they match its the same object that made the call, if not it is just another live actor that matches the type. You might think "Will this scale?" and the answer is basically yes. We'll have a finite number of actors, Humans, Moosecats, perhaps eventually other magical creatures. But each time you are looking at a single new handler for probably hundreds of variants of that thing. This should mean that going forward while I do need to add additional support it ends up being a few lines of code to cover me for that entire new family of critters. I don't know why I was overthinking this. But starting tomorrow we can run the test on multiple cats. I'm very optimistic and now I've gotta go discard some changes.
Oafkad Posted March 29 Author Posted March 29 I did update it a smidge. if (data.UniqueID != Accessor.ReturnComponent<HandlerMoosecat>().UniqueID) { return; } I can only assume this will be a faster comparison than the full classes, I bet if we look it up the answer is "No those are exactly the same speed."
Recommended Posts