Unit drift

Unit drift

Requests for features in the spring code.

Moderator: Moderators

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Unit drift

Post by AF »

When spring temporarily looses conenction with the host for a second or so the game dirfts. SFX get larger or smaller and dotn stop, untis carry on on their trajectories floating not animating, explosions keep getting bgiger and bigger and bigger, etc..

Instead the game should stop all motion and resume once the connection resumes, rather than showing ugly drifting effects for seconds or half a second at a time, its unproffesional.

Ideally when this happens the units would stay still and a little icon or small animation would be drawn in the corner using a lua widget.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

I disagree. Units should continue with their current orders. The client knows their orders too so it should be able to make the same decisions as the host about how the unit should be moving. When the connection is reestablished there is hopefully a minimal amount of adjustment to perform.

Effects such as nanospray, explosions, smoke, should do their normal behavior too and not just continue growing/moving indefinitely. The client should know when to stop the effect anyway so why does it need the host to tell it? This should also apply to weapons.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

no no no no no

you totally misundrstood me.

If I take my itnernet cable and yank it out 2 thigns happen.

1) All my units start drifting, all the animations stop, untis will float through eachother and it all looks very strange
2) After 10-20 seconds of this spring closes without warnign havign detected time out.

So no, units should not continue there orders because theyre incapable of doing their orders, because the game is not in progress, its in limbo, gametime is not progressing.

When playing a game sometimes this will happen for a moment and you'll see everything drift for a second or two then it syncs back and the game speeds up for a second or two playing catch up then things continue as normal.

If you still don't understand what I mean, play a game and at the very end have all your units move in random directions. When the server/host exits all your units start drifting.

EDIT::
For further clarification

Effects such as nanospray, explosions, smoke, should do their normal behavior too and not just continue growing/moving indefinitely. The client should know when to stop the effect anyway so why does it need the host to tell it? This should also apply to weapons.
This is utterly impossible. The drift issue only occurs when there is no connection to the host or the connection is temporarily cut/lags. When the network connection is interrupted the game is paused and the units start to drift around like I said, and when the connection is regained the units stop drifting and return to their normal positions and carry on as they should do.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

You know, I always assumed that the drifting was just my client and not everyone's, including the host. If, as you say, it is the whole game that is effected then yes, I agree with you - it would be better to just freeze everything until the game resumes.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

no I don't think the host drifts, but anyone who looses connection momentarily will.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

What does the host see then? Does the hosts game continue as normal?
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Yes, and it spams "no response from XXX"
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

I think its trippy when effects do that... :P
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

Well if the hosts game continues that means the client has to then catch up with everything it has missed while it was absent from the game. Therefore, my original assumption was correct and my point still stands - it would be better for the client to try to continue with the information it knows at the time the connection was suspended in the hope that when the connection resumes its game state is as close as possible to the hosts.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

But thats somewhat pointless as all that effort is going to be undone anyway.

What's more its a lot of effort to code with no benefit at all and it hides a potential conenction problem from the user.


On top of that it introduces a desync issue with users perception. A temporary time out could last 5-6 seconds during which the game could change a lot. The unit that moved a few screens in a transport that your currently tracking might have been killed by an order the host issued in the moment you lost contact temporarily.

Its horrendous user design, and it conceals valuable information from the user and is a lot to do.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

I rarely see it last more than a few hundred milliseconds so I don't see it being that big a deal personally. If, however, everything momentarily froze every time it happened I think it would be very distracting.

You say it's a lot of effort - why? It's not something new that the engine doesn't know how to do? Currently, certain things are being suspended while others aren't. I don't know the code but I don't see why it should be this way.

Yes, discrepancies will occur due to changes in orders but for the most part the game will continue in the same way on both the client and the host.

The only time things really become problematic is when the connection is lost for many seconds but if that happens then the client player really has lost control and doesn't know what is happening in the game. At least a "simulated" view of the game will provide some insight as to what is most likely to be occurring and they are able to consider those events instead of just stare at a static screen with no idea at all of what is happening.

Consider that you've just sent a scout over the enemy when your connection freezes. You now don't know what it is seeing while it is flying over the enemies base until your connection resumes and all you have to show for it are ghosts of buildings. You have no idea of any amassed units that may be in the area or of how much airborne air defense there is, etc.

Consider that your connection has frozen and while your game is "paused" you have a group of enemy units attempt to overrun part of your defenses. You don't know about this, however, until the game resumes so you aren't prepared for it and ready to send in the reinforcements that you have in standby for just such an event.

Personally, I would like to know what is happening in the game, even if it's not 100% accurate, rather than nothing at all.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Post by Auswaschbar »

You say it's a lot of effort - why? It's not something new that the engine doesn't know how to do? Currently, certain things are being suspended while others aren't. I don't know the code but I don't see why it should be this way.
Its because the client only executes a step of the simulation after it gets a special message from the server to ensure there are no orders given. Running a step without these will cause desyncs when there are orders the client doesn't know about.
Yes, discrepancies will occur due to changes in orders but for the most part the game will continue in the same way on both the client and the host.
Every small difference may cause a desync...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

a momentary pause would eb best. Seeing units predict their commands momentarily then snap back for a few hundred milliseconds will look the same as the drifting but slightly better. The drift issue would still remain for when the server exits.

Also, what if your scout flew over an enemy abse in the time out revealing the enemy base but when it synced back the enemy blew up the scout before it could see anything? Its exploitable.

What's more you have to save the current game state so that when connections resumed its reloaded and it continues otherwise you're going to get a hard desync and have to restart the game.

The effort of saving then restoring changes could in itself cause momentary time outs leading to a recursive loop leading to a full blown time out.

Whereas you could simply pause the game and keep the current behaviour and display a friendly message so that the user knows exactly what's going on, why its happened, and the whole thing is nice and clean cut. Its far quicker to implement and much faster to run.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

AF wrote:Also, what if your scout flew over an enemy abse in the time out revealing the enemy base but when it synced back the enemy blew up the scout before it could see anything? Its exploitable.
Fair comment. That's not good.
AF wrote:...you have to save the current game state...
Yes - that would be a lot of effort.
AF wrote:Whereas you could simply pause the game and keep the current behaviour and display a friendly message so that the user knows exactly what's going on, why its happened, and the whole thing is nice and clean cut. Its far quicker to implement and much faster to run.
Ok, I'm convinced. Where do I sign. ;)
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Post by Auswaschbar »

I just committed this: all animations will continue until 500ms after the last NETMSG_NEWFRAME from the server, then it will stop (well, they are currently resetted). Lua binding will follow...
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

Iirc there already is one: Spring.GetFrameTimeOffset()
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Post by Auswaschbar »

Doxygen wrote:float timeOffset: Time in number of frames since last update
Thats not helpfull, since it doesn't allow lag detection.

Whats better for this, a CallOut (like OnLag() and LagEnded() ) or a CallIn (like bool HasLag() )???
User avatar
Mr.Frumious
Posts: 139
Joined: 06 Jul 2006, 17:47

Post by Mr.Frumious »

Personally, I don't care about the drift effect. What I want is an icon showing me that it's communication with the server that's the problem. Something like the little "cable unplugged" symbol from the Quake games.

Still, the drift effect is annoying, since usually during a freeze you stop and look around and plan what's to happen at resume (particularly since resume often includes a little fast-forwarding). Having stuff glide all over the place makes that pretty rough.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

A call-in would prevent scripts from
having to poll every ~0.1 seconds,
so that should be the preferred
method (moreover, lag counts as
an exceptional event that scripts
should not need to find out about
on their own).
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Post by Auswaschbar »

I have implemented as a CallOut function named GetHasLag() with bool as return type because:

1. It needs only one function (HasLag) instead of two (OnLag and LagEnd)
2. The state (lag or not lag) has to be polled each Draw(), so there should be no speed difference
3. Widgets dont need to store the lag status local, instead they can just use the func

Unfortunately I dont know enough LUA to write a test script.
When someone found a bug, please post it here.
Post Reply

Return to “Feature Requests”