Zerg coming!
zergs pathfinding demo

zergs pathfinding demo

https://www.youtube.com/watch?v=sV5gZG4mCeo
I need 3 more comments to make my game have a rate!
This LudumDare game jam, I work alone and finish a shooting game Zerg Coming!.
https://www.youtube.com/watch?v=G_SsuKF0a9g
This is a preview of my game. The core mechanism is that you will fight with 7 round enemies, and you can shoot and dash.
Many comments for my game is that "you did a good pathfinding", so here I want to share with others about the technology below the game.
I use the Unity 2018.2.3f1, and in order to accomplish good pathfinding and group steering behavior, I use these methods below.
First of all, all the enemy has a dynamically simulated rigidbody2d, but there is no collision between enemy and enemy. There only have environment collision with the enemy. This relieves physic engine very much.
I use two steering mode: seek steering and separate steering. If you don't familiar with steering, you can learn these steering modes at The Nature of Code.
When the enemy has a pathfinding route, it will follow the path use seek steering force. Applying steering force instead of simple change velocity direction will make the movement look smooth and natural.

If enemy only has seek steering, they will gradually overlap. To solve this problem, I come up with three solutions:
Since RVO and physic engine solution is bad for performance, I decided to use separate force solution.
Separate force work like this: when another unit is too close to you, you will receive a force to make yourself separate from it. This website explain this clearly.

So, each frame, an enemy will try to get the other near enemies information, and average each near enemy's position, to calculate a separate force.
In order to make finding near enemy information more efficient, I use the point octree to store each enemy position, I use the library UnityOctree. Since update octree is also a time-consume work, I write a simple logic that : If current enemies number is large than 1000, then each enemy every Random(0, 10) frame update its position in octree; if current enemies number is below 1000, then each enemy every Random(0, 5) frame update its position in octree.
Now let's get to the pathfinding. I use flow field to make the pathfinding. If you don't familiar with flow field, here is a simple and clearly article that explains flow field : Basic Flow Fields.
In my achievement, I update the flow field every Random(0, 4) frame. If you understand how flow field work, you will note that update integration field is the most time-consume work. Luckily, there is a paper that uses jump point to efficient update integration field : Faster Dijkstra Search on Uniform Cost Grids(but you need to buy the GameAIPro3 first :) ).
Below is the flow field in my game, where the white lines are the flow field directions :

That's all my accomplish. This is also my first time to join LudumDare, I am happy to join it :) !!
I need 3 more comments to make my game have a rate!
This LudumDare game jam, I work alone and finish a shooting game Zerg Coming!.
https://www.youtube.com/watch?v=G_SsuKF0a9g
This is a preview of my game. The core mechanism is that you will fight with 7 round enemies, and you can shoot and dash.
Many comments for my game is that "you did a good pathfinding", so here I want to share with others about the technology below the game.
I use the Unity 2018.2.3f1, and in order to accomplish good pathfinding and group steering behavior, I use these methods below.
First of all, all the enemy has a dynamically simulated rigidbody2d, but there is no collision between enemy and enemy. There only have environment collision with the enemy. This relieves physic engine very much.
I use two steering mode: seek steering and separate steering. If you don't familiar with steering, you can learn these steering modes at The Nature of Code.
When the enemy has a pathfinding route, it will follow the path use seek steering force. Applying steering force instead of simple change velocity direction will make the movement look smooth and natural.

If enemy only has seek steering, they will gradually overlap. To solve this problem, I come up with three solutions:
Since RVO and physic engine solution is bad for performance, I decided to use separate force solution.
Separate force work like this: when another unit is too close to you, you will receive a force to make yourself separate from it. This website explain this clearly.

So, each frame, an enemy will try to get the other near enemies information, and average each near enemy's position, to calculate a separate force.
In order to make finding near enemy information more efficient, I use the point octree to store each enemy position, I use the library UnityOctree. Since update octree is also a time-consume work, I write a simple logic that : If current enemies number is large than 1000, then each enemy every Random(0, 10) frame update its position in octree; if current enemies number is below 1000, then each enemy every Random(0, 5) frame update its position in octree.
Now let's get to the pathfinding. I use flow field to make the pathfinding. If you don't familiar with flow field, here is a simple and clearly article that explains flow field : Basic Flow Fields.
In my achievement, I update the flow field every Random(0, 4) frame. If you understand how flow field work, you will note that update integration field is the most time-consume work. Luckily, there is a paper that uses jump point to efficient update integration field : Faster Dijkstra Search on Uniform Cost Grids(but you need to buy the GameAIPro3 first :) ).
Below is the flow field in my game, where the white lines are the flow field directions :

That's all my accomplish. This is also my first time to join LudumDare, I am happy to join it :) !!