How do I better optimize my map scrolling?

Get help using Construct 2

Post » Sun May 12, 2013 9:41 am

I have set up a system that loads data from one array to another, but it checks for each part of the far larger array every tick, which massively decreases my performance. Is there a way for my game to only use array data when I need it?

Capx file:
Posts: 3
Reputation: 306

Post » Sun May 12, 2013 2:15 pm

I see you got yourself some event sheet there. Great work, but now, let's see where can we improve this:

To be honest, you are generating a world, and that might take some time, no doubt about that. But to be frank, 88 events are quite big, and skimming through this is a little rough for me, if possible, could you just tell us your main procedure?

On the other hand, skimming through your event sheet, I see that you got quite a number of iteration there with arrays especially on Blockload event group. I see you got Array instance with size of 220 x 220 x 1. And you are iterating these arrays in every tick call.

While array allows you to store things neatly up to 3D. Accessing/Manipulating arrays in many dimensions is real performance eater. This holds true, not only in C2, but in every other programming language, game engine, etc.

I also see from event sheet 1, event number 60-64, I see identical actions in those events. I believe you could combine those into just 1 event for that. Why did you do that for? You could use "Is between values" condition right in the General section above "Global & Local variables" section instead, so:

1 = TextStack = 5

Also, no need for "every tick" after those conditions in event 60-64. Remember, events are always called every tick already. You will want to use "every tick" only when there are no conditions to check.

Furthermore, in event 15-39, I believe your intention is that you want these to run only once? Right now, I see that they will run in every tick, as they are not sub-events under "on start layout" event. Because of this, all those events will run every tick, not to mention, you are also iterating your array in there every tick.

Sorry for bad response, but could you elaborate more on what exactly are you doing in several key parts? Or else, what we can suggest you may not help you at all.

In fact, I see that you are having an event sheet logic design problem. Focus on each part separately as of now, and ask the community accordingly for better event sheet design.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: (use Chrome on Windows for best performance)

My sites:
Posts: 408
Reputation: 7,965

Post » Sun May 12, 2013 9:05 pm

[QUOTE=keroberos] I see you got yourself some event sheet there. Great work, but now, let's see where can we improve this:[/QUOTE]

Sorry about that, I found the largest performance hog is the process which sends the mapdata in my overall array over to my array used for generating what's on screen (event 79). I'll work on getting the rest of the events less sloppy later on, but right now I just need to pin down this one thing:

I've tried making it only add to the screenspace array for the elements that would be on the screen, but it only adds a minor performance boost. 21:13:04
Posts: 3
Reputation: 306

Return to How do I....?

Who is online

Users browsing this forum: RoboFrosty and 15 guests