YesNoOk
avatar

Helpers that push helpers (Read 4218 times)

Started by JustNoPoint, October 21, 2016, 04:44:44 am
Share this topic:
Helpers that push helpers
#1  October 21, 2016, 04:44:44 am
  • ******
    • www.justnopoint.com/
I have a move where a helper is sent off and plants itself into a certain position. How could I make it so that if another one is fired into the same location or near it they would push away from each other a bit.

I can't figure out how my helper can detect another of it's kind's position so I can set a VelAdd
Re: Helpers that push helpers
#2  October 21, 2016, 04:53:39 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Make helper 2 a child of helper 1 by having helper 1 spawn it, and use calculations based on helper 1's width.
Re: Helpers that push helpers
#3  October 21, 2016, 05:17:28 am
  • ******
    • www.justnopoint.com/
Crap, I got confused on this because you can have like 5 of these things out at once.

So help me with the logic here please:

Root goes to state 1700 and fires a helper. The helper has a trigger preventing another to be fired thus allowing the root's anim to still play. When root does the anim again the helper creates a new helper. I'm good here.

BUT when a third one is made it will only push against it's own parent, correct? It wouldn't push against the 1st one.

I'm trying to think of workarounds where the 2nd helper gets the distance from it's parent and does something make it's helper look like it's pushing the 1st. But it's really putting a number on me :P

Re: Helpers that push helpers
#4  October 21, 2016, 05:32:45 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
You could keep track of the parent's parent's positions and crap by using variables as a workaround for multiple redirection. You can even loop back if you use a new variable for each iteration of the helper. I doubt you'll have that many on screen at once.
Re: Helpers that push helpers
#5  October 21, 2016, 05:46:27 am
  • ******
    • www.justnopoint.com/
Can the helper chain read the other parent's vars or would I need to set RootVars(by ParentVar setting back to root since there is no rootvar)?
Re: Helpers that push helpers
#6  October 21, 2016, 05:52:12 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Parent vars will work fine if you don't overwrite the previous vars.


Think of it as a loop over NumHelper(x). You'll set the NumHelper(x)-1th variable for each child. Then Var(0) will always point to the "root" helper's because Var(0) in the child will always point to Var(0) of its parent, and so on.

Something like:

Code:
[State x, VarSet]
trigger1 = NumHelper(x)-1 >= 1
var(0) = ifElse(NumHelper(x)-1 == 1, Parent, Pos X, Parent, Var(0))
[State x, VarSet]
trigger1 = NumHelper(x)-1 >= 2
var(1) = ifElse(NumHelper(x)-1 == 2, Parent, Pos X, Parent, Var(1))
[State x, VarSet]
trigger1 = NumHelper(x)-1 >= 3
var(2) = ifElse(NumHelper(x)-1 == 3, Parent, Pos X, Parent, Var(2))
;... do this for the other 57 variables

[State x, VarSet]
type = VarSet
trigger1 = 1
v = NumHelper(x)-1
value = Parent, Pos X
; ... other similar variables you need to store in the same way to retrieve positions
Last Edit: October 21, 2016, 06:00:45 am by Jesuszilla
Re: Helpers that push helpers
#7  October 21, 2016, 09:38:41 pm
  • ******
    • www.justnopoint.com/
This causes errors when the chain is broken.

I'm kind of burned out at the moment but instead of Helper creates Helper remind me if helpers can read other helper's vars?

Like

trigger1 = NumHelper(x)
trigger1 = helper(x), Var(x)

If that's the case couldn't I make a unique var for each one that stores it's Pos and if the helper get's near that pos it triggers a velset? Then when it is x distance away it triggers another to stop moving?

Each projectile would have to have their own unique ID/stateno as well. And they'd all work with each other to move about using their Pos/Vars.

But it relies on them being able to read each other's vars and I forget if they can do that. Otherwise I may have to use the root's vars to store the ifo and that's a lot of vars to use up :/

I'll try later. Too burned out from messing with this all day long, get it working, and a chain break mess it all up.
Re: Helpers that push helpers
#8  October 21, 2016, 10:15:51 pm
  • ******
    • www.justnopoint.com/
So JMM has been soundboarding with me and came up with this possibility too

Posting here to help the solution along I won't be able to work on it again for the next 3 days

Quote
Lets say theres an invisible helper named ballmaker2000; its created when the match starts and always exists. Whenever the character performs the move that shoots a ball projectile, ballmaker2000 does the actual work: it creates each helper projectile, and the root never has to waste any variables to keep track of anything.

Ballmaker2000 has 7 variables of its own. The first is a count of how many active energy balls are out (max of 3); if this variable is less than 3 then the root can perform the ball summon move. The other six variables are the x and y positions of the three balls. Whenever a new ball is created, ballmaker2000 starts tracking its position using the first available set of position variables. When a ball is destroyed, ballmaker2000 clears out the respective position vars and removes one from the ball count variable.

The actual ball helpers themselves can look at their parent (ballmaker2000) to figure out the other ball's positions. They dont need to store the values themselves, or keep track of how many balls exist. They can just refer back to ballmaker2000 to figure out 1:if any other balls exist, and if so 2:if so, compare own position to the parent variables determining position of the other balls

The order the balls are created in doesnt matter, ballmaker2000 can just find the first set of open position vars

The balls themselves can look at ballmaker2000 and figure out if they need to do any collision detection and what set of position vars to compare against its own position

I guess the ball maker doesnt need a dedicated variable to keep track of how many helpers exist
But im not positive because i foget how numhelpers works in helpers

If it just looks at the total number of helpers the player has or if it correctly narrows it doen depending on what calls numhelper
Re: Helpers that push helpers
#9  October 22, 2016, 12:04:49 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
So much ball talk

I think Helper(ID), only works for the player who created the Helper?  So if this just isn't working for you it would be because it would instead have to be root,helper(id),var(xx)   Obviously a no-go

So the BALLS could give their PlayerID to the Ball Master: parentvarset >>> ID

Then redirect to them using PlayerID(parent,var(xx)),

Re: Helpers that push helpers
#10  October 22, 2016, 11:36:19 pm
  • *****
  • Shame on you!
    • USA
So an idea I had it to must make an attack. It only affects team.
I'm not sure what your helper is doing or can do, but if it goes back to the same state, you could have that one state have the attack in it.
if the attack connect, then you know your helpers are touching. The hitdef for each attack could be active ONLY if numhelper(718) was active or whatever. Miiiight be able to use chainID too. but idk. I think there's something along those lines.
You could just send out a projectile that does this at the first tic of the idle stance for the helper, if that stance is for a helper. ;)
It'd send what ever using the velocity or a custom gtfo state.

Also, with ballmaker2000
say var1 is the how many ball keep tracker variable. and you have a blue, green, and red ball that can be made.
blue = 1, green = 10, and red =100
so if you had 1 red and 1 blue ball,
var 1 = 101
if you had 2 green
var 1 = 20.
you can keep track of how many and what colors using this technique. (up to 9 each color) Though a simple check to see how many helpers are active would require some math, instead of seeing var 1 = 2.

I may be able to try my hand at figuring this out in a bit.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Helpers that push helpers
#11  October 24, 2016, 01:58:03 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
JNP. If you need rootvarset because there is a chain. Spawn a projectile, set the variable off it's existence. You can even spawn the projectile with a unique ID to set the variable to different values. Projectiles are instantly owned by the root, so any helper down the chain can create them and the value will be instantly referred to P1.

You can also do rootvaradd by creating the projectile over and over again until you no longer want to add to the var.

At this point i no longer understand the attack itself. A screenshot would be helpful as there may be a really really simple way to do this.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Helpers that push helpers
#12  October 24, 2016, 02:29:37 am
  • ******
  • If you’re gonna reach for a star...
  • reach for the lowest one you can.
    • USA
    • network.mugenguild.com/jmorphman
I think it's best to avoid situations involving long chains of helpers, especially in a move where there's potential for that chain to be broken (via one of the projectiles getting hit and dying). That's why I think having a central helper that spawns all the various projectiles would work best; it can read every projectile's positions, track how many projectiles are active, and it could even do all the collision detection calculations and then pass on the actions each individual projectile needs to take based on those calculations.
Re: testicles that push testicles
#13  October 24, 2016, 02:43:23 am
  • ******
    • www.justnopoint.com/
It'd work best for another reason too. Piccolo has a super move called HellZone Grenade where he makes many of these balls fly into a cloud (now called ball heaven for this post) of them in the air. And then they rain down onto P2. Any of the normal ones that he had set out will be influenced and go to ball heaven to join it's friends as they rain down.

Below are visuals of 2 balls hanging in their resting places. Piccolo fires them into the air. They cannot hit or push till they are active(shown here). He can fire one into the same location as another. When it becomes active they slowly repel each other till thy get far enough away.

Re: Helpers that push helpers
#14  October 24, 2016, 03:11:00 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Also noteworthy is that the left ball is hanging lower than the right, as is testically statistically normal

Re: Helpers that push helpers
#15  October 27, 2016, 07:01:04 am
  • ******
    • www.justnopoint.com/
Okay so I've kinda got this. And kinda don't.

I must be making a math error somewhere (I'm pretty crappy at math anyway). I apologize for the headache this will give you
Spoiler, click to toggle visibilty
Above is the code that move the balls away from each other. It works fine. My issue is I can't get both to stop where I want.

This works
 
Spoiler, click to toggle visibilty
They both stop
But the one going to the right stops too far

I try to make it stop closer with this
Spoiler, click to toggle visibilty

Doesn't work

I can't for the life of me figure out what I'n doing wrong. I've tried a ton of other variants too
Re: Helpers that push helpers
#16  October 27, 2016, 08:39:50 am
  • *****
  • Shame on you!
    • USA
could it be that magical 0 point in the middle of the map? Once it goes from -1 to +1 is your math ok? like a Facing problem?

 I know you said you tried it other ways too. Have you tried dropping the 132 to say 102 and seeing if it stops sooner?

The push away code has -31 and +32. The stop code uses -32 and +32. should it be +33?
vVv Ryuko718 Updated 10/31/22 vVv
Re: Helpers that push helpers
#17  October 27, 2016, 05:55:52 pm
  • ******
    • www.justnopoint.com/
AGH this is the most annoying thing I've ever had to code. WTF

So further testing the pushing code wasn't even working correctly with all 3 balls.

I don't even know how to explain all the issues because I can't even figure out the logic.

I've tried tons of things so I'll try to explain what everything does instead.

Here is the current blocks of code I'd been trying to get correct.

This part should make the ball go to the left when it gets too close to the right of another
Var(20),(21), and(22) simply tell the helpers when the ball is active and should push
Var(10) is ball 1750's pos x, Var(11) is ball 1752's pos x, and Var(12) is ball 1753's pos x
Spoiler, click to toggle visibilty

This block is to get a ball to move to the right when being close to one on the left
Spoiler, click to toggle visibilty

Now what is happening is that they work perfect in the center of the stage

I go to the left and fire one then fire another in that location and they push as they should, then the one going the opposite direction stops and starts chasing the other one.

If I do it on the right it's the same thing.

If I fire 1 to the middle of the stage
go to the right and try to repeat what I said above the ball doesn't give chase. It will keep going till it touches the 1st and then that one stays in front and starts running away from the one chasing it.

I don't know why any of this is happening. I have tried so many variants of the order. Different numbers, etc
I don't even remember all the ways I've tried.

This is driving me crazy.

Edit: note, at this point I'm not worried about getting them to stop after moving. Just getting the repel portion to work correctly
Last Edit: October 27, 2016, 06:14:31 pm by Just No Point
Re: Helpers that push helpers
#18  October 27, 2016, 06:13:52 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
How about try:
abs(Pos x - parent,var(11)) < 32

This triggers if the Pos difference is less than 32.

I don't think facing is an issue with this... if it is, changing everything to Screenpos X should fix that.

**EDIT** Oh, and for the Vel value maybe you can get away with:

x = -Vel X

If this works I believe, with my other suggestion, you can consolidate it to one controller to handle both left and right collisions

Last Edit: October 27, 2016, 06:33:56 pm by altoiddealer
Re: Helpers that push helpers
#19  October 27, 2016, 06:51:05 pm
  • ******
    • www.justnopoint.com/
WAIT! I think I may have solved the issue! I wasn't thinking. By default when a ball didn't exist their Pos Var would be 0

So that's why the ball would turn around when the 3rd wasn't there.

Because it'd get near the center of the screen (pos x = 0) and turn the other way.

I fixed this by adding a NumHelper(xxxx) trigger to be sure to ONLY trigger if the pos var AND helper are active. MUGEN shows me how dumb I can be far too often!
Re: Helpers that push helpers
#20  October 27, 2016, 08:13:59 pm
  • ******
    • www.justnopoint.com/
I think this is the last issue I need to resolve for this.

Spoiler, click to toggle visibilty

Right now the 3rd one doesn't get repelled. I believe it is because it's also true that it's too far from the other one it's not near. Thus the velset of 0 is triggering. But I'm not sure what I should do to make it only be true when near a var and ignore the other that's far.

Edit: I'll probably have to try adding conditions with && to tell it to set velocity to 0 when near the var and Not near another var
Last Edit: October 27, 2016, 08:37:15 pm by Just No Point