This is probably already known to most but just in case, like.

What with MMF2 having nested folders it can be easy to get lost in reems of code. On my project I've had times where after a few minutes of play the game can start to lose FPS. At first I thought it was too many objects being spawned, or a fastloop that wasn't deactivated.

So I came up with a little solution to easily diagnose MMF2 games as they're running. All it does is pool together data, you can use the date & time object but will need the Ini object (or similar).


1. Create a Speedlog group and a subgroup (speedlog2 is what I use) which is initially deactivated.

2. Under Speedlog make an event that causes the trigger. In my game I'm using the = key. Pressing this key enabled the Speedlog2 group.

3. [optional] With a only one action when even loops line add anything that can freeze the player or anything that stops the level from changing. In mine I just set it to stop the players movement.

Might be a good idea to add a sound sample or something that lets the dev chap know that the speedlog has been activated. Just incase you accidentally press the key later when you've forgotten about the

coding and wondered why you've suddenly frozen.

4. How and how often you gather the results is up to you. I've just got mine using the every 5 seconds line.

5. [important bit!] Now to gather the data.

Ini object
Set current file to Appdrive$+Appdir$+frames.ini
Set string Str$(frame timer( global timer )) to Str$(FrameRate)+ +Str$(Total Objects)

-that space bit is just for seperation purposes
-global timer is just an active which always adds 1 to the frame value, just for timing and event purposes. You can just use any kind of counter or timer so long as it can be used as a benchmark.

6. Then add a deactivator line. In my game, so I can just set this running and come back later I like to set the game to quit after 2 minutes 30.
You's can also add the lines to the deactivatoin line-

Set string above was completed to Str$(day of month of( Date & Time))+/+Str$(month of( Date & Time))+/+Str$(year of( Date & Time))+ at +Str$(hours of( Date & Time))+:+Str$(minutes of( Date & Time))+.+Str$(seconds of( Date & Time))

It should then output a file looking somewhat like this-

[]
316=59 310
602=50 302
894=59 302
1171=59 301

above was completed=07/11/08 at 13:19.04



What to do after all that?
I find the best way is to deactivate large numbers of groups and see if it impacts on the results, then reopen them a few at a time until the slow down has been isolated.



That's pretty much it and it's been a really helpful bit of coding for me.