youvsvirus / youvsvirus-unity

Unity version of the you vs virus game.
GNU General Public License v3.0
1 stars 1 forks source link

First try for random movement #28

Closed maccxs closed 4 years ago

maccxs commented 4 years ago

Maybe there is a much better way do to this. At least it looks halfway smooth and seems to be a good velocity for the npcs. For more details see the code snippet. @FredyHennig: Did i delete your "The sun rises..." message by accident?

ghost commented 4 years ago

@maccxs That message was just a debug message, I think I removed it myself.

ghost commented 4 years ago

Apart from the fact that the ghosts are still moving, it looks good :) But I'd expose minVel and maxVel as public variables to the editor instead of hard-coding them, so we can easily fine-tune them and also change them during runtime.

ghost commented 4 years ago

Currently, when the NPC is accelerating, its velocity grows exponentially. This way, when it is just below max velocity, it will easily jump up to almost 1.5 * maxVelocity. Maybe linear growth (= constant acceleration) is more sensible?

maccxs commented 4 years ago

Thanks for the improvements. Did not try them out yet but everything seems very sensible. I was playing around so much yesterday that I was just glad that it look halfway good.

maccxs commented 4 years ago

@FredyHennig : Checked out your improvements in this branch - looking good. Introduced random initial velocity for npcs inbetween min and max. Implemented social distancing on top. This works ok, I think. A social dist factor of 100% makes the circle collider radius now about 1.8 times as big as before. Some randomness introduced to make it look nicer. Issues

ghost commented 4 years ago

@maccxs I refactored the script to be directly attached to the NPC GameObject.

There is a tiny problem to your implementation: At a certain social distancing factor, the NPC's colliders grow larger than their infection radius. This way, noone will ever get infected any more. And below that point, I believe, the spread rate doesn't change at all because even with larger colliders, NPCs still are colliding just as often.

Maybe we should implement social distancing like in the python version, with decreased movement, for the time being? Later, we could try a more sophisticated approach, like a repelling force that still allows touching, but makes it harder.

maccxs commented 4 years ago

Hi, yes that is a problem. I tried to integrate the infection radius, but if I make the radius of the smileys too large, it really looks unnatural. I think we should still merge, because the social distancing is quite separate and does not break anything, but I will continue working on it then in a separate branch. This one has probably gotten large enough.

maccxs commented 4 years ago

@holke If you have a minute, maybe you yould merge this branch into the master and then (!) the other one. @FredyHennig and I have cross-reviewed the changes in this branch over the weekend.