Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> [GM7] Speed problems when deactivating instances, Game speeds up when deactivating objects
Unspecified
Gardevoir the Shroob
  Posted: Oct 31 2009, 12:20 PM
Quote Post


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


Group Icon
Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09

Status: (0d) [--]


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

user posted image

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?
PM
Top
United States
YoManRuLz
Posted: Oct 31 2009, 12:33 PM
Quote Post


sit down, it's just me


Group Icon
Group: Members
Posts: 152
Member No.: 6502
Joined: 6-September 09

Status: (0d) [--]


my guess would be it's the room speed, try 30


--------------------
PMEmail Poster
Top
United States
RetroXYZ
Posted: Oct 31 2009, 12:50 PM
Quote Post


Standard Member
[*][*]

Group Icon
Group: Members
Posts: 2714
Member No.: 4325
Joined: 27-August 07

Status: (0d) [--]


QUOTE (Gardevoir the Shroob @ Oct 31 2009, 01:20 PM)
There isn't a function to deactivate a certain object within a region

instance_deactivate_region(x1,y1,x2,y2,inside,notme)

x1/y1/x2/y2 are the bounds of the rectangle
inside is true/false depending on if it is inside the box or outside of it
notme is whether or not to include the instance performing the code in deactivation
PMEmail PosterMSN
Top
Qatar
Keyser Soze
Posted: Oct 31 2009, 12:51 PM
Quote Post


The Lights are Going Off
[*][*][*]

Group Icon
Group: Members
Posts: 4673
Member No.: 3299
Joined: 13-February 07

Status: (0d) [--]


QUOTE (YoManRuLz @ Oct 31 2009, 01:33 PM)
my guess would be it's the room speed, try 30

That has nothing to do with it, GM defaulting to 30 is a plague anyways, 60 fps = better looking.


--------------------
QUOTE (
Raie @ Sep 18 2009, 08:55 PM)
Keyser you're the best person ever.
PMEmail PosterYahooMSN
Top
United States
YoManRuLz
Posted: Oct 31 2009, 01:23 PM
Quote Post


sit down, it's just me


Group Icon
Group: Members
Posts: 152
Member No.: 6502
Joined: 6-September 09

Status: (0d) [--]


QUOTE (Keyser Soze @ Oct 31 2009, 12:51 PM)
That has nothing to do with it, GM defaulting to 30 is a plague anyways, 60 fps = better looking.

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.

This post has been edited by YoManRuLz on Oct 31 2009, 01:26 PM


--------------------
PMEmail Poster
Top
Unspecified
Gardevoir the Shroob
Posted: Oct 31 2009, 02:08 PM
Quote Post


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


Group Icon
Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09

Status: (0d) [--]


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

user posted image

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?
PM
Top
Unspecified
exenefevex
Posted: Oct 31 2009, 02:10 PM
Quote Post


Regular
[*][*][*]

Group Icon
Group: Members
Posts: 258
Member No.: 3660
Joined: 19-April 07

Status: (0d) [--]


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.


--------------------
PM
Top
Unspecified
Gardevoir the Shroob
Posted: Oct 31 2009, 02:42 PM
Quote Post


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


Group Icon
Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09

Status: (0d) [--]


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

user posted image

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?
PM
Top
Unspecified
exenefevex
Posted: Oct 31 2009, 03:12 PM
Quote Post


Regular
[*][*][*]

Group Icon
Group: Members
Posts: 258
Member No.: 3660
Joined: 19-April 07

Status: (0d) [--]


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=1625
http://www.gmlscripts.com/forums/viewtopic.php?id=1627

This post has been edited by exenefevex on Oct 31 2009, 03:23 PM


--------------------
PM
Top
United States
Baroque
Posted: Nov 1 2009, 06:14 AM
Quote Post





Group Icon
Group: Members
Posts: 817
Member No.: 6076
Joined: 11-March 09

Status: (0d) [--]


... can you show us the code and their triggers for the enemy objects themselves? If the presence of the enemy object is causing this glitch, shouldn't that be the first place you look?


--------------------


DeviantArt (DA needs update) | Clean FurAffinity Clean FA | Why I Cut Quotes
You see things, and you ask, 'Why?' But I dream things that never were, and I ask, 'Why not?'


QUOTE (Ryo)
its the correct form of to.........lemme run it down for ya

to is used when your talking about the number. good way to remember this: to has to letters

too is used when your talkin about actions in stuff.

two is used when your talking about places and locations
PMEmail PosterAOL
Top
Unspecified
Gardevoir the Shroob
Posted: Nov 1 2009, 06:28 AM
Quote Post


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


Group Icon
Group: Trial Members
Posts: 8
Member No.: 6623
Joined: 31-October 09

Status: (0d) [--]


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 nod.gif.

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

user posted image

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?
PM
Top
United States
Baroque
Posted: Nov 1 2009, 07:44 AM
Quote Post





Group Icon
Group: Members
Posts: 817
Member No.: 6076
Joined: 11-March 09

Status: (0d) [--]


QUOTE (Gardevoir the Shroob @ Nov 1 2009, 03:28 AM)
~ code ~

Well, I fixed it. Now the with statement's gone, everything is OK. Glitch eliminated, problem solved, topic can be closed nod.gif.

EDIT: I give you credit exenefevex.

... oh i see what you changed

i can't believe neither i nor anybody else caught onto that ...


--------------------


DeviantArt (DA needs update) | Clean FurAffinity Clean FA | Why I Cut Quotes
You see things, and you ask, 'Why?' But I dream things that never were, and I ask, 'Why not?'


QUOTE (Ryo)
its the correct form of to.........lemme run it down for ya

to is used when your talking about the number. good way to remember this: to has to letters

too is used when your talkin about actions in stuff.

two is used when your talking about places and locations
PMEmail PosterAOL
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0598 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 1.11 ]