[Community WIP] Fish Schooling AI and Assets Package (Open Source)

That is odd behavior. Once I have time to access the Lab Computers with UE4, it should be an easy fix (maybe tonight, no promises ;)). Nice Caustics BTW!

Oh and a good piece of information about turnFrequency: it is the number of seconds before the leader generates a new seek target vector coordinate. In human, that means they will wait however long turnFrequency is set to before turning (looping). The lower turnFrequency is set to, the more they turn (It does seem a little backwards).

I thought maybe was due to turnFrequency, but it is not the case, since you had your value set low. My best guess at time is he is fleeing from something (maybe your player haha… (default behavior is to flee from player at the moment XD))

Cheers,

Ahhh…so that’s what turnFrequency does. I thought it was for a rotation. Makes sense now.

Thanks for the comment on the caustics. The unfortunate part is that it could look soooo much better with the UE4 engine, but I’m targeting VR so you really need to watch post-process there.

BTW, you take any other donation methods besides BC? Would like to help support you guys with something to keep things going.

Hey ,

I created a default scene and added fish and was getting the you were talking about. I played around a bit with the bounds of the volume and debugged the c++ file. It turns out what your fish are doing is either they are already outside of the bounds of the volume on play (and unable to get back in) or, as in my case, they were fleeing beyond the bounds of the volume from the player and continuing on. I enlarged the volume size and all is well. Try making yours really big. The next thing I’ll be working on is a ray casting system for determining if they will hit the surface of the volume, so that is not even an.

Also, add line to function in FlockFish.cpp:

bool AFlockFish::isNearObstacle(float delta)
{
**return false; <- ADD **
FVector location = ->GetActorLocation();
FVector maxBound = FVector(0, 0, 0);
bool nearAObstacle = false;

if (location.Z + obstacleDist &gt;= maxZ){
	maxBound = FVector(curVelocity.X, curVelocity.Y, curVelocity.Z - (obstacleDist * 2));
	FRotator avoidRotation = FRotationMatrix::MakeFromX(-&gt;GetActorLocation() - maxBound).Rotator();
	curRotation = FMath::RInterpTo(-&gt;GetActorRotation(), avoidRotation, delta, turnSpeed);
	nearAObstacle = true;
}
else if (location.Z - obstacleDist &lt;= minZ)
{
	maxBound = FVector(curVelocity.X, curVelocity.Y, curVelocity.Z + (obstacleDist * 2));
	FRotator avoidRotation = FRotationMatrix::MakeFromX(maxBound - -&gt;GetActorLocation()).Rotator();
	curRotation = FMath::RInterpTo(-&gt;GetActorRotation(), avoidRotation, delta, turnSpeed);
	nearAObstacle = true;
}

return nearAObstacle;

}

will remove their avoidance of surface and sea floor, which is good, because it is currently buggy X.X

Also added a paypal option for donations, at the top of the page and here:

]()

Thanks in advance for any donations!

Cheers,

As per request, here is the link to a (4.6) project with mackerel schooling:

Thanks for taking the time to do that, donation sent…

@Triplelexx, I just uploaded the code I’ve been working on to GitHub, feel free to fork and make some cool stuff!

@Everybody, I just rewrote the fish into a state machine in C++, it is a LOT cleaner now! I also completed enemy detection optimization. All the updates can be seen on the Trello Board, and can be accessed currently through GitHub. The next three things I plan on doing are releasing package v0.2, uploading a detailed instructional video to youtube, and fixing fish going outside of bounds through Raycasting.

~

Awesome . Just did the donation so hopefully others will contribute as well and keep going!

BTW, will you be able to post your underwater pp and FX details?

@ & @kkhail, Both my artist and I are extremely grateful for the donations! The more we get the more art assets we’ll be able to include and the more time I can commit to making package awesome, so thank you both. As for the underwater FX, I’ll talk to my friend and let you know, if he says we can use it, then I’ll be sure to include them in V0.2 of the package. Thanks again!

Hey man, finally got a to take a look through it all morning, it looks great!! I will be adding the code over the coming days now that the plugin is working, thanks again for all of ! :smiley:

p.s. The GitHub build is now up for 4.7.2! Are you guys still using 4.6? If so I can upload that version as well, let me know.

Yep we’re still using 4.6 for our project, can’t wait to check out the new build!

Ok no problem, I’m sure there are many others as well so it is in the works.

I created a GiitHub organization for the project, if you want to be a part of it just PM me your info, but I understand if you can’t you are probably pretty busy right now! :wink:

Cheeers man, I will have 4.6 up by tomorrow.

Hey everybody,

I just added some more optimization to the fishes in addition to making the variables a lot more clear and splitting them into sections. Still working on packaging a V0.2, but if you want the latest get the code from GitHub.

Also: Would any of you be interested in seeing me add a harpoon gun with realistic rope physics? My friend has been working on realistic ropes here, and the code involved wouldn’t be too hard to have fish be killed and reeled in by a harpoon gun. I, of course, would need to convince my friend first ;).

~

is so awesome, thank you so much!

wow that would be great

Been working on obstacle avoidance tonight. I made some good progress, but wasn’t able to get it where I want. Once that is done I’ll feel confident in posting a new video where I create a quick aquarium scene in UE4.

Hakuna Mattata,

Hey guys,

I made part 1 of a 2 part video tutorial for implementing my fish into your own game. I also released v0.15 of the fish package above.

Cheers,

Here’s a video of my updated fish:

Hakuna Matata,

Just got word from my friend that I can include his rope physics and caustics in package. So a big thanks to Regalith. I’ll add his stuff when I have time. Cheers!

Awesome stuff , and thanks Regalith for the rope physics and caustics…

Can anyone explain how I can add an animation to when the shark attacks to open his mouth? or turn left and right animations?

Hey guys,

Just got caustics available through the Ocean Demo github. Checkout the branch for both caustics and working fish!