collapse

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

0 Members and 1 Guest are viewing this topic.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12521
  • Country: Brazil br
  • Last Login:March 30, 2025, 12:53:34 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: 12521
  • Country: Brazil br
  • Last Login:March 30, 2025, 12:53:34 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

verz36's wips by Uche_of_IMT
[Today at 12:32:07 AM]


Dcat's WIP THREAD by dcat
[March 31, 2025, 03:29:03 AM]


Official Marvel beat them up 2025 game by wacky thaxie
[March 28, 2025, 05:32:50 AM]


Street Fighter Spec Ops 2021 by O Ilusionista
[March 25, 2025, 11:15:14 AM]


[WIP] Pocket Dimensional Clash 2 by O Ilusionista
[March 20, 2025, 11:13:51 AM]


The Warehouse Stage 1.1 & 1.0 by tehdevil
[March 19, 2025, 05:26:33 AM]


Marvel's the fixer by wacky thaxie
[March 14, 2025, 08:57:13 AM]


characters in full game playable outside of full game by tehdevil
[March 14, 2025, 04:38:43 AM]


Battle of the Best by MatreroG
[March 09, 2025, 07:23:39 AM]


DEATHBATTLE!!!:Ghost Rider vs Spawn by supa2520
[March 08, 2025, 07:29:26 AM]

* IMT Calendar

April 2025
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