Things; Moving a Precise Distance?

Status
Not open for further replies.

Sparkz

Advanced FOFing Concepts
Well hi again, help board!
O.K. I've been SOCin' for the past few days and I ran into a small snag with another "automotive" device. Getting a spikeball to sweep a straight line, across a desired amount of space. It seemed straight forward but alas, it didn't prove to be. To me there are 3 factors; speed, distance, and time but the SOC language is not inclined to oblique.

The distance is 512 facunits the speed would be about 8 or 9 fu/t. and the duration would be however long it takes to cover the distance. All of these things I would be happy to toggle and adjust 'till everything was just right.

I got the spikeball to appear to cover the 512 f.u. distance with this...

FRAME 1817
SPRITENUMBER = 249
SPRITESUBNUMBER = 0
DURATION = 32
NEXT = 1818
ACTION A_MoveRelative
VAR1 = 90
VAR2 = 48

Here's my dilemma. I have NO idea how 512 f.u. (or anything close to it) can be extrapolated from these numbers. I do understand the VAR2 is "force" not necessarily speed. The same goes for A_MoveAbsolute, which I also tried.

I got what appears to be my desired results by tweaking, almost random numbers but no clear path to how I got there.

With all that said, my question is; Can I program actors to move more precisely and SOC things like this with more confidence in the results? A clearer understanding of "force" and what the numbers mean to it may also help!

On a side note. It boggles my mind how much SOCing is required for the automotive, seemingly unintelligent traps and machines in my landscape, compared to the intelligent behaviors exhibited by some of SRB2 standard enemies.
 
Last edited:
Your duration is 32 tics, your Var2 is 48. 32*48 is 1536, which is 512*3. So I assume that a Var2 of 3 makes the actor travel 1 FU/tic. However, I'm not sure on this. A_MoveRelative uses a function called P_Thrust to move the actor, so I'll look into what P_Thrust does as soon as I can.

The problem here is that the vast majority of actions in SRB2 were coded for very specific purposes, i.e. to get certain enemies or other objects in the game itself to work properly. They weren't designed with customization in mind. Once 2.1 comes around, you can use Lua to code your own actions, but then you'll need to learn how to code.
 
The problem here is that the vast majority of actions in SRB2 were coded for very specific purposes, i.e. to get certain enemies or other objects in the game itself to work properly. They weren't designed with customization in mind. Once 2.1 comes around, you can use Lua to code your own actions, but then you'll need to learn how to code.

I understand and that's totally fair. So now I have a new bad idea! More targets! Each spikeball will spawn a pair of targets on either side to travel between. I have the SOCs all figured out except one key aspect. I'm currently hunting for the best action to smoothly move the spikeballs from one place to another. I started with A_Thrust, as it is the only action I found so far that supposed to let an actor keep it's momentum. I set VAR2 to 0 but the object looses momentum anyway. Am I misunderstanding what "momentum" means here? For the sake of being thorough, I set VAR2 to 1 and got the same result. Yet again, these "force" factors are getting my way. The spikeball jolts forward, slows down and then stops long before reching it's target, or they move too fast and just overshoot their targets. I found myself right back at the beginning, trying to find the right random numbers to move the spikeballs. Surely using a pair of targets, I should be able to get away with this. If anybody knows something I don't, like the best movement action for this purpose, please let me know:D I will continue!
 
Last edited:
Is the spikeball on the ground, or is it floating in the air? If it's the former, then the object is losing its momentum because it's dragging along the ground. You need to give the spikeball MF_NOGRAVITY and set its Z position to, say, 32 fracunits above the sector floor. Both movement states should use A_Thrust with Var1 set to the speed in fracunits per tic and Var2 set to 1. (To my knowledge, all movement actions calculate the speed by multiplying 1 fu/t by the speed variable.)
 
Is the spikeball on the ground, or is it floating in the air? If it's the former, then the object is losing its momentum because it's dragging along the ground. You need to give the spikeball MF_NOGRAVITY and set its Z position to, say, 32 fracunits above the sector floor. Both movement states should use A_Thrust with Var1 set to the speed in fracunits per tic and Var2 set to 1. (To my knowledge, all movement actions calculate the speed by multiplying 1 fu/t by the speed variable.)

OPPS! You're right.

ya know I had the no gravity flag checked but I did leave the objects on the ground. Now all the numbers make perfect sense! A speed of 8, moving in the course of 64 tics will make the object travel the 512 units I needed. However, A_Thrust didn't turn out to be the best movement action. With A_Thrust I needed an extra 2 states to A_Rotate(...) the spikeballs. I settled on A_MoveAbsolute. With that I don't need rotating states and the angle to move the objects is more straight forward.

I also recant the first statement in this post regarding how complicated I thought this would turn out. These spikeballs move just the way I want with three simple states:D Two, if I decide to flag SpawnFuntion.

Thanks a whole lot! The spikeballs are complete! WOOT!
 
Last edited:
OPPS! You're right.

ya know I had the no gravity flag checked but I did leave the objects on the ground. Now all the numbers make perfect sense! A speed of 8, moving in the course of 64 tics will make the object travel the 512 units I needed. However, A_Thrust didn't turn out to be the best movement action. With A_Thrust I needed an extra 2 states to A_Rotate(...) the spikeballs. I settled on A_MoveAbsolute. With that I don't need rotating states and the angle to move the objects is more straight forward.

I also recant the first statement in this post regarding how complicated I thought this would turn out. These spikeballs move just the way I want with three simple states:D Two, if I decide to flag SpawnFuntion.

Thanks a whole lot! The spikeballs are complete! WOOT!

I'm glad that you've completed them, but the reason I suggested A_Thrust is because it can easily send the object moving forwards or backwards. To reverse the thrust, just set Var1 to a negative number. This also lets you change the angle of the path the spikeballs follow by changing the angle of the spikeball object.
 
Last edited:
I'm glad that you've completed them, but the reason I suggested A_Thrust is because it can easily send the object moving forwards or backwards. To reverse the thrust, just set Var1 to a negative number. This also lets you change the angle of the path the spikeblls follow by changing the angle of the spikeball object.

Negative numbers? No kidding:O I never would have thought of that. I'll keep that in mind, and little details like that should help anyone else looking through the forums for answers.

I flagged the spikeballs with their spawn function so most of them only need 2 states to do what they do. It's so simple and elegant!
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top