Page 1 of 2

build angles

Posted: 16 Jun 2007, 21:49
by Caydr
One of the things that gave TA its personality was the fact that buildings weren't often built at perfect 90-degree angles, they were a few degrees to either side. Could this sort of randomness be added to Spring?

You can detect whether a unit is supposed to have this random build angle by searching for a FBI buildangle of anything greater than 0.

Posted: 16 Jun 2007, 22:12
by Argh
You can do this with anything except for Factories via script.

Posted: 16 Jun 2007, 22:32
by KDR_11k
Why not for factories? It was just a graphical effect anyway, the yardmap would remain the same.

Posted: 17 Jun 2007, 04:12
by Argh
It's not, actually- if the Piece that the Unit that's being created isn't on a valid square, for example, it'd either ruin the factory, or ruin the illusion- I've done some experiments with this, and yes, you *can* cause units to become immobile, if the Factory won't open. Just imo, of course, but I don't recommend it. Everything else is fair game (for turrets or other active objects, remember to store the value and then post it to your weapon scripts, so that they get the correct heading).

Posted: 17 Jun 2007, 14:42
by NOiZE
Argh wrote:You can do this with anything except for Factories via script.
How?

Posted: 17 Jun 2007, 15:26
by KDR_11k
Isn't that obvious? Just rotate the appropriate pieces.

Posted: 17 Jun 2007, 15:58
by Guessmyname
Create()
{
var startangle;
startangle = RAND(1,90)
turn base to y-axis <startangle> NOW;
}

Posted: 17 Jun 2007, 16:02
by zwzsg
You can do that for factories as long as the pad is centered and you don't mind units passing through wall, or as long as you don't turn too much.

In Total Annilihilation factories had a buildangle tag but kept the value low enough so that it cause no issues, for exemple the ArmALab had buildangle=2048; where 2048 means 11°¼.

There's only problem with buildangle on factories when you turn so much the yardmap no fitting the model becomes too visible, or when the turned buildpad isn't any more over open square of the yardmap.

Spring ignore the BuildAngle tag, and indeed it would be nice if it supported it.

However, like Argh and KDR pointed out, you can do it in the script. Editing the script isn't as convenient as editing the FBI, but the result is the same.

I did that like 1.5 years ago, when I first noticed Spring ignored BuildAngle on my Stargate that had a very large buildangle.

Basically:
- In the 3do or s3o, have nothing in the root object, then have a "mother" piece child of root, and every other piece child or heir of "whatever". (This is because for some reason Spring doesn't like turn the root of s3o.)
- In the Create() of the script, have a "turn whatever to y-axis rand(<-11>,<11>) now;" where 11 is your random buildangle in degree.

If you used a scripted random buildangle on turret, you would have the problem of making sure the turret still point to the target. There's a variety of approach to that, you can make the turret of defense tower not a heir of the piece that is turned, so that the random rotation affects the tower but not the turret on top of the turret. Or you can store the random rotation in some static-var and then substract it to the "heading" in the AimPrimary, etc...

If I remember that thread right, for 0.75 FLOZi has implemented a "set HEADING", which means that instead of turning all the pieces of the unit, you could turn the unit itself, with a set HEADING to rand(<-11>,<11); in the Create(), which would be a better way since then the unit would actually be turned instead of appear to be turned, so stuff like aiming turret wouldn't need any correction.


Guessmyname: Scriptor doesn't like to have variables inside < >. It ges all confused and spout "Error: expected identifier". And understandably, since the < > are calculated at the preprocessing stage, when variables aren't fixed. It's better to put the < > directly around the 90, plus that way the startangle are in scripts native angular units, so like you can compare them with other angles such as get XZ_ATAN or aiming's heading. By the way, make it a static-var if you plan to use the variable later in other script, or don't use any var but put the "rand" directly inside the "turn" command it's a value we're supposed to forget as soon as the model is turned. And when I made the Kernel turn to face map center, I noticed Spring went really unhappy if I turned the base piece itself.

Posted: 17 Jun 2007, 16:53
by FLOZi
I'm not sure buildings obey heading though.

Posted: 17 Jun 2007, 18:00
by Guessmyname
the angle might be needed for any turrets, which would have to factor it into their aiming script or their aim would be visibly off

Posted: 17 Jun 2007, 19:55
by NOiZE
someone pls make a patch so it reads the buildangle?

Re: build angles

Posted: 29 Jul 2009, 02:23
by Caydr
Epic Rez.

Searched the forum, no more recent references to this. Was it ever added to Spring?

I should add, I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.

Not sure, maybe the random number can be stored as a static var and then called when the... no that won't work.

Any ideas?

Re: build angles

Posted: 29 Jul 2009, 04:25
by Argh
No, it wasn't added to Spring. You can do it in BOS as described, though, and if it's just 1-2000K radians, it's not that likely to actually cause any Footprint issues anyhow.

Re: build angles

Posted: 29 Jul 2009, 06:11
by Gota
Will it still be noticeable?I remember solars in ota sometimes turned a lot.

Re: build angles

Posted: 29 Jul 2009, 07:23
by smoth
They didn't turn that much.

argh is speaking the truth though, script based is the way to go.

Re: build angles

Posted: 29 Jul 2009, 17:55
by NOiZE
Solars indeed had a huge buildangle, i think it was as much as 45 degrees!

Still someone has to make a patch for spring IMO!

Re: build angles

Posted: 29 Jul 2009, 18:04
by Caydr
Argh wrote:You can do it in BOS as described, though
Caydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
O hai
smoth wrote:They didn't turn that much.
argh is speaking the truth though, script based is the way to go.
Caydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
O HAI THER

They turned by as much as 178 degrees.

Re: build angles

Posted: 29 Jul 2009, 18:04
by Otherside
random building turning works (ca mex's have them)

but imo it was one of the most random crappy things in OTA that i dont miss it ruined base unity and now that you got directional building its made more redundant.

tho diagonal buildings would be awesome (if it could work with labs to)

Re: build angles

Posted: 29 Jul 2009, 19:32
by zwzsg
Caydr wrote:
Argh wrote:You can do it in BOS as described, though
Caydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
Don't use a bos script to turn a piece. Use a Lua script to turn the unit whole.

Re: build angles

Posted: 29 Jul 2009, 23:48
by CarRepairer
zwzsg wrote:
Caydr wrote:
Argh wrote:You can do it in BOS as described, though
Caydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
Don't use a bos script to turn a piece. Use a Lua script to turn the unit whole.
If you did it with lua, I think structures should only be turned in one of the four cardinal directions, otherwise their texture becomes garbled. This doesn't apply to turning the base in cob.