build angles

build angles

Requests for features in the spring code.

Moderator: Moderators

User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

build angles

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

You can do this with anything except for Factories via script.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Why not for factories? It was just a graphical effect anyway, the yardmap would remain the same.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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).
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

Argh wrote:You can do this with anything except for Factories via script.
How?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Isn't that obvious? Just rotate the appropriate pieces.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Create()
{
var startangle;
startangle = RAND(1,90)
turn base to y-axis <startangle> NOW;
}
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post 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.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

I'm not sure buildings obey heading though.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post 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
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

someone pls make a patch so it reads the buildangle?
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: build angles

Post 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?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: build angles

Post 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.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: build angles

Post by Gota »

Will it still be noticeable?I remember solars in ota sometimes turned a lot.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: build angles

Post by smoth »

They didn't turn that much.

argh is speaking the truth though, script based is the way to go.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: build angles

Post 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!
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: build angles

Post 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.
Last edited by Caydr on 29 Jul 2009, 18:08, edited 4 times in total.
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: build angles

Post 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)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: build angles

Post 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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: build angles

Post 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.
Post Reply

Return to “Feature Requests”