| |
[GM7] Speed problems when deactivating instances, Game speeds up when deactivating objects
Gardevoir the Shroob |
|

I'm still thinking what to say here.... Toads maybe?

Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
Well, I'm working at my game Super Mario 2009: The Stars Story. I had to deactivate the solid objects because the game lagged extremely. I did that, and I also needed to deactivate the enemy parent so that they didn't fall through the solids. That means the enemy object (obj_basicenemy) must be deactivated in a smaller region, or else it would fall through the solids if it leaves the bottom of the screen. There isn't a function to deactivate a certain object within a region so I had to use a with statement for that, but now it happens: the game gets super fast, so fast it's just extreme.
This is the deactivation code (end step event):
| CODE | instance_deactivate_object(obj_solid) instance_deactivate_object(obj_slopeparent) instance_deactivate_object(obj_solidtop)
with (obj_basicenemy) { if x < view_xview[0] -24 or x > view_xview[0] +344 or y < view_yview[0] -24 or y > view_yview[0] +244 instance_deactivate_object(self) }
instance_activate_region(view_xview[0] -24, view_yview[0] -24, view_xview[0] +344, view_yview[0] +264, true) |
The room speed is 60, just in case you want to know it. I tried everything but just nothing helps! If you know the solution, then tell it. Thanks.
Gardevoir
--------------------
Coming Soon:Super Mario 2009: The Stars Story Princess Shroob will be back, even more evil than she was in Partners in Time before. Can Mario and his friends stop her once again before it's too late?
|
|
|
Gardevoir the Shroob |
|

I'm still thinking what to say here.... Toads maybe?

Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
| QUOTE (YoManRuLz @ Oct 31 2009, 01:23 PM) | I see no reason why it would go faster, other than the lag cancels out the room speed. so if 30 helps, then program everything so they move 1/2 the speed they do now. |
The strange thing is: in a room without enemies the room goes at normal speed, and when the enemies are in a room it goes crazy. But maybe the room speed is something I'm going to look at.
--------------------
Coming Soon:Super Mario 2009: The Stars Story Princess Shroob will be back, even more evil than she was in Partners in Time before. Can Mario and his friends stop her once again before it's too late?
|
|
|
Gardevoir the Shroob |
|

I'm still thinking what to say here.... Toads maybe?

Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
| QUOTE (exenefevex @ Oct 31 2009, 02:10 PM) | | This might sound crazy, but have you checked to make sure each object's step event is activating only once per frame? Weird things happen when you deactivate/reactivate objects on the same frame. |
You mean (de)activating the same object? Or doesn't that matter?
Sorry if I seem newbish.
--------------------
Coming Soon:Super Mario 2009: The Stars Story Princess Shroob will be back, even more evil than she was in Partners in Time before. Can Mario and his friends stop her once again before it's too late?
|
|
|
exenefevex |
|
Regular
![Super Happy Heart Badge [*]](https://archive.mfgg.net/html/badges/shappyheart.gif) ![Minigame Comp Winner Badge (1) [*]](https://archive.mfgg.net/html/badges/mcg1.gif) ![Secret Santa Badge [*]](https://archive.mfgg.net/html/badges/present.gif)

Group: Members
Posts: 258
Member No.: 3660
Joined: 19-April 07
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
Not sure. What does matter is the order in which your instances are calling the step event, and you can lose control of that when you deactivate things. First I'd make absolutely sure whether that's your problem, because it's a fairly obscure glitch. Use show_error to have each instance output its own ID during step. Look for the same ID to appear more than once per frame. If that doesn't happen, then your problem lies elsewhere. I ran into this issue a year ago and I've forgotten all of the specifics by now, sorry. Here's the post I made at the time. I don't remember exactly how I solved it. You may also be interested in these two pages: http://www.gmlscripts.com/forums/viewtopic.php?id=1625http://www.gmlscripts.com/forums/viewtopic.php?id=1627 This post has been edited by exenefevex on Oct 31 2009, 03:23 PM
--------------------
|
|
|
Gardevoir the Shroob |
|

I'm still thinking what to say here.... Toads maybe?

Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
| CODE |
instance_deactivate_object(obj_solid) instance_deactivate_object(obj_slopeparent) instance_deactivate_object(obj_solidtop)
instance_deactivate_object(obj_basicenemy)
instance_activate_region(view_xview[0] -24, view_yview[0] -24, view_wview[0] +24, room_height, true)
|
Well, I fixed it. Now the with statement's gone, everything is OK. Glitch eliminated, problem solved, topic can be closed  . EDIT: I give you credit exenefevex. This post has been edited by Gardevoir the Shroob on Nov 1 2009, 06:34 AM
--------------------
Coming Soon:Super Mario 2009: The Stars Story Princess Shroob will be back, even more evil than she was in Partners in Time before. Can Mario and his friends stop her once again before it's too late?
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
[ Script Execution time: 0.0612 ] [ 14 queries used ] [ GZIP Enabled ] [ Server Load: 2.22 ]
| |