The Daily Click ::. Forums ::. Klik Coding Help ::. Sudden MMF2 memory issue after adding a feature to my game?
 

Post Reply  Post Oekaki 
 

Posted By Message

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
24th January, 2012 at 12:41:52 -

I don't know for sure if it's a memory problem, however ever since I added a new feature to my game I've had many instances where objects not related to the feature either don't get created or the game will create totally different objects. I even had one crash

Here's what I did:

For every instance of undead enemies that are struck with a whip it creates a small circle object at the center of that enemy, a little txtblitter tag floats up that says "destroyed" and a bunch of bones fly out when it dies. Now the bones part has always been in the game and has always worked so that's not the problem. At first I thought that maybe me copying / pasting the code over multiple frames was causing the program to try and create the circle object by pulling it from another frame (?). So I spent like an hour lsat night going through every instace of the create circle code, deleting it, and re-entering it manually making sure that it's creating the circle object that exists on that frame.

And lo and behold, I'm still getting the same problems

Each frame that has undead on it has this circle object, the destroyed tag, and the proper code. The circle object is an active object that has "destroy if too far from frame" and "deactivate if too far from frame" both OFF.

All the code appears right. I hate shit like this, I really don't want to take this feature out because it makes the game a lot better. And it's not even complex code! Does anybody know how I'd be able to see if my game was causing some huge memory leak when run? Maybe I could narrow it down that way.

Thanks for hearing me out

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
24th January, 2012 at 13:15:00 -

Okay I was running the performance manager and I never got between 8%-16% CPU used on average, yet still weird things are happening. They only started happening when I started killing stuff with the whip.

When I hit enemies with weapons now, I sometimes get hurt and that has never happened before. NOT IN 4 YEARS. Also, shooting my ray gun made the gun's beams go from normal to different objects elsewhere in the frame, including this still of a teleport orb Rovert warping away. This has nothing to do with the ray gun's normal function, and has never happened before. I didn't touch the code for the gun at all.

What the hell is going on with MMF??

Image

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

nim



Registered
  17/05/2002
Points
  7229
24th January, 2012 at 13:22:44 -

When I get strange behaviour with objects it's usually because I've reached the object limit. You'd think that MMF would just stop creating objects when it's over the limit but it usually does weird stuff like bunching objects together, ignoring alterable values and creating invisible objects by default. Check that first! As for the crash, you might have a couple of issues, or the crash might not be related to the other things that are happening.

Hope this helps! I've never made a "big" game so I can't say I've ever experienced issues like the ones you described. I'm sure Hasslevania 2 is a pretty big game but I'd say with some confidence that I've seen other MMF games that are likely more complex than that. Can you give us an idea of how many events/objects/frames you have?

 
//

nim



Registered
  17/05/2002
Points
  7229
24th January, 2012 at 13:23:30 -

Also, good luck with the game! I'm looking forward to it

 
//

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
24th January, 2012 at 13:49:57 -

Thanks nim, I hope I can figure this out. I just did a couple of tests which should help narrow it down. First, I played for about 15-20 minutes without using the whip and it worked 100% correctly. I know it has something to do with the new whip and effect for sure.

Second, I went and killed a skeleton with a regular sword and this is what the death effect looked like (normal effect):
Image

Then I left the frame and came back and killed the same skeleton with the whip and got THIS:
Image
(Actually, this is kind of awesome but I digress)

So it's not even like it's a built-up memory loss, it happened the first chance I got to use the whip vs. an undead.

I was thinking, could destroying that circle object at the start of the frame load help? Also I don't think I have any code that destroys the circle at all, it just creates it at the center of the undead and the normal animation makes it disappear (but it's not really gone). I think this might be the next 2 things I do to try and fix this, to destroy on frame start and then have a line of code like 'if animation frame >= 6 then destroy circle object'. I mean it can't hurt at this point.

To answer your question, I think I have 140ish frames to the entire game. Each room is contained within one frame regardless of size. A normal room is 330W x 205H. I originally had critical hits do a screen shake which is why the size is a bit strange (the game size is 320 x 200 and I needed the frame to be a little bigger or else it didn't shake).

There aren't an incredible amount of objects on any one frame. If I had to guess I'm thinking maybe in the realm of 100-200 maximum. All frames have an object limit of at least 800 and some are more. A lot of the objects are unused stuff like backdrops and etc, or stuff that could possibly be created during runtime on that frame / room like moneybags from pots and stuff.

Event-wise, there are a ton for each non-cutscene, non-shop frame. It's pretty complicated. Or maybe convoluted is more accurate . I wish there was a good way to show a screenshot of it all but it'd never fit on a single screenie. I think I have 95-120 groups of events on any one frame and a lot of those groups have a bunch of lines. Rovert's movement and the backpack groups are pretty big, so are the groups that handle all the weapons and their attacks. Enemies have their own specific groups and have maybe 40 or 50 events each (I think?)

Regardless, I'm glad you've had similar problems and it's not just me. We'll fix this!

Edited by Del Duio

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

nim



Registered
  17/05/2002
Points
  7229
24th January, 2012 at 15:34:40 -

Maybe you're experiencing something similar to this? http://www.create-games.com/article.asp?id=1964

In any case, increase the object limit. I'm not sure why you'd set it at 800. Like I said, MMF tends to crap out when it reaches the limit rather than doing something logical like behaving normally but with no new objects. If you're using MMF2 you can enable the debugger in the game properties and take a quick look at it while the game is running to see how many objects are in play at any time.

 
//

Alonso Martin



Registered
  29/12/2010
Points
  294
24th January, 2012 at 15:45:31 -

I've also had memory issues with my game, however they've never been graphical glitches. I know what you feel and it totally sucks, but I've learned there's always a solution or a workaround to be found

I read somewhere that the guy that was doing Tormishire encountered a bug in which objects were graphically replaced by other objects. His solution was to jump to a blank frame before jumping onto the next frame. Perhaps it could be a similar problem in your case. I've never encountered this bug myself, so I have no idea of what might trigger it.

Additionally, do all the objects that are not needed at the start of the frame have ticked off "create at start"? Does the debugger show a memory increase when the bug happens? Have you tried repeating it several times to see if it adds up to a considerable amount? As Nim said, I would be suspicious of the max object limit, but if it isn't that, then try working with the blank frame solution and see what happens.

Edit: Ah. I took too long to write this post x)

Edited by Alonso Martin

 
www.hfalicia.com
www.alonsomartin.mx

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
24th January, 2012 at 15:50:10 -

I'll try unticking "create at start" for extra unused objects and see if that helps.

Also I just tried shooting the gun again in a room with an undead enemy but BEFORE I used the whip and I still got graphical glitches with the beam. If nothing else, it's a fast way to check for errors.

It must be making a ton of copies of something somewhere on the frame, which then leads to an over object limit. I'll have to really recheck my code but the answer has to be there someplace.

Thanks guys, I'll let you know what happened tomorrow!

Edited by Del Duio

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
25th January, 2012 at 12:09:11 -

Jeebus Christ!!

Nothing worked. I tried every potential fix imaginable: unticking "create at start", increasing the object limit for every frame the effect's in from 500 to 1000, deleting different parts of the event lines for the effect -> compiling -> testing -> go back and delete another part of the effect to narrow it down (same memory glitch every time), I even tried changing the friggin' sound effect in case that was somehow causing it and that didn't do shit either. I tried changing every instance of the smite circle's "destroy if too far from frame" and that wasn't it. Then I took out the code that increases the scale of the effect, that did nothing. I saw a line in the code where I set a value that gets subtracted from the enemy's HP by 9999 so I thought maybe that was causing "complex math" for some reason only known to God so I swapped the variable set to 'damage taken = enemy HP' and nope, same glitch. Setting its HP to zero? Same glitch. I tried taking out the floating damage text. NOPE, SAME GLITCH.

Then I took out the enlarging code, the undead smite circle, and all the "destroy undead" events AND IT WORKED JUST LIKE IT USED TO. What a waste of 3 hours, compunded by the fact that my project takes forever to load / save / compile.

I can't express how much this sucks. I don't want to take this code and effect out, it makes the game much better. To be held back when your code is correct and you've done nothing wrong is just beyond frustrating.

At this point all I can do that will work is just make it so the enemy's HP is set to 0 and nothing will look or sound any different than it being killed by any other weapon. I don't know what else to try to fix this.

Edited by Del Duio

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
25th January, 2012 at 13:10:41 -

Try re-creating the code. I haven't experienced this in MMF2, but In the past I've coded games that somehow ended up with corrupted code. Upon deleting the code and re-creating it exactly how it was before the problem was solved.



 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
25th January, 2012 at 14:43:30 -


Originally Posted by GamesterXIII
Try re-creating the code. I haven't experienced this in MMF2, but In the past I've coded games that somehow ended up with corrupted code. Upon deleting the code and re-creating it exactly how it was before the problem was solved.




Haven't tried that yet but I'll try anything to avoid taking this completely out.

Thanks GamesterXIII!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Alonso Martin



Registered
  29/12/2010
Points
  294
25th January, 2012 at 14:53:01 -

What you can also do, although it's a bit of an overkill, is to cut out a good portion of the game's events, not the events of the effect. This will take a few compilations but, eventually, you might get down to whatever else is causing the problem.

Also, did you try jumping to a blank frame before going into the other frame?

 
www.hfalicia.com
www.alonsomartin.mx

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
25th January, 2012 at 16:29:46 -

No, I actually forgot about that one. The way the rooms are set up is that when Rovert collides with an active picture object (the 'exits' of the room) it sets his starting X/Y position for the next room then jumps to the next correct frame.

I could run a test and make a blank frame from say the beginning of the first planet's rooms to the 2nd starting room with a blank frame in between and see if that helps things. It'd be a huge undertaking to make every room have a blank frame in between so I want to be REEEEALLY sure that that would 100% fix the memory problems first.

What you can also do, although it's a bit of an overkill, is to cut out a good portion of the game's events, not the events of the effect. This will take a few compilations but, eventually, you might get down to whatever else is causing the problem.

For some reason, the ray gun's electric beams seem to be greatly affected by this bug too. Same goes for Rovert's little-used "Warping" animation / sprite (the black shadow guys in the screenshot above). Like this glitch is only really affecting the same few things. Very weird.

Thanks Alonso, I'll try these out and report back here as soon as I can.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Alonso Martin



Registered
  29/12/2010
Points
  294
25th January, 2012 at 17:56:12 -

It does sound like the graphical bug to which Nim linked. Try the blank frame thing and, if it does fix the game, keep on reading.

When the player leaves the frame, do you jump directly to the target frame? Or do you set a global value to the target and then jump to that frame? If you're using this last method, just jump to the same blank frame and code the events there to jump to the frame in the global value. You'd still need to go through that one event on each frame, but it'd be very speedy (since you'd be jumping to the same blank frame).

However, if you're jumping directly to the target frame, I do think it will be a drag to correct this on each event list. If you really think about it, it's probably not as tedious as it sounds. But that depends on the amount of frames you have.

I suppose it's reduced to how much you want this effect to be in the game versus the cost of implementing it without glitches.

Best of luck


 
www.hfalicia.com
www.alonsomartin.mx

HitmanN

What's this

Registered
  12/09/2009
Points
  3002

360 OwnerVIP MemberGOTM February 2010 3rd Place WinnerComputerGOTW WINNER MAY 2010!GOTW WINNER JUNE 2010!Ornament RedOrnament GreenOrnament Gold
27th January, 2012 at 09:09:15 -


Originally Posted by GamesterXIII
Try re-creating the code. I haven't experienced this in MMF2, but In the past I've coded games that somehow ended up with corrupted code. Upon deleting the code and re-creating it exactly how it was before the problem was solved.




Seconded. Though I've actually had that happen in MMF2. Usually it's been copy-pasted code, which looks 100% correct, but actually is messed up. Only had it happen twice though, but still, it's annoying to pinpoint a problem that may be caused by a completely irrelevant code that is supposed to do sonething entirely different.

Another simpler thing I thought of was qualifiers/groups. I use them plenty and it's pretty easy to forget those in cloned objects, then some other events could be doing odd things based on those qualifiers.

 
"He who controls the chicken, controls the egg!"

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  50116

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
27th January, 2012 at 10:21:13 -

"I read somewhere that the guy that was doing Tormishire encountered a bug in which objects were graphically replaced by other objects. His solution was to jump to a blank frame before jumping onto the next frame. Perhaps it could be a similar problem in your case. I've never encountered this bug myself, so I have no idea of what might trigger it."


I can confirm this, I had a similar problem a few years ago and figured if the graphics were replaced, doing this would fix it. But that WAS with MMF1.5 though, no idea if it worked with MMF2 although theoretically both programs use the same engine.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
27th January, 2012 at 13:03:48 -


Originally Posted by Alonso Martin
When the player leaves the frame, do you jump directly to the target frame? Or do you set a global value to the target and then jump to that frame? If you're using this last method, just jump to the same blank frame and code the events there to jump to the frame in the global value. You'd still need to go through that one event on each frame, but it'd be very speedy (since you'd be jumping to the same blank frame).



I wasn't at work yesterday so I couldn't check this forum but you were right! First when re-creating the code didn't work I tried making a blank frame that's black with a sole event: Start of Frame -> Jump to Frame (global value UNDEADFIXER). Good variable name eh? Anyhow it solved the problem!!

The only drawback was that now there's a huge (to me) delay between going from room to room. It's about 2 seconds or so. I had to weigh whether or not this delay was more important than this new undead-killing code (and potentially any future code that would get screwed up the same way) and decided that the 2 second delay was worth it. So I spent maybe an hour just going through the game and changing out all the direct frame jumps to assigning that new global variable and jumping to the same black frame. I now know for sure that there are 127 frames to my project because I had to type jump to fram 127 in A LOT

I added this code in to a few places where it probably didn't need it, like exiting and entering the shops. The reason I did this is because it was jarring to have the same room to room transition for the whole game and then BAM you're immediately in the shop or whatever. cutscene to cutscene will remain as they were.

So I hope that even though this whole thing was a big pain in the ass this will allow me to add further effects and stuff to the game later... and have them work as intended!

Thanks to everybody for helping me solve this problem!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
27th January, 2012 at 13:05:04 -


Originally Posted by The Chris Street
"I read somewhere that the guy that was doing Tormishire encountered a bug in which objects were graphically replaced by other objects. His solution was to jump to a blank frame before jumping onto the next frame. Perhaps it could be a similar problem in your case. I've never encountered this bug myself, so I have no idea of what might trigger it."


I can confirm this, I had a similar problem a few years ago and figured if the graphics were replaced, doing this would fix it. But that WAS with MMF1.5 though, no idea if it worked with MMF2 although theoretically both programs use the same engine.



Weird huh? I'm glad this was the fix and I hope this will help anybody else who has this problem in the future. Thanks Circy!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

nim



Registered
  17/05/2002
Points
  7229
27th January, 2012 at 13:51:25 -


Originally Posted by Del Duio
there's a huge (to me) delay between going from room to room. It's about 2 seconds or so. I had to weigh whether or not this delay was more important than this new undead-killing code (and potentially any future code that would get screwed up the same way) and decided that the 2 second delay was worth it.



2 seconds isn't long for that type of game, I wouldn't worry about it. Glad to hear that you got it sorted!

 
//

Alonso Martin



Registered
  29/12/2010
Points
  294
27th January, 2012 at 15:15:24 -

Glad to hear it's fixed, too.

Edit: Oh, just out of curiosity: I was talking with the guys in Gwerdy and they told me that this was an old HWA bug that was supposedly fixed in later builds. They said that it was not a problem with the .mfa itself, but with a memory mismatch of sorts. One guy said fixing things was simply a matter of rebooting your computer. I know you most likely rebooted and saw no fix, but are you using the HWA runtime?

Edited by Alonso Martin

 
www.hfalicia.com
www.alonsomartin.mx

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
27th January, 2012 at 15:28:10 -

No, I think I'm still using build 252. I'm pretty sure that's what it is. I haven't updated the build in years.
I don't mind not having HWA though, so far I don't have a million particles or anything fancy like that.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!
   

Post Reply



 



Advertisement

Worth A Click