Update on Bird AI, Mammoth, and Night Bloom

Today was a very productive day. I was honestly worried I wouldn't be able to solve the memory leak when the vultures were attacking. But when I woke up I systematically went through the code and managed to get it out. It seems minecraft was getting angry when I assigned a variable in the update loop to something in the class, it didn't have this issue for the following loop for some reason, even though it was the same variables being assigned. Instead of saving entity.pos - target.pos to one variable and then calling it, I just inserted entity.pos - target.pos within the code a shit ton of times. Go figure.

Anyway, vultures are setup as follows. They have three states, Idle, Following, and Attacking. The way the state check works it it evaluates whether the state should change, if it shouldn't this portion of the code will not effect the entity at all. So if its attacking or following, it'll check if it should switch to idle if the target is null or too far away. It'll then set the target to null (to make sure its not chasing anything) and set State to Idle.

 If a player comes within a distance of 12 (along the XZ plane, y coordinates are ignored) the Vulture will move towards a point a distance of 12 blocks above its target. Once there it has a small distance its allowed to move in. I currently haven't actually got the vultures to circle yet. They kinda just cluster up and move randomly. I probably won't be able to get them to actually circle until I introduce some kind of pathfinding and a muti-point way point system.

Finally they will if the current health of the player is less than the number of nearby vultures multiplied by four. This means it takes 5 vultures to attack a player at full health.

And A video of that being demonstrated.



I also did some small work on some textures. Tried to do some work on the Palm Tree, but ultimately failed to find a suitable replacement. Did up some textures for a plant Idea I had for plains. Nightbloom. It'll have a chance every night to open, at which point it'll act like a torch.


Last but not least I managed to do up the model for the Mammoth. Still needs ears. But I should be able to do up a texture tommorow. Or maybe the day after if I want to update.


No comments:

Post a Comment