2d Unity
Practicing different forms of AI in a 2D Unity Environment.
This started with Conway’s Game of Life and now working on a Boids algorithm from old Uni exercises.
Conway’s is currently working, though it does start to throttle after adding 150 x 150 tiles.
I have just implemented the fleeing behavior for the Boids. The hope is to either add some fishy sprites and put them in some sort of fish tank.
Finally, I will work on an A* algorithm to recreate the hedge maze from The Legend of Zelda: Ocarina of Time.
Lots to do.
Commits | Message |
---|---|
1 | Initial commit |
2 | Unity initial upload A testing project for 2D coding Implemented: Conways Game of life Working on: Boids Want to do: A* |
3 | Repo fixing Cleaning up the repo |
4 | Code clean up and basic flee behaviour |
5 | Currently working on fleeing from multiple obstacles |
6 | It seems to work? Good progress, I am still not sure if it is proper seeking and fleeing behavior. They all seem to follow the same path which is interesting. I might try add some movement to the obstacles which might add some more interesting behavior. Also not the worst performance which is interesting! |
7 | Fixed the fleeing behavior Issue: Not correctly updating the closest obstacle so the flee behavior looked like it was working but it was completely broken. Also implemented very janky player movement, it isn’t correctly zeroing out so I had to implement a hard stop. Very yucky. Will work on flocking next! |
8 | Lots of clean up. Realized I should not be using a global var from the Game Manager for the weights of each of the behaviors. Rather I could make it a member var of the base class and require all inheritors to use it in their constructors. This also Allows for better testing of weights in editor without having to open the code. Started work on the separation behavior which is making everything freak out, but I just think this is due to the lack of alignment and cohesion behaviors which I will add soon. Added headers for improved readability in editor as well. Code is looking rather clean atm. |
9 | Added UpdateWeight function which allows for changing weight values during runtime for better behavior control and testing |
10 | Split the Game Manager into Boids and Conways managers so that I don’t have to comment them out when I wanna swap. Looking into moving obstibles away from being boids and rather attached to GameObjects. This would allow for more interesting shapes to be used for the seekers to avoid. |
11 | Alignment Implementation of alignment, it is very funky at the moment. The Boids are starting and stopping. I was able to debug and issue where all the Boids were disappearing into the nether because I am now using a closeNeighbourCount that has the potential to be 0. So I return Vector2.zero if it is zero. Dividing by 0 is bad. Implemented bounds, but I dont think it is working as desired as it will just avoid its x y pos rather than the whole object. That will need to be fixed if I want to use different shapes. Lots to do but making progress. |
12 | Implementing cohesion. It is not going well, the behavior is not displayed at all. Still also need to look into improving separation. |
13 | Closing Unity |
This post is licensed under CC BY 4.0 by the author.