minolin / acplugins

R&D about the upcoming server plugin infrastrucure of Assetto Corsa, driving simulator by Kunos simulazioni
Apache License 2.0
18 stars 4 forks source link

Collision Bag: Won't work in the live environment #19

Open minolin opened 8 years ago

minolin commented 8 years ago

While testing with the fake server, the collision bag works flawless. If you send a collision once, this happens: Collision occured!!! 12 vs. wall 14:38:34.5311600 OnCollision (0vs1), contantTrees.Count=0, partOfATree=False 14:38:34.5648001 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:38.6455117: Collision bag finished (0 vs. 1) Action for car 0: None Action for car 1: None

4.1s after the collision the bag is finished.


If you click multiple times inside those 4.1s, like this:

14:38:40.3955123 OnCollision (0vs1), contantTrees.Count=0, partOfATree=False 14:38:40.4267726 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:40.5986626 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 14:38:40.6454821 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:40.8174054 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 14:38:40.8486473 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:41.0048982 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 14:38:41.0400860 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:41.2243874 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 14:38:41.2450584 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 14:38:45.3589912: Collision bag finished (0 vs. 1) Action for car 0: None Action for car 1: None

The bag collects them all, fine.

On the live systems I can see that this isn't happening, somehow the duration of the collision bag thread is much shorter. You can even feel one bump and get two distinct warnings (#1 AND #2), probably because the the 0vs1 bag is already done when the 1vs0 message arrives.

Questions:

flitzi commented 8 years ago

I've debugged the collision bag and it seems that it works as intended. I tested it with a car constantly bumping into the other. First thing I noticed is that the server filters the collisions between two cars for 5 seconds, meaning that if the two cars collided within the last 5 seconds the server won't send a collision msg again.

With your TreeRefreshSeconds = 4 and only two cars the bag would never group more than two collision messages.

In order to test the grouping I increased TreeRefreshSeconds to 6 and now it correctly groups all collisions until MaximumTreeDurationSeconds = 20 is reached. See log below.

So in essence I cannot reproduce the problem. Are you sure the current plugin implementation is used?

18:19:17.9642138 OnCollision (1vs0), contantTrees.Count=0, partOfATree=False 18:19:18.1245675 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:22.9681505 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:23.1286386 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:27.9714699 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:28.1325523 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:32.9753798 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:33.1362156 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:37.9801945 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:38.1400255 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:39.2367967: Collision bag finished (1 vs. 0) 18:19:42.9837238 OnCollision (1vs0), contantTrees.Count=0, partOfATree=False 18:19:43.1445562 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:47.9875548 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:48.1481844 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:52.9915935 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:53.1521538 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:19:57.9956416 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:19:58.1571467 OnCollision (0vs1), contantTrees.Count=1, partOfATree=True 18:20:02.9995534 OnCollision (1vs0), contantTrees.Count=1, partOfATree=True 18:20:04.2566492: Collision bag finished (1 vs. 0)

minolin commented 8 years ago

First thing I noticed is that the server filters the collisions between two cars for 5 seconds, meaning that if the two cars collided within the last 5 seconds the server won't send a collision msg again.

OH. Didn't knew that. Then I must have seen an self-made error. One bump, two triggered collsion bags resulting in WARNING: 1st Collsion WARNING: 2nd Collision

Probably the 1vs0 and 0vs1 got a seperate bag each.

Are you sure the current plugin implementation is used?

I really was, until now. Maybe this was on a foreign server with a really old version, confusing me up. I'll go out and test it now.

minolin commented 8 years ago

Uh help, I don't know anything about git and it's formatting :dancer:

Just checked with Hagen, a single bump looks pretty good. pushing him slowly does recreate a wrong, second event afterwards. Reproducable, unfortunately I can't record it (my shadowplay doesn't work since Win10).

flitzi commented 8 years ago

what do you mean with "wrong, second event afterwards"?

minolin commented 8 years ago

2nd. I tried to have constantly sideways contact by pushing him slowly for less than 4s. Although this shouldn't matter, every new contact should lengthen the bag's lifetime by another 4s (or 5, after your change).

A "1st contact" message arrives after I backed up, then a "2nd contact message" is incoming. The latter is wrong.

flitzi commented 8 years ago

hmm.. I still don't understand. but I did not commit any change. I just temporarily set TreeRefreshSeconds to 6 for testing.

Why exactly is the "end contact message" wrong? Because less than TreeRefreshSeconds elapsed since the last contact? Or because of the delay? Keep in mind that Kunos not only filters contacts within 5 seconds, the contact messages also have delay of about 3 seconds before they are send to the plugin.

minolin commented 8 years ago

the contact messages also have delay of about 3 seconds before they are send to the plugin Uh really? That's a problem, maybe related, mabe a different one. If we only wait 4 (or 6) seconds until the bag is closed, and there is another mass-collsion victim (let's say 2.5s after the initial hit), the bag will be closed until then.

Mh. I don't like this bag at all. But it's still too easy to be hit by 3 or 4 people in a mass accident without having any chance to avoid it. Thanks for this update, wasn't aware of it. I'll have some dedicated tests with both - direct collision messages + bag messages.