Aircraft in infinite loop

Our old place to report Bugs, it's not used anymore. To report bugs, please read this topic.
Sneaksie
New user
Posts: 1
Joined: 10 Jan 2007, 00:09

Aircraft in infinite loop

Post by Sneaksie »

I had a problem with original Wz2100, then with GPL version.
It's my first time playthrough, so i played original version at first with videos. When i started the final mission in 3d campaign, game (original) crashed. It crashed any time i've tried.
Then i've downloaded latest free version and copied save to new installation. It loaded (cool!), with no cutscenes though, of course. But there is another problem - i've noticed that one VTOL circled around it's helipad infinitely, trying to land. Oh well, i've loaded units into transport and send them to final mission against Nexus. Then i discovered a much more serious problem - transport circling in the same fashion around LZ, trying to fly away. No transport flying away - no reinforcements, no reinforcements - mission impossible, because it's pretty tough. I could build the base here, but it's impossible to build factories in a transport mission. I've tried to copy the savegame to old, 1.10 Warzone, but the game crushed while loading with error about something 'Campaign load', no wonder though.

All suggestions are welcomed, because i really want to get close to this Nexus thing after all this long war:)
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Aircraft in infinite loop

Post by lav_coyote25 »

when vtols circle the landing pad - ctrl - or ctrl plus  - will slow or speed up the game play - may help with this problem with the transport as well unless there is something blocking the landing pad...like enemy units.

dont forget to reset the speed to normal afterwards,,,, ;D
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
The Noid
Rookie
Rookie
Posts: 21
Joined: 09 Mar 2007, 12:14

Re: Aircraft in infinite loop

Post by The Noid »

I also have the vtol circling the landing pad problem very, very often. It's highly annoying because the circling vtol seems to inhibit the rest of the ctrl-group it is in from leaving the pad. If I redirect the circling vtol, the rest of the group instantly takes of to continue their attack, but while the stuck one is circling, the others just sit there...

It sucks having to baby-sit your landing vtols when there's plenty of other things that require attention. :(
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Aircraft in infinite loop

Post by lav_coyote25 »

through trial and error i have observed this also and have arrived at a sort of solution to that problem

Python Project Heavy Body + vtol + weapon = an aircraft that 99 percent of the time will not exibit that behavoiur...

it does once in a while not land ... it will circle the landing pad very tightly... so to the devs...why do these vtols do that??


keep in mind the ctrl - to slow the game down untill it lands and the ctrl + to reset the speed back to normal.

;D
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Aircraft in infinite loop

Post by kage »

definite bug... anything that exhibits different behavior at a different game speed cannot be anything but a bug.
The Noid
Rookie
Rookie
Posts: 21
Joined: 09 Mar 2007, 12:14

Re: Aircraft in infinite loop

Post by The Noid »

Well, I don't know c, but I know plenty of other languages, so I figured I might as well fetch svn and have a look in the code.

The reason the behavior changes at different game speeds is in the function moveCalcTurn in move.c where the turn-per-game-frame is calculated:

Code: Select all

	change = (baseTurn* rate);		// constant rate so we can use a normal mult
	if(change < FRACTCONST(1,1))
	{
		change = FRACTCONST(1,1);	// HACK to solve issue of when framerate so high
	}						// that integer angle to turn per frame is less than 1
On fast computers, the framerate is always so high that the amount of turn-per-frame is lower then 1 degree, meaning it gets set to 1 degree.

A circling VTOL has the problem that it can't turn fast enough. It's actually turning faster then it's supposed to, because nothing can turn slower then 1º per frame, but it's movement speed and it's turning rate send it in circles.
So when you slow down the game speed, you get even more game-frames/second, so the turning speed of the VTOL increases and it's able to break the circle and land.

How did it get in that circle in the first place? Because it can't turn slower then 1º/frame. It's supposed to fly away from the pad, notice the pad is behind it, and turn on the spot. But it's forced to turn faster then it's supposed to, meaning it doesn't actually fly away from the pad, and ends up circling it.

I guess this minimum turning rate of 1º/game-frame makes every unit turn too fast. The two ways I can think of to fix this is change the movement angle from an int to a float (or some other type that allows decimals), but that's out of my current c-coding-skills. Or limit the game-fps to something closer to the intended value (if the game-fps and graphics-fps are uncoupled).

I guess this thread should be moved to bug-reporting
Last edited by The Noid on 31 Mar 2007, 21:07, edited 1 time in total.
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Aircraft in infinite loop

Post by lav_coyote25 »

the thing is - this "bug" or "feature" has been with us since the very begining  = 1999. 

i believe ( but dont have the proof of the old forums pages) that this is one of the oldest known bugs/features. ;D
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
The Noid
Rookie
Rookie
Posts: 21
Joined: 09 Mar 2007, 12:14

Re: Aircraft in infinite loop

Post by The Noid »

Yeah, but the faster PC's become, the more noticeable it gets. Eventually all units will turn on the spot...

How is this handled in multiplayer? Does the turning rate of your vehicles depend on the speed of the PC of the game-starter? Or on the speed of the "slowest" player's?

How difficult would it be to change the direction-angle to a float?
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Aircraft in infinite loop

Post by Watermelon »

The Noid wrote: Yeah, but the faster PC's become, the more noticeable it gets. Eventually all units will turn on the spot...

How is this handled in multiplayer? Does the turning rate of your vehicles depend on the speed of the PC of the game-starter? Or on the speed of the "slowest" player's?

How difficult would it be to change the direction-angle to a float?
It shouldnt be hard to change the direction and motion dir of a droid to float from sint,but I am not sure if the direction will be able to return float when calculating direction(orientation) and dir(motion direction).

Everyone has their own 'copy' of game in a multiplayer,the game just tries to synchronize the differences between different 'copies' of game of different players with different PC speed...
tasks postponed until the trunk is relatively stable again.
The Noid
Rookie
Rookie
Posts: 21
Joined: 09 Mar 2007, 12:14

Re: Aircraft in infinite loop

Post by The Noid »

I figured I'd just give it a shot, and, as my first attempt at C, change the direction to FRACT. And it seems it worked. Units turn at the correct speed, regardless of the gamespeed. VTOL's land beautifully. Saving and loading works, loading old savegames doesn't work at the moment as I haven't looked into that yet. I guess I'll have to define a new savegame version.

I haven't tested multiplayer, only Skirmish.
Patch to SVN attached.
Attachments

[The extension has been deactivated and can no longer be displayed.]

User avatar
Hatsjoe
Trained
Trained
Posts: 285
Joined: 20 Feb 2007, 19:57

Re: Aircraft in infinite loop

Post by Hatsjoe »

The Noid wrote: I figured I'd just give it a shot, and, as my first attempt at C, change the direction to FRACT. And it seems it worked. Units turn at the correct speed, regardless of the gamespeed. VTOL's land beautifully. Saving and loading works, loading old savegames doesn't work at the moment as I haven't looked into that yet. I guess I'll have to define a new savegame version.

I haven't tested multiplayer, only Skirmish.
Patch to SVN attached.
Whoohooooooh!
Now someone put it in 2.0.7 !!!
Image
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Aircraft in infinite loop

Post by DevUrandom »

Yes, that one is missing.
You can increase the chance for a quick inclusion greatly if you use floats instead of FRACTs, since they were only used for the float-less PlayStation and are going to be removed.
Giel
Regular
Regular
Posts: 725
Joined: 26 Dec 2006, 19:18
Contact:

Re: Aircraft in infinite loop

Post by Giel »

DevUrandom wrote: Yes, that one is missing.
You can increase the chance for a quick inclusion greatly if you use floats instead of FRACTs, since they were only used for the float-less PlayStation and are going to be removed.
Also sending in a patch that uses only repository paths might help. (I.e. warzone/src/warcam.c does not exist in the repository: src/warcam.c does)
"First make sure it works good, only then make it look good." -- Giel
Want to tip/donate? bitcoin:1EaqP4ZPMvUffazTxm7stoduhprzeabeFh
The Noid
Rookie
Rookie
Posts: 21
Joined: 09 Mar 2007, 12:14

Re: Aircraft in infinite loop

Post by The Noid »

Sure, no problem.
I'll make an updated patch this evening.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Aircraft in infinite loop

Post by DevUrandom »

Giel wrote: Also sending in a patch that uses only repository paths might help. (I.e. warzone/src/warcam.c does not exist in the repository: src/warcam.c does)
The -p parameter of patch helps here...
Locked