0
\$\begingroup\$

I am developing a game in Unity3d.

In this game, 2 teams will fight without any human interaction. The fight results must be always the same, if the same teams are the same. This way, I must reproduce the same fight in many devices, getting the same results in each device.

The map where the fight happens is a 3d environment, so, my soldiers can move in any direction. And the soldiers cannot walk in the same space of another soldier, so I need an agent avoidance algorithm.

I am having some trouble to find a solution to the problem above. To achieve the 'always the same results' I am treating this fight as Turn Based Strategy game, with little fixed time intervals between the turns.

To calculate the pathfind of the soldiers, I am using the Unity3d navmesh framework. And then I move manually my agents according to the 'NavMeshAgent' 'steeringTarget' property.

But this method doesn't cover the obstacle avoidance algorithm, and my agents overlaps.

So, I am looking for a solution to my problems, It should be a manual obstacle avoidance algorithm, or a way to unity navmesh work in fixed time intervals, or a completely new approach to my path-finding problems.

\$\endgroup\$
  • \$\begingroup\$ Are your soldiers walking on a grid? Or is it more like, all players have X number of units they can move every turn, at any direction and speed (including something like 0.01)? \$\endgroup\$ – TomTsagk Jul 26 '18 at 11:08
  • \$\begingroup\$ The second one. I already took care of that! I used some steering behaviors described in "gamedevelopment.tutsplus.com/series/…" to control the moviment. \$\endgroup\$ – Everton Elvio Koser Jul 27 '18 at 17:10
0
\$\begingroup\$

The way to solve it in two steps:

  1. Make your 'avoidance algorithm' prevent NavMesh movement from navmesh.SetDestination() when near another object with navmesh.Stop()
  2. With Random.seed you will be able to set destinations of your navmeshobjects exactly the same on every device so outcome will be exactly the same if people are using the same seed.
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 1. Yep, this is technique that I am currently using. The problem is the 'Collision Avoidance'. After posting this question, I look into the 'Steering Behaviors' tutorials (gamedevelopment.tutsplus.com/series/…) and they gave me a way to manually implement the collision avoidance. 2. Thanks for the tip. Actually, since my server should be able to process more than one match at same time, I am using a custom Random algorithm, but this stage is already implemented! :) \$\endgroup\$ – Everton Elvio Koser Jan 25 '18 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.