The Daily Click ::. Forums ::. General Chat ::. Optimizating our code
 

Post Reply  Post Oekaki 
 

Posted By Message

aphant



Registered
  18/05/2008
Points
  1242
29th August, 2009 at 15:01:32 -

I wrote a quick program this morning. It prints into an edit box for virtually every event. Why? To see how events and actions would affect the result.

First, the code:

Image


And now the output: (Basic gist of all 609 lines)

Start of frame
Top/before/enter/move/after/End
Top/move/kokok/End
Top/move/End
Top/move/End
Top/move/End
C-+CTop/move/End
Top/move/End
Top/move/End
Top/move/Close


There is only group open at the start of the frame, g.close. It isn't detected as being activated until the event checks if a group was activated. That seems obvious. But what's interesting is that every time that an event checks if a group was activated on the frame that it was activated on, MMF returns true and fires those actions. What is boggling is when g.kokok is activated, the only time "On group activation" returns true is when it is in the code group itself, despite there being such a condition after the group.

C-+C is from when the active hits an backdrop marked as an obstacle. As it is an immediate condition (red), it is only fired when that event becomes true. As you can see, regardless of where the red condition is in the code, it is always fired first on that event cycle.

Something else I noticed was interesting is what the "Group is activated" condition does. It implies that the event is part of that code group, without that event actually being inside of the code group!



What does everyone else make of this, and how can we use this knowledge to better optimize our code?

 

aphant



Registered
  18/05/2008
Points
  1242
29th August, 2009 at 15:02:30 -

And here's the full 609 lines, in case anyone cared:

Start of frame
Top/before/enter/move/after/End
Top/move/kokok/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
C-+CTop/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
C-+CTop/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
C-+CTop/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
C-+CTop/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/End
Top/move/Close

 

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14562

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
29th August, 2009 at 18:37:39 -

I like optimising my code so it's great to get a better understanding of how the event editor actually works. Although I'm not sure how we can use these finding to be more efficient.

That part about the 'Group is activated' condition is a bit unusual.

 
.

aphant



Registered
  18/05/2008
Points
  1242
30th August, 2009 at 03:53:39 -

I invite other people to conduct similar tests like these and report their findings. My findings won't be the only things we can explore, but the method used to reverse-engineer how the code loops is what we should be focusing on, to find out what actually makes our games tick.

 

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
30th August, 2009 at 15:57:11 -

lol, wth? Just put it like "top/move/end (x 40)" or so. Not like anyone's going to count them

Anyway, I sort of missed the results of this experiment, because I can't see what the code is supposed to do. Could you like sketch some quick flowchart or something about what exactly it's supposed to do? I sort of get the idea that the "top/move/end" repeats as many times as there are frames per second, or something.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click