Game Maker Community YoYo Games

Welcome Guest ( Log In | Register )

> Novice Forum Rules

Novice and intermediate users who are using Drag & Drop action icons, or still learning GML, can get help from more experienced members.

Please READ the Novice Q&A Forum Rules prior to posting. And remember that the General GMC Rules apply here too.

 
Reply to this topicStart new topic
Maximum Instances
VorticalBeans
post Nov 7 2009, 02:53 AM
Post #1


GMC Member
Group Icon

Group: GMC Member
Posts: 4
Joined: 27-March 07
Member No.: 74615



I'm having a problem with my current game where i create ridiculous amounts of instances that quickly get destroyed. After about 2 minutes the game freezes without fail. It's not a loop though, infact I've narrowed it down to pretty much only one thing that i think could be causing this. The instance ID numbers go higher than Game Maker can support. Right now it crashes when creating instances around the id=125000 range. But there's never more than 400 instances actually in the game at any time, and they aren't very heavy instances.

My question is, is there anyway to create new instances that have the ID of previously created and destroyed instances? Loop around the ID numbers when they get to high?

Any help would be much appreciated!
Go to the top of the page
 
+Quote Post
AlexR2
post Nov 7 2009, 03:18 AM
Post #2


GMC Member
Group Icon

Group: GMC Member
Posts: 112
Joined: 30-June 09
From: over here, bumbo
Member No.: 135804



the way i'd do it is try and make the game with one object
Go to the top of the page
 
+Quote Post
tidus97
post Nov 7 2009, 03:28 AM
Post #3


GMC Member
Group Icon

Group: GMC Member
Posts: 708
Joined: 12-September 06
From: Australia
Member No.: 59285



125000 isnt a limit:

(i stopped going from here). the mouse is hovering on the center of the "dirt" patch, and when i click it creates a smaller dirt patch thing that floats away (sort of like kicking up dirt..this should be a particle effect i know. ill change it later.). there is 4 dirt patches on top of each other, so 4 get created each step and eventually when they fade out 4 gets deleted. im left with 501 instances at any one time. the ID just keeps going and going though granted i DID notice a loss of performance when it got high. NOT in FPS drop though..(FPS was a constant 60, it slowed when i screenshotted i guess). it was the same as an fps drop - not SMOOTH gameplay. sped up and down a little here and there but was noticeable. again, it didnt register as an FPS drop. maybe storing id's is a matter of memory? your running out quicker than me. that would then mean GM keeps track of unused/deleted ID's too..which is not very good.

This post has been edited by tidus97: Nov 7 2009, 03:28 AM
Go to the top of the page
 
+Quote Post
icuurd12b42
post Nov 7 2009, 03:31 AM
Post #4


GMC Member
Group Icon

Group: GMC Member
Posts: 7692
Joined: 26-October 06
Member No.: 62394



You created particle systems and never freed them
Go to the top of the page
 
+Quote Post
tidus97
post Nov 7 2009, 03:32 AM
Post #5


GMC Member
Group Icon

Group: GMC Member
Posts: 708
Joined: 12-September 06
From: Australia
Member No.: 59285



me?
Go to the top of the page
 
+Quote Post
VorticalBeans
post Nov 7 2009, 04:37 AM
Post #6


GMC Member
Group Icon

Group: GMC Member
Posts: 4
Joined: 27-March 07
Member No.: 74615



I didn't create particle systems without deleting them, not sure if you were talking to the other guy or not. I can't figure out what the problem is but I figured out a fix for it.

I have 2 identical rooms, and every single instance is persistent then i swap back and forth between the rooms once every minute. It's completely unnoticeable and I've gotten it to run for 20 straight minutes doing that. I still don't know what it was that made it freeze, but changing the rooms seems to clear whatever is getting stuck up in memory. If anyone has any idea what this is I'd still like to know what it is that's causing this, even though it shouldn't be a problem for the time being.
Go to the top of the page
 
+Quote Post
icuurd12b42
post Nov 7 2009, 06:05 AM
Post #7


GMC Member
Group Icon

Group: GMC Member
Posts: 7692
Joined: 26-October 06
Member No.: 62394



QUOTE (tidus97 @ Nov 6 2009, 10:32 PM) *
me?

Nope.


It's usually is the case that this is caused by particles so I took a shot in the dark. Pitty it was not the case... But maybe it is...

QUOTE (VorticalBeans @ Nov 6 2009, 11:37 PM) *
I didn't create particle systems without deleting them, not sure if you were talking to the other guy or not. I can't figure out what the problem is but I figured out a fix for it.

I have 2 identical rooms, and every single instance is persistent then i swap back and forth between the rooms once every minute. It's completely unnoticeable and I've gotten it to run for 20 straight minutes doing that. I still don't know what it was that made it freeze, but changing the rooms seems to clear whatever is getting stuck up in memory. If anyone has any idea what this is I'd still like to know what it is that's causing this, even though it shouldn't be a problem for the time being.


that means the instances remain... Going back to the room more are created. do they create a particle system? When do you free the particle system (destroy AND room end is recomended)... Like I said, particle systems are about the only GM native thing that cause the game to slow down and eventually freese or crash.
Go to the top of the page
 
+Quote Post
VorticalBeans
post Nov 7 2009, 08:00 AM
Post #8


GMC Member
Group Icon

Group: GMC Member
Posts: 4
Joined: 27-March 07
Member No.: 74615



Yeah, I want the instances to remain, that is my fix, i guess I didn't explain it very well...

I thought of that too with the particle systems, and I tested it with completely turning off all particle effects and it still froze after 2 minutes. I even tested it with all draw functions turned off so no sprites were being drawn and it still froze. Just something about having a billion instances being created in the same room for long enough made it freeze...

This post has been edited by VorticalBeans: Nov 7 2009, 08:01 AM
Go to the top of the page
 
+Quote Post
icuurd12b42
post Nov 7 2009, 08:54 AM
Post #9


GMC Member
Group Icon

Group: GMC Member
Posts: 7692
Joined: 26-October 06
Member No.: 62394



QUOTE (VorticalBeans @ Nov 7 2009, 03:00 AM) *
Yeah, I want the instances to remain, that is my fix, i guess I didn't explain it very well...

I thought of that too with the particle systems, and I tested it with completely turning off all particle effects and it still froze after 2 minutes. I even tested it with all draw functions turned off so no sprites were being drawn and it still froze. Just something about having a billion instances being created in the same room for long enough made it freeze...


You said you only have 400 active... You delete them... the instances can be creates and destroyed forever. The id will just become negative at one point and start to climb back up...
Go to the top of the page
 
+Quote Post
VorticalBeans
post Nov 7 2009, 09:07 AM
Post #10


GMC Member
Group Icon

Group: GMC Member
Posts: 4
Joined: 27-March 07
Member No.: 74615



Well apparently not cause something is going wrong. Something is sticking in memory, cause I am creating like 10 instances a second and destroying around the same. There never gets more than around 400 instances but for some reason after 2 minutes the game freezes, if I speed up the generation of instances then the game freezes sooner, if I slow it down then the game freezes later.

However if I change the room every minute while keeping all the instances persistant then the game never freezes. So something is happening when I change the room that is clearing some sort of built up memory.
Go to the top of the page
 
+Quote Post
icuurd12b42
post Nov 7 2009, 09:33 AM
Post #11


GMC Member
Group Icon

Group: GMC Member
Posts: 7692
Joined: 26-October 06
Member No.: 62394



Post your gmk...
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd November 2009 - 12:21 PM