collapse

Author Topic: [Tutorial] How many variables Mugen has?  (Read 4473 times)

0 Members and 2 Guests are viewing this topic.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12476
  • Country: Brazil br
  • Last Login:November 11, 2024, 12:35:15 PM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
[Tutorial] How many variables Mugen has?
« on: December 06, 2019, 05:49:58 PM »
How many variables Mugen has?
This could be a tricky question to answer.
Right of the bat, you have this - remember that Mugen doesn't string typed variable, it's always numbers (integer or floats):

Code: [Select]
0-59 Integer var
0-39 Float vars
0-5 sysvars (system integer variables)
0-5 fsysvars(system float variables)
I don't suggest you to use sysvars or fsysvars unless you know what you are doing, because the engine already uses those values. So i will exclude them from this count.
So basically, you can use up to 100 variables (60 integer and 40 float) per character, right?

In fact, its more than that:

In Mugen, you can have helpers (treated like independet entities) and each helper can have their own set of variables.
Code: [Select]
0-59 Integer var
0-39 Float vars
Each helper can have up to 100 variables too. They helpers can even use their own set of sysvars and fsysvars (which aren't real system vars)
So, on the easy route, we are talking about 100 (60 int + 40 float) per character + 100 (per helper) * 56 helpers = 5700 variables

The full list should be:
0-59 vars per player -> 60 int variables
0-59 vars per helper (56 max helpers) -> 5600 (56*10) helper int variables
0-39 fvars per player - > 40 float variables
0-39 fvars per helper (if I am not mistaken) -> 2240 (40*46_ helper float variables)
0-5 sysvars - > 6 int variables
0-5 fsysvars -> 6 float variables
0-5 sysvars per helper - > 336 (6*56) int variables
0-5 fsysvars per helper -> 336 (6*56) float variables

Total: 8624 variables (6002 int variables + 2622 float variables).
PS: many sysvar and fsysvars are already being used by the engine!

That was the easy part. You can go even deeper if you use bitshift.
Each integer variable is a 32bits word, so you have 32 flags (0 or 1) per int variable.
so, in the end, you can have 192.064 flags at the same time.
Remember that you can have groups of flags, so you would work as in Hexadecimal (groups of flags can work as results).
That would make you to be able to handle a 32bits value - 4294967295 values to be exact.



Offline Mistah Jorge

  • The cursed one.
  • RMM Contributor
  • ****
  • Posts: 309
  • Country: Portugal pt
  • Last Login:November 07, 2021, 10:40:48 PM
  • I'm cursed! God f****** dammit!
    • Email
Re: [Tutorial] How many variables Mugen has?
« Reply #1 on: December 06, 2019, 06:33:49 PM »
Nice, i heard we could use more than the 60 variables as in var(61) but that had somekind of a problem...
Using helpers as a way to store more variables sounds like a better work around anyway.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12476
  • Country: Brazil br
  • Last Login:November 11, 2024, 12:35:15 PM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: [Tutorial] How many variables Mugen has?
« Reply #2 on: December 06, 2019, 06:37:25 PM »
Yes, but there are some points to remember:

- Each time you create a helper, the engine allocate memory for all the variables a helper can handle (112), either you using them or not. This is why Elecbyte says helpers are more resource intensive than other things.

- When a helper is destroyed, all of his date is destroyed with it. So the variables are released from the memory. But for a player, this never happens - the engine will only release the 100 variables values when the match is over, because in Mugen you can't free/null a variable - and setting a var to 0 and nulling it are different animals.

Tags:
 


* IMT Facebook

Help us by Donating!

IMT Discord

Join us at our Discord! Click the image below!

* IMT Shoutbox

Sorry, this shoutbox does not exist.

* Recent Posts

D2TD VS Showcase Thread by D2TD
[November 24, 2024, 09:12:03 AM]


Marvel vs. Capcom: Eternity of Heroes REMAKE Game Update 1.3.0 - N.A.O.H. by LightFlare
[November 21, 2024, 09:44:09 PM]


Terrordrome: Rise of the Boogeymen Extended Version ( jeepers creepers) version by leonardo
[November 19, 2024, 10:22:47 PM]


Hill of the Nameless(1.1 Only) by Vegaz by LightFlare
[November 19, 2024, 10:50:39 AM]


Golden Axe Returns by gokudo99
[November 19, 2024, 03:59:31 AM]


Barkley Shut Up and Jam! Stages by Vegaz by LightFlare
[November 12, 2024, 11:26:21 AM]


[BOR] _Avengers United Battle Force_ by O Ilusionista
[November 11, 2024, 12:35:24 PM]


Eternal Lament Stage 1.1 & 1.0 by O Ilusionista
[November 11, 2024, 12:34:54 PM]


MatreroG's Stages W.I.P. Concepts by MatreroG
[November 11, 2024, 07:00:56 AM]


Spooky House(1.1 Only/AIGS) by Vegaz by LightFlare
[October 31, 2024, 11:31:36 AM]

* IMT Calendar

November 2024
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 [26] 27 28 29 30

SimplePortal 2.3.5 © 2008-2012, SimplePortal