Experimenting with Window.update

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
I was experimenting with window x, y, width, and height, and I found something interesting about them.

I tried the following code:

class Window alias test_update update def update test_update #self.x += 0 #self.x += 0 #self.x += 0 #self.x += 0 #self.y += 0 #self.y += 0 #self.y += 0 #self.y += 0 #self.width += 0 #self.width += 0 #self.width += 0 #self.width += 0 self.height += 0 self.height += 0 self.height += 0 self.height += 0 endend
And based on the result that I got, while the x and y operator methods don't affect anything, the width and height operator methods will slow down your game by speed / 2n (with n is equal to how many times operator method is called, and of course 2-n is a rough rounding).

Does anyone has any clues about it? 

Edit: 

Btw,

use the following code if you want to see how your game is moving frame by frame.

Code:
class Window  alias test_update update    def update    test_update    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0    self.height += 0  endend
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I don't seem to get the slow down when using those, not even a single spec of slow down... well at least I don't run .height and .width on update... so it might be because of the fact that ur running it on update, meaning it runs every frame...
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Lol that's pretty interesting, just one height update caused my FPS to go from 120 to 15. Well, that's cause there are 7 windows on the map scene and you put in the Window class.


When I moved it to the message window, it went from 120 to 70 for a single height update every frame.


The window must be doing something really questionable, which sort of indicates that you shouldn't be messing around with your windows.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
anyways, most things that concerns graphics seem to be normally slow and as such not really recommended to be used per frame... I think all the more since RM seems to utilize only the CPU (from other threads?) and from what I read from other forums, having the CPU perform the graphic tasks isn't really nice...
 
Last edited by a moderator:

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
Well, if we could pin-point which graphical tweaks make the performance slower / much slower, we could find solutions to reduce the performance cost from our graphic scripts. : P

self.x and self.y don't have much performance cost compared to self.width and self.height. I'm guessing that self.width and height have something to do with the window's content, and tweaking them would perform unknown number of methods. Hmmm.

Oh well, I'll let you folks know when I found other interesting stuffs about RGSS.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
well, some of the contents do adjust with window size... plus the Window's bitmap (the one called contents) itself will adjust itself based on the window size...
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
well, some of the contents do adjust with window size... plus the Window's bitmap (the one called contents) itself will adjust itself based on the window size...
Do you have evidence of this? I've never heard that before but that sounds a bit strange.


I know you made a post about how window contents and GUI's automatically adjust themselves when you re-size the window but I didn't think you were talking about an existing function.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
EDIT: I forgot that I made them refresh... :)
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
`create_contents` re-builds the contents bitmap based on width and height, yes.


Updating your width and height does not call that method automatically.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
yeah... actually, I'm wrong... I forgot that I actually made my windows to refresh... thus calling that method...
 

Mithran

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
404
Reaction score
217
First Language
English
Primarily Uses
Good find.


The height and width operators are actually much slower than I anticipated. The slowdown is at the metadata level, though, which probably contains instructions to reconstructs the entire window regardless of whether it is even visible or not. Since windows don't normally need to change size and shape during run time, this isn't something we would normally optimize around. The accessor probably should have a safeguard that prevents it from needing to perform the metadata level stuff if the value is the same, though, that is easy enough to implement.


If you need to actually change the height or width of a window often enough to cause slowdown, consider only performing the action once every n frames. If you really wanted it to be smooth, you could fake the look of a window by constructing it with Sprites, but those also have some serious bottlenecks so that would be an extreme case.
 

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
Good find.

The height and width operators are actually much slower than I anticipated. The slowdown is at the metadata level, though, which probably contains instructions to reconstructs the entire window regardless of whether it is even visible or not. Since windows don't normally need to change size and shape during run time, this isn't something we would normally optimize around. The accessor probably should have a safeguard that prevents it from needing to perform the metadata level stuff if the value is the same, though, that is easy enough to implement.

If you need to actually change the height or width of a window often enough to cause slowdown, consider only performing the action once every n frames. If you really wanted it to be smooth, you could fake the look of a window by constructing it with Sprites, but those also have some serious bottlenecks so that would be an extreme case.
Yea, that's basically what I do with an additional safeguard, where it will still perform that metadata level stuff for the first update after initialization regardless any change. xD
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top