Two seemingly similar Capx. One takes 11% more CPU to run.

Discussion and feedback on Construct 2

Post » Thu Jun 09, 2016 1:43 am

I downloaded a large tutorial. I studied it and disabled everything that wasn't needed for what I was trying to do. I created a new project that does exactly what the Tutorial does. The only difference is variable names and loop names. The only image that is used is even the same format, same 32x32 size and similar in file size. (My image 400 bytes and tutorial image 430 bytes). The project settings are the same. I don't notice anything different. On start up they both create 144 boxes using the exact same loop. That is all. They both just make 144 boxes and does nothing else. The tutorial is disabled so it can't do anything else yet. They are both being ran from single file Capx, not from project files.

When they are ran in debug mode...

Tutorial
144 green boxes on a white background
60fps
Starts at 14% lowers and stays at 6% CPU
2.2 mb memory
Renderer webgl


My File
144 green boxes on a white background
60fps
Starts at 29% lowers and stays at 17% CPU
2.2 mb memory
Renderer webgl

Both have the same canvas size, time scale, same scale, same project settings, same Window Size, both letterbox scale, ran in same browser, same everything as far as I can tell, even the Project configuration settings are the same. I even checked the layout properties/effects and the object properties, and they are the same. The event sheets even have the same events in the same way/order. The only difference is my file doesn't have any of the disabled events. Everything is disabled correctly. I disabled everything at once and only enabled the needed loop and the "on start of layout" call. If wanted I can remove everything unneeded from the Tutorial File to see if that helps. They 144 boxes are placed together in a 12x12 grid and look the same when ran.

The CPU on mine runs about 11% higher than on the Tutorial. It doesn't matter if I am running them at the same time or ran separate. 17% seems to high for only rendering 144 boxes on a white background.

Does anybody have any idea why this is happening? It is only the beginning foundation of a game, If I add more it will only get higher. I think 17% CPU is high for only what little is happening. I even started over a few from scratch and got the same results.

All it is, is defining a function and calling a function. My event sheet consists of 4 Global Numbers and 2 events, 1 event has 2 conditions and an action.

System/
on start of layout/
call function "Functionbox


on "Functionbox" /
"Run loopname 12 times" &"Run loopname2 12 times"/
System/ create object loopindex...etc

The events work, that isn't the issue. Just showing I don't have some Every Tick non sense. As soon as it creates all 144 boxes it shouldn't be doing anything, but it remains at 17%.

I don't have online storage and prefer not to make an account anywhere for storage, Sorry I know it makes it harder. I do have Steam if someone wants to see the files.
B
59
S
33
G
13
Posts: 223
Reputation: 12,105

Post » Thu Jun 09, 2016 2:43 am

I am not sure what is going on now... I didn't think it would matter, but out of curiosity I erased everything that wasn't being used (disabled) in the Tutorial and performance went down.

Tutorial
144 green boxes on a white background
50fps
Starts at 48% lowers and stays at 38% CPU
6.4 mb memory
Renderer webgl


A bit odd.. When I remove unneeded things from the project the performance goes down. The things I removed were disabled and Global variables that weren't being used because of the disabled events. This is good for me. I can stop looking for what is causing it. I would like an explanation though if possible. How something can be disabled and have good performance and then if deleted it effects performance for the worst. I understand if what was removed was mathematically supporting the enabled events, but they were disabled..... The ghost in the machine...
B
59
S
33
G
13
Posts: 223
Reputation: 12,105

Post » Thu Jun 09, 2016 6:04 am

Ok you know what I usually send this link to people working on mobile devices but for your case I will make an exception . I wrote 8 critical tips maybe hidden in those tips is the answer to your question

optimizing-mobile-games-8-very-critical-tips_t174634

Take a look is how I got my 2D shooter optimized and running super smooth on mobile. Maybe there is something in there you haven't thought of.GoodLuck!!
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Thu Jun 09, 2016 7:14 am

it depends on your PC too. if you have a stronger PC / different architecture in cpu causes to use less % then on the PC / CPU it was tested on.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359

Post » Thu Jun 09, 2016 8:47 pm

Both Capx files had the same events and performed differently. When I erased disabled events and unused objects in the Tutorial the frame rate went down and the CPU and Memory use went up. Only thing in the event sheet was to make 144 boxes in 12 columns and 12 rows and then nothing should be happening after that. Was only expected similar results for both Capx and high CPU usage didn't make sense.

My computer was around 75% better in performance than most tested on a performance site, that wasn't the issue. I looked at the Optimizing Mobile Games article, the only thing I am guilty of was a larger screen resolution than needed. I was going to adjust it as needed later on, it is just easier to work with higher resolution. The 12x12 grid is needed. Since I don't need a background and I can't add variables to Tiles in a Tile-Map it is impossible for me to use a Tile-Background/Tile-Map for what I am doing, unless there is a way I don't know of. It is the only area in the whole game I am creating this many objects, it will be invisible and is being done to prevent preventable calculations later on to help CPU. It is nice to see a post that reinforced what I already knew though. I always try to optimize everything no matter what it is.
B
59
S
33
G
13
Posts: 223
Reputation: 12,105


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests