New COB constants? - Page 3

New COB constants?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

"huge margin of error" should still be quite a bit less than 1 degree, I would think- and I'm not planning on using this to aim a rocket at Saturn 2 years from now, so it's ok. This is strictly to improve the visual quality of vehicles with, without having to resort to more complex methods.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Well I'm afraid I won't be adding anymore cob constants for the time being, which probably means no more in .75.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

It's OK, I've already done what I was going to use this for anyhow.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

There is one more constant you may be interested to add. It's the plane crashing state (bool crashing in CUnit). At least get only (although the code in AirMoveType looks like it will work with set, too - if you set that to TRUE, the aircraft will enter the crashing state). Can be used for a lot of things.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

FLOZi wrote:At a glance, the pitch information is held as a float3 so that would be trickier, unless I allowed manipulation of each component.
Argh wrote:If ya did a rough conversion on the GET, returning radians, it'd probably be acceptable for most purposes.
AF wrote:Or GET PITCHX, GET PITCHY, GET PITCHZ especially since radians assumes floating point which just isnt possible in cob so there'll be a huge margin of error....
Argh wrote:"huge margin of error" should still be quite a bit less than 1 degree, I would think- and I'm not planning on using this to aim a rocket at Saturn 2 years from now, so it's ok. This is strictly to improve the visual quality of vehicles with, without having to resort to more complex methods.
That "huge margin of error" we're speaking of is more than 28°.

But yeah of course you're the amazing breakthough scripter, and I'm only a flaming troll for reminding for the upteenth times the COB only handles integers, not floats, and that within scripts, angles aren't noted in radians but instead in 1/2^16 of full circle (like, 182 for 1°). Your dreamy beliefs (ref: "I would think") are obviously truer than proven facts and elementary math, since you're The One. I'm just being ungrateful that you deigned sharing with us your infinite wisdom.

Not to mention in "float3", there's not only "float", but also "3", but yeah if we used only one single number, as long as it's in radians it would contains all the information, since you said so.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I think he means radians multiplied by 65536, not directly converted to integer.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Hmm I thought floats were converted to integers? So of what use are radians then, even if they are mutliplied by 65536.

What we'd need is pitch_in_degree*(2^16/360), isn't it?
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

Eh, zwzsg, that wasn't really necessary.

You could've said all that without all the caustic humour.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

zwsg, have you even READ any of the PMs i sent you?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Argh, compound error can turn a small value change into a huge error difference.

Your being told by zwzsg the most experienced BOS coder in the OTA community and arguably the spring community, who has spent years fiddlign and done things that many thought were impossible, to disregard what hes learnt and listen to you.

I dont know what it is you two have against eachother that drives you to constantly bicker but arh somtimes its better to listen to the person whose spent 10x longer looking at soemhtign than you have unless you can proove what he says is wrong.

In this case I can backup zwzsg by saying that even fi COB supported floating point in OTA spring doesnt support it. Spring COB cannot use floating point, it uses whole integers. The same with BOS. That 3.129 you saw? Its a 3 now, that 2.9? Its a 2 now. Look at that 0.9999? Oh its just a 0.

In COB floating point values will be truncated according to how mingw32 casts floating points to itnegers, which in C++ means, truncate everything after the decimal, aka round downwards. Constants within the COB will be truncated based on the rules of the COB compiler source code language.

The lesson?

BOS doesnt support floating point values, it never has, you will need lua if you want accurate trig based calculations or you can get huge margins of error. Compound error is real and it can get exponentially higher. Ask any A level physics student whose calculated the margin of error.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

That's not just physics, computational mathematics is a whole kind of research dedicated to dealing with the inaccuracies computers introduce into calculations.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

i agree with af
Post Reply

Return to “Engine”