Scaling an opponent, who has a different local coordinate space

Started by altoiddealer, October 26, 2015, 11:14:53 PM

Previous topic - Next topic

altoiddealer

My character has a hyper move, which scales an opponent down.

I'm having an issue when performing this move against characters with a greater local coordinate space than mine (my character has localcoord = 320,240)


Against a character with localcoord = 640,480:

When I scale the enemy with AngleDraw within the custom state, the scale factor is correct.

However, if I spawn Explods within the custom state, the anims do not scale properly.

The problem is, I need to draw the enemy using Explods.  This is for the "Arcade Hyper" which has the player move around in the middle of the screen.


Both controllers use the same formula:

scale = (18.0/(Const(size.mid.pos.y)*-2.0)),(18.0/(Const(size.mid.pos.y)*-2.0))


...Any idea how I can get the Explods to scale properly?

I tried wrapping everything in Const240p() which had no effect.


*Edit*

Against this particular character, the result should be "0.06122" (his mid.pos.y is -147).

What appears to be happening, is that it is calculating as if his mid.pos.y = -73.5 (half)

Assigning 0.06122 manually, it scales properly.

And as I stated previously, using the equation in the AngleDraw seems to be producing the correct result (0.06122)


Rent

I think there is a ModifyExplod controller that you can use to scale the existing explods
wat.

altoiddealer

Quote from: Rent on October 27, 2015, 12:31:34 AM
I think there is a ModifyExplod controller that you can use to scale the existing explods

I'm sure whatever detection/code that could be used for this, could just be factored into the original Scale parameter.

I'm just having a hard time figuring out how to factor the enemy's local coordinate space into the equation



Odb718

Somehow I managed to reply to the wrong thread <_<
I know you've been up on the mugen class section pretty often; have you seen this http://mugenguild.com/forum/topics/const240p-const480p-const720p-triggers-169138.0.html
rice seems to mention something that's happening to you, I think.

also, can you do something like enemynear, Const240p(3) = 3 or maybe target, const240p(3) = 3?

----
maybe
[State 0, VarSet]
type = VarSet
trigger1 = numtarget
v = 10
value = target,Const240p(1)+target,Const480p(2)+target,Const720p(3)

If my thinking is correct you'll get a value of 1, 2, or 3. Then you'll know the values to use, or you may just make the value you need be the var's output and utilize the var in the math for the effect.

--------
double edit. Messing around with that idea gives me nothing.
Using

[State 0, VarSet]
type = VarSet
trigger1 = numtarget 
fv = 19
value = (target,Const480p(24))

I get the value 48 if my P1 is 720, 24 if it's 480, and 12 if it's 240. It doesnt matter about P2;  Enemy, Target, nothing returns P2's info. I only get P1's info. I'm not sure if you put them into a custom state if you'll be able to pull the info then or not.
vVv Gouken718 vVv SabreTooth718 vVv


altoiddealer

Thanks for trying to help me out here.

That's not good news!  I was tossing it around in my head last night and that was basically the next thing I was going to try.

I actually did try to redirect Const240p trigger to snag a value, but the enemy was already in a custom state.  Even when they are not in one... I think my effort might be futile here.


So far, it seems to me like all values get scaled when chars with different local coords fight each other, but for Explods, the X scale and Y scale from the character's data is neglected :(


altoiddealer

I have an idea I can test out when I get home...

Since I know the AngleDraw controller in the custom state IS taking the enemy's local coordinates into account, well, I'm not sure if AngleDraw might also affect the value I would get from a trigger from my player, such as:
target(2000),Const(size.yscale)

Meaning, I use the AngleDraw controller, even though the Player is actually invisible, just to calculate the value.

Because I can't think of any other way I could possibly get the value returned by the AngleDraw controller, to use for creating the properly scaled Explods.


Noctis

Maybe I didn't read this right, but...AngleDraw has never worked on explods. That's why there's a ModifyExplod. It's the equivalent (and much more) to a character's AngleDraw so if you're using explods with angledraws then you're never going to get this to work.

Does it have to be an explod? Helper's are much more easier to control.
Have your tried vars, too? Put your equation in a var in the custom state your enemy goes into and when that enemy goes into the custom state and that value gets set to what it is you want (which should be in an instant), play the explod with the scale set to that var. scale = var(whatever),var(whatever). Then reset that var after the explod has been played or whenever works best for you to have it reset.
Or are you not using custom states? You're just straight up playing explods and nothing more?
And another thing. Have you tried reading the specific enemy near you? enemynear(0) or enemynear(1)? Enemynear(1) is only usable if there's more than 2 enemies and you have a numenemy >= 2 trigger before it. Meaning enemynear(0) is p2 (the p1 enemy) and enemynear(1) is p4 (the p2 enemy).

Also, the reason it read your value half of what you had is because their localcord was double of what yours was. So whatever it takes for your head.pos to be at -147, they would only need half as much as that. If theirs was at -147 too despie their localcord then they'd have their head.pos twice as high as yours.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

altoiddealer

When I put an enemy into a custom state, an enemy who has X/Y Scale values of "1", but who has a local coordinate space greater than my character...

In the custom state:

type = AngleDraw
scale = (18.0/(Const(size.mid.pos.y)*-2.0)),(18.0/(Const(size.mid.pos.y)*-2.0))

This seems to factor the enemy's local coords, because it displays the character at the expected scale.

type = Explod
scale = (18.0/(Const(size.mid.pos.y)*-2.0)),(18.0/(Const(size.mid.pos.y)*-2.0))

This does not seem to be taking into account the enemy's local coordinate space, because he is being drawn 2x larger than expected.


The same thing happens when I try this method

From my character's state...

type = varset
fvar(58) = (18.0/(target(2000),Const(size.mid.pos.y)*-2.0))

And in the custom state...

type = Explod
scale = PlayerID(GetHitVar(fall.envshake.ampl)),fvar(58) ;I attach my player's ID to the HitDef using "envshake.ampl = ID"


Leading me to believe that, in regards to the enemy's scale factor while in a custom state, the enemy's local coordinates are only taken into account with the AngleDraw controller and for nothing else

When I get home, I plan on testing to see if AngleDraw has any affect on what would be returned from a "Const(size.scale.y)" trigger.  Other than this, I'm running out of ideas



The reason I am drawing the enemy using Explods for this particular move, is I am making the player move around in the middle of the screen.  If I position them/move them normally using ChangeAnims etc, they are affected by the stage's Y movement (for stages that move up and down).  As far as I can tell, regardless of what Physics are specified in the StateDef, a Player-type character is affected by this movement no matter what.  So every time I squash a bug, I seem to be running right smack into another one.

For reference purposes... but note that these clips don't show my current issue regarding the local coordinates:

Video showing the move using Explods

Video showing the move using normal ChangeAnims


Noctis

If I think of something I'll fill you in myself, but if it's twice as large as expected then you're saying it is working, it's just still too big? If that's the case then the explod IS taking into consideration the localcord and the reason it's twice as large as expected is the exact same reason as stated before with the head.pos. You'll simply have to fix the equation to work with their localcords. I don't understand why it wouldn't work if you just did like...a var to set to their localcord by using the const240p and so on triggers and then redirecting the scale to said var's value.

Okay so I tried out a few things and this is what I got. I used fvar(39) for this.

[State 0, VarSet]
type = VarSet
trigger1 = enemynear,const240p(3)
fvar(39) = enemynear,const240p(3)
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = enemynear,const480p(6)
fvar(39) = enemynear,const480p(6)
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = enemynear,const720p(12)
fvar(39) = enemynear,const720p(12)
ignorehitpause = 1


Then the scale...
ifelse(fvar(39)=3.0,(18.0/(Const(size.mid.pos.y)*-2.0)),ifelse(fvar(39)=6.0,(36.0/(Const(size.mid.pos.y)*-2.0)),(72.0/(Const(size.mid.pos.y)*-2.0)))),ifelse(fvar(39)=3.0,(18.0/(Const(size.mid.pos.y)*-2.0)),ifelse(fvar(39)=6.0,(36.0/(Const(size.mid.pos.y)*-2.0)),(72.0/(Const(size.mid.pos.y)*-2.0))))

I didn't use it on an explod, but it works with AngleDraw. No matter which one I put the localcord too, they always come out the exact same scale.
Tried it on an explod all in my -2 statedef. Works just fine. It's not read as soon as the match starts so if that's important to you at all, set all the vars in state 5900 along with the explod (just for future reference. I know you don't need this to work asap in a match).
Lemme know if it does anything for yah!

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

altoiddealer

Noctis,

I think you're definitely onto something here.

Per ODB's suggestion, I was trying to log a local coord value from the enemy, but I was accidentally using "Var" instead of "fvar" which is probably why nothing was happening.

So with your suggestion, I'm getting results.  I need to play around with it later because some part of the calculation just doesn't seem right (enemy is now 4x bigger than expected :))

One issue I'm now having, though, is debug spam "Set var out of range (39)"


Odb718

What? Are you guys on 1.1 because I was using 1.0 and it wasnt working. I even tried enemynear,
and yes, I switched to fvar once I got debug flood.
vVv Gouken718 vVv SabreTooth718 vVv


Noctis

Hmm...I'm not sure what I did to make it work for me, but it works! I used fvar simply because I had it read the constp instead of values 1, 2 or 3 because for some reason it would simply set itself to 3 no matter what the triggers were and it was really confusing. And the var shouldn't be out of range. I believe it only goes up to 40 or something so that's a little weird.... As for the scaling. I just left the scaling if the var was set to 3.0 (240p), doubled it if it was 6.0 (480p) and doubled it from the already doubled value if it was 12.0 (720p). That was 18, 36, 72.

Since my fvar was messed up I may have simply been getting the same scale because of that and it wasn't actually working so I'll have to go back to the drawing board, but after I get back from work. I should be able to get it working, though. I just have to ensure the varsets are read correctly.
Then again, I was watching the fvar and it was indeed being set properly and it wasn't out of range.....maybe there's something else going wrong here.

And I was using 1.0. No errors at all aside from the switch from a var to an fvar due to it trying to read decimals.

Edit:
I've never used the const240p triggers and so on and after quickly reading RicePigeon's mugen class thread it became a LITTLE bit clear, but I still don't think I understand it. Can the character be a 240p with any localcord? Or is 240p one specific localcord? 320x240?
Because he said 240p is "this" and then said it'll return this value if the localcord is this, but it didn't seem to work the way he explained.
I think it's only 240p and returns a value of 3 if the localcord is 320x240, 480p is 6 and 640x480 and 12 & 1280x720 is 720p.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

altoiddealer

The way I think it works, is I can use something like

[State -2, VarSet]
type = VarSet
trigger1 = numenemy
fvar(39) = enemynear,const240p(1.0)
ignorehitpause = 1

Which I believe would return a value of 0.5 if the enemy has a local cord of 480p (and 1.0 for 240p, and 0.25 for 720p)

Which I could then use like:

scale = (18.0/(Const(size.mid.pos.y)*-2.0))*fvar(39),(18.0/(Const(size.mid.pos.y)*-2.0))*fvar(39)

Obviously coding it differently because the above could not be used within the custom state.


The "out of range" might be because I did not include ".0" - I'm not home atm to test this.


Really appreciate the help guys, hopefully can get this issue wrapped up 100% tonight.  Will report back


altoiddealer

#13
Unfortunately, I don't think this is working after all :(

[State -2, 1]
type = VarSet
trigger1 = numenemy
trigger1 = enemynear,Const240p(1.0) = 1.0
fvar(39) = 1.0
ignorehitpause = 1

[State -2, 2]
type = VarSet
trigger1 = numenemy
trigger1 = enemynear,Const480p(1.0) = 1.0
fvar(39) = 2.0
ignorehitpause = 1

[State -2, 3]
type = VarSet
trigger1 = numenemy
trigger1 = enemynear,Const720p(1.0) = 1.0
fvar(39) = 3.0
ignorehitpause = 1

Regardless of what the enemy's local coordinate space is, the first controller is the only one triggering.

I know this because I basically just tacked *fvar(39) onto my equation, and I can tell that the first one is always the one triggering.

And I would expect that the second controller would trigger if the enemy had local coords 480p - which is just not happening.

So whatever results I experienced earlier, were not due to a detection of a particular local coordinate space - it was just the controller with higher priority.

So I'm again at a loss


And I just nuked one of my previous thoughts.  After some testing, I found that applying Scale with AngleDraw has no effect on the value returned by Const(size.yscale) - If it had some effect on that value, that could have been a solution.


Noctis

Well I noticed that setting a var to a value when you read what their localcord is doesn't work at all, but setting the value to their localcord when you read what their localcord does work. Maybe a glitch or something we're doing wrong? Either way. When it reads the localcord of 320x240 which is 240p, it's 3.0. The next is 6.0 and then 12.0.
Also, to retain this value even when they're in a custom state, have two fvars read it constantly or just at the beginning of the fight. Don't ever reset it throughout the match. One for enemynear(0) and one for enemynear(1) if numenemy >= 2.
Then have it play the scaling based off of which opponent you have i.e play the var scaling for that specific enemy.
Another thing. People like to compact their equations into one equation as opposed to multiple equations like the one I posted with the ifelse's, but if it works then it works y'know? And it's working for me 100%. When I have the time I'll even try it on an enemy with an explod in the custom state, but it should work.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

altoiddealer

#15
I don't know man, I really don't think this is working.

The Const trigger does not seem to be detecting what the Player's local coordinate space is.

As far as I can tell, it is only converting whatever number is in the parenthesis to the current game space.

[State -2, 1]
type = VarSet
trigger1 = numenemy
fvar(39) = enemynear,Const240p(1.0)
ignorehitpause = 1

The above code seems to always return 1.0 regardless of the enemy's local coordinates, since the game space I am playing in is 320x240.

[State -2, 1]
type = VarSet
trigger1 = numenemy
fvar(39) = enemynear,Const240p(enemynear,Const(size.mid.pos.y))
ignorehitpause = 1

The above code will not convert the enemy's data, it will just return the value

So I don't know how this could be useful in my case, if the same value is returned against every player.  I believe this code is only useful to someone trying to make their own character more dynamic depending on what space they are in - meaning, the author uses the appropriate code depending on what their character's local coordinates are (a character with local coordinates 720x480 would always use "Const480p()" in their code.)


I haven't tested yet, but I imagine that all Const(**) triggers redirected to the enemy, simply do not factor in their local coordinate space.  AngleDraw seems to be the only way to scale an enemy in a custom state, while factoring their local coords.


ALSO - I don't think 3, 6, 9 are magic numbers; they just happen to be the example used in the docs.  To my understanding, Const240p(1) can return either 1, 2, or 3.  Const240p(2) can return either 2, 4, or 6.   Const240p(4) can return 4, 8, or 12. ...Etc


Noctis

These triggers are rather difficult to grasp. If you set a const240p(3) >= 3 as a trigger for a varadd, it'll add. If you set it to const240p(2) >= 3, it won't add. What's the damn value in the parenthesis for? Why are you setting it yourself instead of this trigger being used to READ what that value should be? It's really hard to grasp something when you already have an idea of what it does in your mind, but that idea is completely wrong x.x
But yeah this won't work. Idk what I was doing earlier but it had the illusion that it worked.
I'm trying to figure it out now or even figure out another way to determine a player's localcoords by things such as their default walk.fwd velsets and whatnot seeing as velsets would also have to be double every time the localcoord goes up or you'll go super damn slow. So you might be able to work with that, but it's not fullproof. Maybe someone has some character out there with super damn high walk.fwd velsets for whatever reason <_<
Or if someone is having a normal sized character with a localcoord of 1280x720. Their velsets won't be doubled but stay the same or they'll move super fast.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

Odb718

I didnt read your last paragraph noctis, but that's not how it works.
It's doing math TIMES the value in the parenthesis. If the localcoord = 240, and the Const is set to 240 then it's 1x1.
break down like this
240p(24) & localcoord240     == 24
240p(24) & localcoord480     == 48
240p(24) & localcoord720     == 96

480p(24) & localcoord240     == 12
480p(24) & localcoord480     == 24
480p(24) & localcoord720     == 48

720p(24) & localcoord240     == 6
720p(24) & localcoord480     == 12
720p(24) & localcoord720     == 24

I believe it's [LocalCoord/Const(Y)=X | Then it's Y*X]
^^^^ These values might be reversed. I'm pretty sure this is the right set up for the values. I was using (12) when I tested.

I tried setting the values durring SFP with target, enemy, enemynear, all of the ones I could think of.
If 3 attempts to set the value, the last one was written (they were all probably written in 1 tic so I only got to see the last one stay)
I would move the last one to the top, the middle- now bottom, would stick.

I tested against my Ryu, 240; My Sagat, 480; and my Samus; 720. All replied Ryu's values because he was who I had the code in.

vVv Gouken718 vVv SabreTooth718 vVv


altoiddealer

#18
So like I said, I haven't tested looking up other Constant values from the enemy's data...

But if it's true across the board, that none of the values returned by Const(**) are factored by local coordinates, then maybe I can try comparing something that IS factored by localcoord, against the result of Const(**)

I don't have the time to think it over too hard, but here's a super rough draft of my thought process...

type = VarSet
trigger1 = numenemy
trigger1 = enemynear,command = "holdfwd"
trigger1 = fvar(37) != 0 && enemynear,Vel X > fvar(37) ;should log maximum walk speed
fvar(37) = enemynear,Vel X

type = VarSet
trigger1 = fvar(37) != 0
trigger1 = numenemy
fvar(38) = fvar(37) / enemynear,Const(velocity.walk.fwd.x) ;should be able to determine the enemy's local coordinate space from this value

Edit: Kinda made it sound like an original idea right?  I believe what you said, Noctis, got my brain ticking


Odb718

well, what about characters like Dhalsim? He's super slow. So if he's scaled up, his speed would be around normal.
vVv Gouken718 vVv SabreTooth718 vVv