Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Komodoman,

    Thanks for writing back so quickly!
    Well, I've tried a few parameters for Z. I've used the fish manager as well as just setting it on the fish mesh itself, but it's always the same result. I've even tried setting the min to 1 and the max to 5.

    I've also lowered the obstacleDist variable and the result is the same.
    Last edited by dougb; 03-08-2015, 11:17 AM.

    Comment


      #17
      Originally posted by dougb View Post
      Komodoman,

      Thanks for writing back so quickly!
      Well, I've tried a few parameters for Z. I've used the fish manager as well as just setting it on the fish mesh itself, but it's always the same result. I've even tried setting the min to 1 and the max to 5.

      I've also lowered the obstacleDist variable and the result is the same.
      Interesting, I will go up to the lab sometime this week (Spring Break) and test out the fish on a fresh project to see if I run into something similar. If you have any video or images of the issue that would help too!

      Also: What do you have set for the fish's 'turnFrequency'?

      Comment


        #18
        Yeah, pretty strange. I was hoping you'd be able to drop it in an empty project to test so thanks!

        I left the turnFreq at 1, but I did test it with others and didn't make a difference.

        Screenshot is attached but you can't really get an idea for what's going on. You'll see the Mako (haven't fixed it's rotation but no big-deal), and it just flies straight-up.

        Click image for larger version

Name:	Untitled 3.png
Views:	1
Size:	946.8 KB
ID:	1067959
        Attached Files

        Comment


          #19
          What's the license on the art assets? CC0? Or something more restrictive?

          Comment


            #20
            Originally posted by b1016103 View Post
            What's the license on the art assets? CC0? Or something more restrictive?
            Found somebody who said this in the forums, I believe this covers this project as well:
            This is released under the CC0 1.0 Universal license meaning you can use it however you want with no attribution. Although if you're using them in some kind of finished project it would be cool to let me know where!
            Last edited by Komodoman; 03-08-2015, 07:22 PM.

            Comment


              #21
              Originally posted by dougb View Post
              Yeah, pretty strange. I was hoping you'd be able to drop it in an empty project to test so thanks!

              I left the turnFreq at 1, but I did test it with others and didn't make a difference.

              Screenshot is attached but you can't really get an idea for what's going on. You'll see the Mako (haven't fixed it's rotation but no big-deal), and it just flies straight-up.
              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 this issue was due to turnFrequency, but it is not the case, since you had your value set low. My best guess at this time is he is fleeing from something (maybe your player haha... (default behavior is to flee from player at the moment XD))

              Cheers,
              Komo
              Last edited by Komodoman; 03-08-2015, 03:16 PM.

              Comment


                #22
                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.

                Doug

                Comment


                  #23
                  Originally posted by dougb View Post
                  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.

                  Doug
                  Hey Doug,

                  I created a default scene and added fish and was getting the issue 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 this is not even an issue.

                  Also, add this line to this function in FlockFish.cpp:

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

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

                  return nearAObstacle;
                  }

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

                  Click image for larger version

Name:	Flocking.png
Views:	1
Size:	708.8 KB
ID:	1067974


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

                  Click image for larger version

Name:	paypal donate.png
Views:	2
Size:	15.6 KB
ID:	1067975

                  Thanks in advance for any donations!

                  Cheers,
                  Komo
                  Last edited by Komodoman; 03-09-2015, 01:55 PM.

                  Comment


                    #24
                    As per request, here is the link to a (4.6) project with mackerel schooling:
                    https://drive.google.com/file/d/0B2U...ew?usp=sharing

                    Comment


                      #25
                      Originally posted by Komodoman View Post
                      As per request, here is the link to a (4.6) project with mackerel schooling:
                      https://drive.google.com/file/d/0B2U...ew?usp=sharing
                      Thanks Komodoman for taking the time to do that, donation sent..

                      Comment


                        #26
                        Originally posted by Triplelexx View Post
                        Wow this is incredibly generous and cool!

                        I'm very interested in this sort of AI behaviour, and love fishies!
                        If you put the code on Github it would be easier to contribute to.
                        @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.

                        Pce~
                        Komo
                        Last edited by Komodoman; 03-10-2015, 11:17 PM.

                        Comment


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

                          BTW, will you be able to post your underwater pp and FX details?
                          Doug
                          Last edited by dougb; 03-11-2015, 12:21 PM.

                          Comment


                            #28
                            Originally posted by dougb View Post
                            Awesome Komo. Just did the donation so hopefully others will contribute as well and keep this going!

                            BTW, will you be able to post your underwater pp and FX details?
                            Doug
                            @dougb & @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 this 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!
                            Last edited by Komodoman; 03-11-2015, 10:28 PM.

                            Comment


                              #29
                              Hey man, finally got a chance to take a look through it all this 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 this!

                              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.
                              Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                              Comment


                                #30
                                Originally posted by DotCam View Post
                                Hey man, finally got a chance to take a look through it all this 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 this!

                                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!

                                Komodo

                                Comment

                                Working...
                                X