-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module 2 Assignment Work Documentation #40
Comments
IntroductionJaakko Sukuvaara - I've worked as a software developer with medical software in C# for 2.5 years. Before that I studied in vocational school to become a software developer. I've done video games as a hobby since 2015 and have done game jams in FGJ. Completed tasksFishClass diagramclassDiagram
%% Prefabs
BoidFish ..|> Fish1
Fish ..|> Fish2
Fish ..|> Fish3
Fish ..|> Fish4
HunterFish ..|> Shark
<<Prefab>> Fish1
<<Prefab>> Fish2
<<Prefab>> Fish3
<<Prefab>> Fish4
<<Prefab>> Shark
%% Classes
FishController <.. Fish
Fish --|> DetectingFish
DetectingFish --|> BoidFish
DetectingFish --|> HunterFish
<<abstract>> DetectingFish
class FishController {
+Vector3 fishBoundingBoxOffset
+Vector3 fishBoundingBoxSize
-List~GameObject~ fishList
+KillFish(GameObject Fish) void
+IsFish(GameObject) bool
+MovePointInsideBounds(Vector3 point, float moveAmount) Vector3
}
class Fish {
-FishController controller
+FishController Controller
#float speed
#Move() void ~~virtual~~
#CreateNewTarget() Vector3 ~~virtual~~
+Kill() void
}
class DetectingFish {
#List~Collider~ closeColliders
#FilterCollider(Collider) bool ~~abstract~~
}
class BoidFish {
-float randomDirectionWeight
+GetDirection() Vector3
#CreateNewTarget() Vector3 ~~override~~
#FilterCollider(Collider) Vector3 ~~override~~
}
class HunterFish {
-float huntingSpeed
-bool hunting
#Move() void ~~override~~
#FilterCollider(Collider) bool ~~override~~
}
FishControllerThe fish controller keeps track of the fish in the game and defines the bounds where the fish can move. In the image below the bounds can be seen with the green outline. /// <summary>
/// If the given point is outside of the bounds. Move it inside the bounds
/// </summary>
/// <param name="point">The point to move</param>
/// <param name="moveAmount">Amount that is possible to move the point by</param>
/// <returns>Point inside bounds</returns>
public Vector3 MovePointInsideBounds(Vector3 point, float moveAmount)
{
if (point.x < fishBoundingBoxOffset.x - fishBoundingBoxSize.x / 2 ||
point.x > fishBoundingBoxOffset.x + fishBoundingBoxSize.x / 2)
{
point.x += point.x < fishBoundingBoxOffset.x ? moveAmount : -moveAmount;
}
if (point.z < fishBoundingBoxOffset.z - fishBoundingBoxSize.z / 2 ||
point.z > fishBoundingBoxOffset.z + fishBoundingBoxSize.z / 2)
{
point.z += point.z < fishBoundingBoxOffset.z ? moveAmount : -moveAmount;
}
if (point.y < fishBoundingBoxOffset.y - fishBoundingBoxSize.y / 2 ||
point.y > fishBoundingBoxOffset.y + fishBoundingBoxSize.y / 2)
{
point.y += point.y < fishBoundingBoxOffset.y ? moveAmount : -moveAmount;
}
return point;
} Normal Fish
Fish movementvar newDir = Vector3.RotateTowards(transform.forward, target - pos, turningSpeed * Time.deltaTime, turningSpeedChange);
transform.position += newDir * (speed * Time.deltaTime);
transform.rotation = Quaternion.LookRotation(newDir, Vector3.up); New vector 3 newDir is created with Vector3.RotateTowards method. That method gets two vectors: current forward direction and target direction. Then it turns it by a given amount. In this case turningSpeed * Time.deltaTime. Creating new targetvar point = transform.position + UnityEngine.Random.rotation * Vector3.forward * UnityEngine.Random.Range(minTargetPointDistance, maxTargetPointDistance);
return controller.MovePointInsideBounds(point, maxTargetPointDistance); To create a new target Unity engine Random.rotation is used and converted from quaternion to Vector 3. Then, because it is a unit vector, it is multiplied with a random value between given max and min distances. Then the point is moved back inside the bounds of the controller if it is outside of them. DetectingFishThe DetectingFish creates a collider of given size on start to sense close colliders. It adds new colliders to its internal list if the FilterCollider method returns true when the collider is given to it. if (other != null && FilterCollider(other))
{
closeColliders.Add(other);
} Then the collider is remove from the list when it leaves the trigger collider. Boid FishFor the boid fish the goal was to create flocking behavior with the Boids rules. Due to implementation of fish movement I implemented only one of the three main rules: alignment. avarageDirection = avarageDirection.normalized;
var point= transform.position + ((Random.rotation * Vector3.forward * randomDirectionWeight) + avarageDirection) * Random.Range(minTargetPointDistance, maxTargetPointDistance); Hunter Fish
var closestPrey = closeColliders.Where(o => o != null).Select(o => o).OrderBy(o => (pos - o.transform.position).magnitude).First();
var closestPreyPos = closestPrey.transform.position; World GenerationThe world map is implemented with random world generation that uses environment prefabs that are then spawned into the scene when the scene starts from a weighted list. for (int i = 0; i < numberOfPlaces; i++)
{
Instantiate(RandomUtil.GetRandomElemntFromWeightedList(envPrefabs.Select(p => new System.Tuple<GameObject, float>(p.prefab, p.weight * 0.1f)).ToList()),
transform.position - new Vector3(spacing * numberOfPlaces / 2 - spacing / 2, offsetY, 0) + new Vector3(i * spacing, 0, 0),
Quaternion.identity,
envTransform);
} In-progress tasksMy next tasks would be to fix the shark code as they start throwing errors and get stuck and clean up its code on the way. Then make the fish avoid colliding with the environment. And last on the list for now is to make the fish catch on the hook, when the hook is ready for it. When these are done I'll see what else needs doing or if others need help |
IntroductionLeevi Kankainen I also have some skill in blender, but most of the information / knowlegde of blender i have forgotten because i haven't used blender for some time, but some basic i still have the knowlegde My skill level is somewhere in intermidiate level. What have i done this far for the game has been, For model's that we use to add bone's so we could animate the fishes and done the animation for the swim in unity animation and i have done the fish spawn for the game that the fishes spawn outside of the camera Task that i have doneHere is kinda more in dept what have i done if i have not documented in issues that what have i done. Fish Bone'sBecause i have putten some images for the issue i will link the issue here and there you can see all the fishes and how the bones are on the fishes Adding bone's to the fishes · Issue #18 · Fisherman-s-Friends/Fisherman-s-Friends (github.com) But For some documentation information i did not write at that time, But here is some information about this The fish asset that we used didn't come with bone's / weight map, so somebody needed to add bone's to the fishes, so we could animate them better with the unity's own animation file / animator. So i added them to the fishes AnimationAlso here is kinda same that i putted images/gif to the issues i will link the issue where you can see the images/gif in action. Animate fish moving · Issue #15 · Fisherman-s-Friends/Fisherman-s-Friends (github.com) But i didn't document some information what else i did for the animation, so i will put the information here. The fish has 2 difrent animation for slow and fast swimming. I also edited the curve of the animation so the animation look's more smooth because it's looping so it''s not spiky and here is the image of the curve of one of the fishes, because allmost everyone have same kinda curve. Fish spawningHow i spawn the fish is called in update but it's timed how long it need's to wait for spawning and it also checks if there is max amount fishes it will not spawn anymore The SpawnFish method has a instantiate that is stored to var and added to list and i also do vector were the fish spawn's outside of the bounding box / camera so they come from the outside, there is also a calculation methed that returns the x cordinate for the fish were it spawn I also use struct were is the GameObject and the weight of the fish, of what is the wight of it spawning when spawn is called. Fish script editorHere is what is look's like the both tab's I also made a fish script editor for unity show in the inspector the fishcontroller show difrently and it's not long and it has the correct tabs for the fish controls (it's very basic that i did know how to do) There i use #region and #endregion to short them because you don't need to see them allways. Firstly because the variable's are serializedproperties and private i need to do in the beginning the serializedproperty namin of the variables then there is also were i put the data to the fields on the OnEnable method / function were i use the FinProperty were unity finds the serialized propertys type and data and put that tp the variable's Then i override the OnInspectorGUI method were i update the inspectors to add the propertyfield with the variable so it show in the inspector and i also make the toolbar tabs for the int variable because i need to know the value of the tab what user clicks And because they are serializedObject / fields i need to ApplyModification also show the value updates to the variable so it's not astetic To-do listI have a inventory in todo-list were i am doing the inventory for the fishes and we were thingking of doing kinda like tarkov style inentory were you can rotate and the difrent fishes has diffrent that they take space in the inventory (this is might)and also when you click the fish there might be like new window were it show the fish and maby some description and button to discard the fish so you can have more inventory space |
Assignment 2 is submitted. Closing this issue. |
Mark issues done when documented. Deadline is 9. October, so a few days in advance would be NICE =)
Introduction:
Brief introduction, skill level, current know-how, your role in the project, also what you are responsible of.
Completed tasks:
Show code/screenshots of functionalities you've created. Explain what the heck it does in text too. Show components, assets etc.
In-progress tasks:
Same as above. If you don't got any tasks in-progress, you can write, that you don't have anything etc.
Emil
Aleksandar
Jaakko
Leevi
Afterwards comment them below
The text was updated successfully, but these errors were encountered: