Skip to content
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

Strange behavior on Evasion when target doesn't move #33

Closed
Indiefreaks opened this issue Apr 27, 2015 · 9 comments
Closed

Strange behavior on Evasion when target doesn't move #33

Indiefreaks opened this issue Apr 27, 2015 · 9 comments

Comments

@Indiefreaks
Copy link
Contributor

Hi Ricardo,

It's me again :P

I have a bizarre behavior with the steerforevasion component when the target isn't moving at all: they kinda flee like fishes :p while I would expect a straight movement instead.
I've posted a small video on Youtube to illustrate that. Note that this is valid for all instances I used.

https://youtu.be/2x-lP3VzXZ0

Thanks for letting me know if you see what I could do to remove this behavior.

@SonnyAD
Copy link

SonnyAD commented Apr 27, 2015

Hi

I have the same situation too. I have some fighters chasing ships and
sometimes the fighters have these movements. I guess it's related to the
precision of the prediction. My ships were static so far, now they are
moving slowly. I didn't notice so much improvements.
Did you try to put the prediction time to 0 on the SteerForEvasion,
Philippe? I didn't try.

Cheers,
Sonny Alves Dias

Le lun. 27 avr. 2015 à 17:30, Philippe Da Silva notifications@github.com
a écrit :

Hi Ricardo,

It's me again :P

I have a bizarre behavior with the steerforevasion component when the
target isn't moving at all: they kinda flee like fishes :p while I would
expect a straight movement instead.
I've posted a small video on Youtube to illustrate that. Note that this is
valid for all instances I used.

https://youtu.be/2x-lP3VzXZ0

Thanks for letting me know if you see what I could do to remove this
behavior.


Reply to this email directly or view it on GitHub
#33.

@Indiefreaks
Copy link
Contributor Author

The prediction time is actually set to 0 in the video I posted so I don't think that is related.
It seems to happens only when at a certain distance from the target. If you look on my video, you'll see that the ship continues in evasion for some distance before actually getting back to another steering behavior and it goes straight...

Might be a precision issue. I'll try to investigate a bit more. Otherwise, I'll have to go for another solution such as randomly defining a flee point and using a SteerForPoint instead...

@ricardojmendez
Copy link
Owner

@Indiefreaks Do you have a small repro case? Any other behaviors attached to the object? If I had to blindly guess, I'd suggest you start by increasing how often the vehicle updates its steerings (I think the default is 0.1s).

@Indiefreaks
Copy link
Contributor Author

I made the video so that you can see the other components and their properties (if you pause the video, you'll be able to see them clearly :p)

I'll try the updates property tweak to see if that changes anything.

@Indiefreaks
Copy link
Contributor Author

Ok, I made the test and reduced the TickedLength value from 0.1 to 0.01 and it made the trick. My spaceships now don't "fish" as before.

However, I may have found a small bug or feature request depending on how you'll interpret it:
Modifying the TickedLength value on a TickedVehicle or its subclasses, it won't update the value of the inner TickedObject because the actual Ticked Length is set on the TickedObject.TickLength property when the gameobject is enabled nor when it is modified.

I don't know how this system works so I didn't made a change on the code (especially if it handles multithreading in the background which could lead to even worse bugs if not done properly).
Thus, it would be great if the actual values could operate directly at runtime (in the Editor) so that we can test while playing in editor or even change the ticked length at runtime depending on the number of units that we may have to deal with...

Thanks.

@ricardojmendez
Copy link
Owner

However, I may have found a small bug or feature request depending on how you'll interpret it:
Modifying the TickedLength value on a TickedVehicle or its subclasses, it won't update the value of the inner TickedObject because the actual Ticked Length is set on the TickedObject.TickLength property when the gameobject is enabled nor when it is modified.

You are correct, it is set only when the TickedObject is created OnEnable. There is no multithreading, as Unity wouldn't be able to take it, and instead things are handled through a TickedPriorityQueue which means you could just change the value on the TickedObject yourself and the change will take effect after the next time it's ticked (since iirc it's used to set a "next tick time").

@Indiefreaks
Copy link
Contributor Author

Should I go throught a pull request with some additions to the TickedVehicle class where you'd be able to change the value from the Inspector and see it applied in the TickedObject instance ?

Thanks

@ricardojmendez
Copy link
Owner

Sure, go ahead. I may not merge it right away, since I want to make sure nothing else breaks, but it'll be useful to have.

@Indiefreaks
Copy link
Contributor Author

Ok, I'll have a go and let you know about it.

For that, I'll create a new feature request in the ticket system.

Cheers and thanks for the help ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants