YesNoOk
avatar

Width, Different local coord resizes and p2body distance. (Read 2076 times)

Started by Carmell, November 02, 2020, 12:47:31 pm
Share this topic:
Width, Different local coord resizes and p2body distance.
#1  November 02, 2020, 12:47:31 pm
  • ***
    • USA

  • Online
New character is almost ready for release but I still havent got past the resize messing up the AI hurdle. I googled what I could about the code but I need clarification on a few points.


Does resizing a character using localcoordinates mess with the p2bodydist calculation?
For example if I had a large character shrunk down with localcoordinates does the required pixels no longer equate? Do I need the equivalent of 3 pixels just to make 1 pixel according to the code? Like does KFM 720 for example now go based on the size of a pixel from his enormous sprite or is always using the same metric regardless of sprite size?

Also confused about width. I notice they have a front and back width. does this mean the real width is the combined of both with the players center being the starting point heading to left and right?

and if Im using p2dist in the AI do I need to start counting from the edge of my width instead of the character's center? What I really desire out of all this is how to calculate how many full character body widths the opponent is from my resized huge sprite character.
Re: Width, Different local coord resizes and p2body distance.
#2  November 05, 2020, 09:42:32 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
P2dist is from axis. P2bodydist iz from width.

I think with the width sctrl you can specify either or both. So its based on which bit of width you specify.

Haven't messed with localcoord much. As you have to double vels for 640 it makes logical sense you'd double distances too.


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: Width, Different local coord resizes and p2body distance.
#3  November 05, 2020, 11:58:57 am
  • ***
    • USA

  • Online
Is axis the plus sign in fighter factory or is it based on something else?
Re: Width, Different local coord resizes and p2body distance.
#4  November 06, 2020, 04:13:27 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Axis is the plus sign. Thats considered 0,0 in relation to anything from your character. Explods. Helpers. Player 2. Everything.


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: Width, Different local coord resizes and p2body distance.
#5  November 06, 2020, 10:49:07 am
  • ***
    • USA

  • Online
2 more questions

1. Does a hypothetical statement like

trigger1= (p2dist x=[200,400])

mean it activates specifically at 200 AND 400 or does it mean 200 THROUGH 400? I suspect it's the latter because if you try to add a 3rd value like [200,400,600] it doesnt accept it but I want confirmation. I really hope it's the latter.


2. Does adding a second trigger line under the first line such as

trigger1= (p2dist x=[400,800]) && random<50
trigger1= (p2dist x=[1300,2000]) && random<500

Does adding that second line cause any contradiction or does it do what I think it does and just increases the chances of move activation when the p2 character is further out?
Re: Width, Different local coord resizes and p2body distance.
#6  November 06, 2020, 10:58:19 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
[x,x] will only compute values between the two, you can't add another

so you can do [20,40] and [40,60], but if you want [20,40,60] you would have to use [20,60]


for the second, remember that && can function like a trigger, so
Code:
trigger1= (p2dist x=[400,800]) && random<50
can mean
Code:
trigger1 = (p2dist x=[400,800])
trigger1 = random<50

now, knowing this and knowing that everything on a single trigger works as &&, and thus will only trigger if all conditions are met, you cannot have those as trigger1 and then have
Code:
trigger1= (p2dist x=[1300,2000]) && random<500
also as trigger 1, because you are directing it to decide it to not only be 400-800, but also a random number below 50, AND 1300-2000 AND a random number below 500. Even if the bracketed situations were feasible, the very fact that the lowest possible confirmed number has to be below 50, because that's where the triggers line up, means that it will ONLY trigger when the result is below 50, not 500


realistically, I would suggest two triggers, trigger1 and trigger2, or use something like a set of variables

Code:
trigger1 = [x,x]
var(x) = 1

trigger1 = [x2,x2]
var(x) = 2

with the resulting variables confirming the distance being accurate

so if var(x)=1 then distance is already confirmed to be [x,x], and the var(x)=2 being the opposite
______________________

Sorry I keep editing this, but to confirm Cynaide's point, localcoord essentially just prescales the character according to the settings
https://mugenguild.com/forum/topics/what-is-localcoord--167188.0.html
https://web.archive.org/web/20160323112524/http://mugencoder.com/mugendocs/1.0/coordspace.html

in so many words, if a character is set to 320, it will scale to 1280 by the difference, and all x and y values are affected by this factor of 4.
Back in the old Winmugen HD days we had to make sure we rescaled HD characters if we weren't running an HD screenpack, otherwise they were massive!
Last Edit: November 06, 2020, 11:26:52 am by Bannana
Re: Width, Different local coord resizes and p2body distance.
#7  November 06, 2020, 05:18:55 pm
  • ***
    • USA

  • Online
I never used var before so that definitely wouldnt have occurred to me.

So when you say trigger2 could work do you mean as simple change as this could work?

trigger1= (p2dist x=[400,800]) && random<50
trigger2= (p2dist x=[1300,2000]) && random<500

Im pretty sure I was told once that trigger number listings were basically just aesthetic but maybe they meant just most of the time?


The real entire code block currently looks like this.

[State -1, tangle fury]
type= changestate
value= 3050
triggerall = var(59)>=1 && numenemy
triggerall = statetype!=A
triggerall = power>=3000
trigger1= ctrl || stateno=100
trigger1= (p2dist x=[400,800]) && random<50
trigger1= (p2dist x=[1300,2000]) && random<500


Is this the var revision youre suggesting?

[State -1, tangle fury]
type= changestate
value= 3050
triggerall = var(59)>=1 && numenemy
triggerall = statetype!=A
triggerall = power>=3000
trigger1= ctrl || stateno=100
trigger1= (p2dist x=[400,800]) && random<50
var1(x) = 1

trigger1= (p2dist x=[1300,2000]) && random<500
var(x) =2

I assume the blank line between the 2 triggers is deliberate or were just seperating them to be clearer for me to read?
Re: Width, Different local coord resizes and p2body distance.
#8  November 06, 2020, 06:52:12 pm
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
You don't have to use the var, I personally use them for saving specific distance calcs, but you could use something like

Code:
[state -2]
type = varset
trigger = time >= 0 ; this just means it will check every second
var(x) = ifelse(p2dist x=([400,800]), 1, 0)

and then your trigger could just be var(x) = 1


trigger1 will trigger if all the requirements listed for trigger1= are met, trigger 2 will trigger if all the requirements for trigger2= are met, so both those distance and random triggers, if listed as 1 and 2 as you have them now, will trigger according to their respective situations

and the space was just for it to be clearer, yeah