2:08am - Well I'm out at the McDonalds again. It seems like their prices have gone up again, and not just 'cause Summer Drink Days are over. Alas.
I asked on the Game Dev League Discord about how I should handle my in-game clock thing...
3:20am - I forgot I was writing in my journal. Heh. Anyways they said I should try Events and one linked me to the Events live lesson from the Unity Site so I gave that a watch. On the other hand I'm not sure I need this to be exactly the same time for everybody. I could probably just put a timer in the AI script that increments every frame by deltaTime and work with that.
3:32am - The more I think about this the less sense it makes. If I'm counting up a timer for the wanderTo, what do I do when it switches from Wander to a different state?
One thing I'm thinking of is using a Coroutine, but I'm not very comfortable with those. I don't know how efficient/inefficient they are.
Hmm... I could make it a general aiTimer instead of just a wanderTimer, and have the script do different AI tasks depending on the state, when the timer counts up?
3:51am - I ended up doing that last thing I mentioned and it seems to work, though wandering to random locations looks a bit janky. I could polish up the movement. Maybe later. Maybe not.
Next up I need to do the flee code. If the tag player senses an It player they should run in the opposite direction.
4:05am - So it occurs to me now that I need to get a reference to the player who is it, that my SenseTargets function only returns true or false, not a reference to the it player. What's more, the list of sensed players gets erased before we get to the spot I'm writing my reaction code! Shobby, me.
4:42am - Alright! I think I've got the flee behavior working. I wasn't adding the position of the transform to the direction away from the it player, so it wasn't working. But now the player flees properly, then starts to wander when they're far enough away.
Now I'll do something similar for the evade behavior and chase behavior.
4:50am - Alright! Now I've got two players in there, one who is it and one who is not it, and the one who is it chases the one who is not it who flees from the one who is it who is chasing the one who is not it. Perfect!
Now all I need to do is write the code to pass itdom onto the target with a collision, and the demo will be functional!
I do believe I will save that for next time, and for now I will reward myself by going home and playing video games and sleeping!
I asked on the Game Dev League Discord about how I should handle my in-game clock thing...
3:20am - I forgot I was writing in my journal. Heh. Anyways they said I should try Events and one linked me to the Events live lesson from the Unity Site so I gave that a watch. On the other hand I'm not sure I need this to be exactly the same time for everybody. I could probably just put a timer in the AI script that increments every frame by deltaTime and work with that.
3:32am - The more I think about this the less sense it makes. If I'm counting up a timer for the wanderTo, what do I do when it switches from Wander to a different state?
One thing I'm thinking of is using a Coroutine, but I'm not very comfortable with those. I don't know how efficient/inefficient they are.
Hmm... I could make it a general aiTimer instead of just a wanderTimer, and have the script do different AI tasks depending on the state, when the timer counts up?
3:51am - I ended up doing that last thing I mentioned and it seems to work, though wandering to random locations looks a bit janky. I could polish up the movement. Maybe later. Maybe not.
Next up I need to do the flee code. If the tag player senses an It player they should run in the opposite direction.
4:05am - So it occurs to me now that I need to get a reference to the player who is it, that my SenseTargets function only returns true or false, not a reference to the it player. What's more, the list of sensed players gets erased before we get to the spot I'm writing my reaction code! Shobby, me.
4:42am - Alright! I think I've got the flee behavior working. I wasn't adding the position of the transform to the direction away from the it player, so it wasn't working. But now the player flees properly, then starts to wander when they're far enough away.
Now I'll do something similar for the evade behavior and chase behavior.
4:50am - Alright! Now I've got two players in there, one who is it and one who is not it, and the one who is it chases the one who is not it who flees from the one who is it who is chasing the one who is not it. Perfect!
Now all I need to do is write the code to pass itdom onto the target with a collision, and the demo will be functional!
I do believe I will save that for next time, and for now I will reward myself by going home and playing video games and sleeping!