instance or objects? the best performance

Discussion and feedback on Construct 2

Post » Sun Mar 09, 2014 6:02 pm

@Colludium , thanx for the test

so yes, using different objects causes a slight overhead, what i find interesting is that its not a constant cycle, draw calls go as low as 0.1 (same object) and then go back to maximum calls for a while, maybe thats garbage collection and then a redraw is needed, there is also not much difference in using canvas2d for me.
changing the object size and alpha values seems to take an extra hit, im not quite sure how drawcalls actually work.
ImageImage
B
71
S
22
G
7
Posts: 827
Reputation: 10,177

Post » Mon Mar 10, 2014 10:48 am

Colludium wrote:@Stiivais, perhaps a little too harsh with the "your second language grammar is not as good as mine" banter.... How do you know he wasn't trying?

Because when i was learning english i often used google or searched for similar phrases to the ones in my native language, so that i could write a coherent and logically laid out text, and even if i got some words wrong, the people reading it could interpret it easier (and probably figure out what i meant without any hassles) because of its structure and punctuation, which doesn't differ that much between languages. Posting something like what he did just shows lack of effort, or even desire to learn the language. Criticism solves this problem.

As for that little test of yours - drawing performance isn't what you should be testing here, but rather the way of how the event system deals with multiple instances. Set up collision checks between the different objects, have it done in such a way that there are checks done for groups of objects with different instance variables in the first test and between the different object types in the second test - just be sure to have the same amount of "groups" in both tests, e.g. 5 different instance variables and 5 different object types.
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Mon Mar 10, 2014 4:19 pm

@Stiivais

As for that little test of yours - drawing performance isn't what you should be testing here,


great, you explain your first condescending tone and start another one... ;)

this was a test on drawcalls with multiple instances or multiple objects,
but please if you want to put the effort in it, add your test, it would be interesting.
ImageImage
B
71
S
22
G
7
Posts: 827
Reputation: 10,177

Post » Mon Mar 10, 2014 7:43 pm

@vtrix
Talk to the picture, see how much it cares.
I started making a test and i have to say that the single object approach is flawed, as there are problems when you try checking for collisions between instances. I'd like to see you manage to check for collisions between the instances of the same object - .CAPX
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Mon Mar 10, 2014 9:25 pm

thank you all for the reply, maybe I will continue to use less object and more variable/event...

I made a test and on mobile and is better to make more instance and change the variable to make a "new" object with the same instance (just change the frame of animation and edit the variable of the instance...) in a long time will be difficult, but is better...

Stiivais wrote:
Ribis wrote:(my english is not very good)

Image

Usually i'd try to understand what is being said, but trying to decipher what you wrote... just gives me a headache.
It's like you're not even trying. >_>

...
I'd say that making many different types of objects for different purposes would be better, as it would be easier to manage and edit, and any behaviors used wouldn't be applied to all of the objects. Probably the same for checking if conditions are true.


a lot of people understand my post, I don't like to use google translate, I just use for a new word when I don't know how I can say something new, but I wrote the first post in 3 min and for me is a good....
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Mon Mar 10, 2014 9:59 pm

@Ribis

if you should want collisionchecking on same object

you can put the one object in a family and then check between the family and the object

or use system pick nth instance in a subevent (collision filters 2 instances)
sytem pick instance 0: do something
system pick instance 1: do something

and probably also by variable or uid, ..
ImageImage
B
71
S
22
G
7
Posts: 827
Reputation: 10,177

Post » Mon Mar 10, 2014 10:07 pm

vtrix wrote:@Ribis

if you should want collisionchecking on same object

you can put the one object in a family and then check between the family and the object

or use system pick nth instance in a subevent (collision filters 2 instances)
sytem pick instance 0: do something
system pick instance 1: do something

and probably also by variable or uid, ..


yes, this is a good idea to check the collision...

but for now, the collisionchecking doesn't make any lag in my game, just the Sine behavior make a lag (just for 4 object) when I try on cooconJS with webGL on...
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Mon Mar 10, 2014 10:17 pm

thats odd for only 4 objects, you're sure its the sinebehavior? no lag if you completly remove the behavior?
anyway hard to tell whats causing that..
ImageImage
B
71
S
22
G
7
Posts: 827
Reputation: 10,177

Post » Mon Mar 10, 2014 11:35 pm

vtrix wrote:thats odd for only 4 objects, you're sure its the sinebehavior? no lag if you completly remove the behavior?
anyway hard to tell whats causing that..


yes, is for the sine behavior... it's strange but cooconJS works better if you disable the webGL...
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Tue Mar 11, 2014 4:43 am

I experimented with this at one point.

It seems like the way construct works is that it renders objects in the order of their uid. If there is a string of the same object type occupying a range of uid values (say, 1 thru 100), some optimizations kick in (don't exactly know what).

OTOH, if they are all jumbled, the renderer is constantly switching to a different object, and it slows down the draw calls. Thus, if you have a lot of objects that are spawned randomly, draw calls go up, even if you only have a couple different types of objects.

I imagine having the same object with each instance having a different frame would cause a drop in performance compared to the same object with each instance having the same frame. But I could be wrong, as I haven't experimented with this.

Here's the thread I started where this was discussed: draw-calls-triple-why_t95882

Ashley's response partly covers what I'm talking about above, except for the UID sorting, which I inferred from my own tests.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: Ted Games, Yahoo [Bot] and 1 guest