Change in .bos .cob behavior!

Change in .bos .cob behavior!

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

Moderator: Moderators

Post Reply
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Change in .bos .cob behavior!

Post by Noruas »

Once upon a time before this version of spring, there was a script written, that allowed hovercrafts to turn and angle with the turns to barrel. This script worked visually well, hovers looked far more animated and realistic... but then a problem arises of course.

So I asked D_B for help and his wisdom always help me, here is the chat i had with him.
[21:17:52] <Noruas> omg D_B are you here?
[21:18:04] <Noruas> its noruas i have a question for you sortof...
[21:19:00] <D_B> sup?
[21:19:19] <Noruas> do you know any changes that delt with .cob or .bos this spring release?
[21:19:31] <D_B> as far as I know, none
[21:20:02] <Noruas> i asked for help on the forum but people have not given any input of sorts... the hovercrafts in xta? have you seen them rock and tilt before as they turn?
[21:20:22] <D_B> not really
[21:20:33] <D_B> hovercraft use to be upright=1 by default
[21:20:52] <Noruas> i wrote a script in bos that detected turns and tilted the hovers accordingly
[21:21:03] <Noruas> with turns erm...
[21:21:19] <Noruas> but for some reason now they tilt all the way over and barrel roll... when they turn
[21:21:25] <D_B> cool, I might STE...er borrow that
[21:21:31] <D_B> hmm
[21:21:42] <D_B> the devs may have broken something inadvertently
[21:21:47] <D_B> I would check with lurker
[21:22:32] <Noruas> http://springrts.com/phpbb/viewtopic.ph ... &start=920 i made the post, its the last one on the page... i should probably repost...
[21:23:23] <D_B> This sort of thing belongs in teh dev forum as you suspect it is a broken bit in the new spring
[21:23:51] <Noruas> not the help and bugs section?
[21:24:04] <D_B> nope
[21:24:07] <D_B> I'd post in devs
[21:24:14] <D_B> ask specificly if they meddled with bos
[21:24:19] <D_B> then post your code
[21:24:25] <D_B> say how it used to function
[21:24:28] <D_B> and how it functions now
[21:24:37] <D_B> if you get any shit blame me for telling you to post tehre
[21:25:04] <Noruas> nah ill blame smoth...
[21:25:26] <D_B> lol k
[21:25:39] <D_B> good luck sorry I could not help more
Just so you know this post is smoths fault.

Just download the latest xta file from jobjol and make a hovercraft plateform and tell the hovers to turn, and they will start doing barrel roles. They never did this before so its assumed a new bug or an engine change went unreported.

Code: Select all

#include "sfxtype.h"
#include "exptype.h"

piece base, beam, nanogun, door1, door2, plate, post, wake1,
wake2, wake3, wake4, wake5, wake6, wake7, wake8, turret;

static-var Static_Var_1, Static_Var_2, statechg_DesiredState, statechg_StateChanging, Static_Var_5,
Static_Var_6, Static_Var_7;

// Signal definitions
#define SIG_MOVE 2


BankClerck(Func_Var_1, Func_Var_2, Func_Var_3)
{
while( TRUE )
{
Func_Var_1 = get PIECE_XZ(base);
Func_Var_3 = 0;
if( get XZ_HYPOT(Func_Var_1 - Func_Var_2) >= 163840 )
{
Func_Var_3 = 0 - get XZ_ATAN(Func_Var_2 - Func_Var_1) * 60 / 30;
}
turn base to z-axis Func_Var_3 speed <45.0>;
Func_Var_2 = Func_Var_1;
sleep 300;
}
return (0);
}

WobbleUnit()
{
while( get BUILD_PERCENT_LEFT )
{
sleep 400;
}
while( TRUE )
{
if( Static_Var_7 == 1 )
{
move base to y-axis [1.8] speed [1.0];
}
if( Static_Var_7 == 0 )
{
move base to y-axis [0.8] speed [1.0];
}
Static_Var_7 = !Static_Var_7;
sleep 750;
}
return (0);
}

Create()
{
Static_Var_5 = 1;
Static_Var_2 = 0;
start-script WobbleUnit();
start-script BankClerck();
return (0);
}
This is the part of the script that is doing all the barrel roles. If you never seen this before, try with the latest spring, and then try Xta hovers on all older spring releases and the obvious change in behavior is obvious.

Thank you...
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

Do a barrel roll!

Seriously, if you get this worked out, I've got to steal it, that sounds way cool :-)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change in .bos .cob behavior!

Post by Argh »

Hmm.

After doing some tests, it looks like upright is broken, for hovercraft at the very least. Could explain part of the weirdness, but there's got to be more going on.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Change in .bos .cob behavior!

Post by FLOZi »

Something about hovercraft and upright and hardcodedness jogs a painful memory.

If only I could remember it.

btw, on an offchance:

Code: Select all

Func_Var_3 = 0;
if( get XZ_HYPOT(Func_Var_1 - Func_Var_2) >= 163840 )
Looks suspicious, as Func_Var_2 hasn't been initialised there. Also, use better variable names.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Change in .bos .cob behavior!

Post by Tobi »

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

Are you fucking kidding me??? I can't even set upright to false via cob anymore?!?!? That completely breaks evo!

FUCKING RAEG!

Edit: *Sigh* Testing Fail :-/ I'm an idiot.
Last edited by Forboding Angel on 09 Feb 2010, 19:03, edited 1 time in total.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Change in .bos .cob behavior!

Post by Tobi »

What the heck are you talking about?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Change in .bos .cob behavior!

Post by KDR_11k »

Forboding Angel wrote:
Are you fucking kidding me??? I can't even set upright to false via cob anymore?!?!? That completely breaks evo!

FUCKING RAEG!
No, that still works. Test before you rage.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

I did, and that's when I started raeging. Because I sent 5 heavytanks up a steep hill and those bastards stayed upright 1. But I didn't test well enough, so it's my own fault. I had forgotten that if the unit is given on x types of terrain sometime the script doesn't initialize properly. My bad.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change in .bos .cob behavior!

Post by Argh »

OK, so we can set it via script, but not in the TDF?

Well, that's... fixable.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Change in .bos .cob behavior!

Post by KDR_11k »

You don't want to set it outside of the script because over water the hover follows the seafloor contours, that's the reason upright=1 is default for hovers.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change in .bos .cob behavior!

Post by Argh »

Righto, i.e., just do a check over water, set to upright, voila. I'll have to see if that causes barrel-rolls over here ;)
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Change in .bos .cob behavior!

Post by Tobi »

Fixed.

(Curiously same cause as the GCC 4.3 vs GCC 4.4 desync, although the bugs are unrelated. See mantis for details.)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

Argh wrote:Righto, i.e., just do a check over water, set to upright, voila. I'll have to see if that causes barrel-rolls over here ;)
Here ya go :-)

Code: Select all

setSFXoccupy(setSFXoccupy_argument)
{
terraintype = setSFXoccupy_argument;

                if(terraintype == 2)
      {
                move base to y-axis [-0.85] speed [50]; 
                set UPRIGHT to 1;
                }
      else
      {
                move base to y-axis [0.0] speed [50];
                set UPRIGHT to 0;   
                }
                if(terraintype == 4)
      {
                move base to y-axis [0] speed [50];
                set UPRIGHT to 0;   
                }
      else
      {
                move base to y-axis [-0.85] speed [50];
                set UPRIGHT to 1;
                }
}
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Change in .bos .cob behavior!

Post by Argh »

Thanks, that will save some time :-) I'll get to that when I'm done hacking away at P.O.P.S. for the moment...
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

:-) Thank smoth, he wrote it for gundam (DOM I think?). All I did was shamelessly steal it.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Change in .bos .cob behavior!

Post by Gota »

Noruas what about the walking ship script?
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Re: Change in .bos .cob behavior!

Post by Noruas »

Since I wrote the first one by myself I guess I'll rewrite it with Forboding Angel forced upright on sea script so boats actually tilt with terrain <3
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Change in .bos .cob behavior!

Post by Forboding Angel »

Keep in mind that what that code does is check to see what terrain the unit is over. If it is over water, upright=1 is forced, if it is over land upright=0 is forced.

In Evo's case what it does is make hovers behave like tanks on land and when they hit water they act like hovers.
Post Reply

Return to “Engine”