Volnaiskra
  • Spryke
  • Volblog
  • downloads
  • Presskit
  • About

Introducing volPROFILER - code profiling in Clickteam Fusion 2.5

27/6/2017

0 Comments

 
I'm cramming as much eye candy and mechanical nuance into Spryke as I can, to make it as impressive and satisfying to play as it can possibly be. That means that I push the Clickteam Fusion 2.5 engine pretty hard. Overall, the old girl copes pretty well with what I throw at her, but I'm still taking optimising very seriously, to make sure that Spryke runs smoothly on as many PC setups as possible. 

A while ago, I wrote a post describing some of my optimisation efforts. A very helpful commenter pointed out that I really shouldn't be blindly optimising everything I can, but should be profiling the code to find the bottlenecks, and then devote my energy optimising those.

It was very good advice. The trouble is that Fusion doesn't have any kind of native profiler built-in. And cobbling together one's own was more or less impossible because Fusion didn't provide the means to measure code time finely enough. 

Well, it's a few weeks later, and I'm now pleased to say that I've gotten around these problems, and have built Fusion's first ever code profiler that can accurately measure code performance in microseconds! I'm sure it's not as full-featured as the profilers that come with 'real' programming environments like Visual Studio, and it only measures the performance of your Fusion code (not, for example, the DirectX & GPU side of things). But it's still pretty damn useful, if I do say so myself. It's called volPROFILER, and the Clickteam developers among you can get it on the Clickstore for just $2.99.
Picture
volPROFILER in action in Spryke

Background

Until now, it's been impossible to measure the processing times of Fusion events with any meaningful accuracy. The timer object measures only in milliseconds, and can only measure between one frame and the next, not inside the frame. The Date & Time object can measure inside the frame, but only in hundredths of a second. Both methods are much too coarse to be useful for performance profiling.

To achieve 60fps, your game must average less than 16.7 milliseconds per frame. That includes not just code, but draw calls, DirectX stuff, clickteam movements, animation processing, Fusion's overhead, OS overhead etc. Therefore your code needs to take much less than 16.7ms to execute - perhaps less than half of that. And since your code is probably comprised of many components (movement, enemy AI, input, audio, HUD, etc.) you'll want most or all of those components to fall well below 1ms each. So trying to measure some small portion of your code using the timer (1ms accuracy) would be near-useless even if it let you measure within the frame (it doesn't). Using the date & time object (10ms accuracy) wouldn't even come close.

To solve this problem, I specially commissioned the famous Looki (well known in Clickteam circles - but even if you haven't heard the name before, there's a good chance you already use some of his shaders or extensions) to build a timer object that's capable of measuring in microseconds (millionths of a second, or μs), within the frame. This object is called Microtimer, and I'm making it freely available to everyone - it will hopefully be findable in the Clickteam Fusion 2.5 extension manager by the time you read this (if not, get it here). You can quite easily use it to build an in-game timer that measures bits of your code.

But if you would like a comprehensive, carefully-designed and user-friendly profiler, and want to save yourself a few days' work (and help me offset the cost of commissioning the microtimer) then you can get the solution I've built, volPROFILER, for 2.99 on the Clickstore.

volPROFILER Features

  •  Easy to use. 3 minutes to setup!
  • Toggleable in-game panel shows execution time of your code, as well as time taken between code loops
  • Uses the new Microtimer object by Looki (commissioned by me, specially for volPROFILER!) for unprecedented accuracy
  • All results shown in 3 ways: real-time (for frame-by-frame analysis), delayed-update (for easy readability), and cumulative average (for optimal reliability)
  • 12 slots to monitor any code segments you like - just drag the readymade volPROFILER event groups around your chosen code and volPROFILER does the rest!
  • Displays performance of all unmonitored code to expose hidden bottlenecks
  • μs mode: displays all results as absolute time elapsed, in microseconds
  • % mode: helps you quickly find your most expensive code
  • tb mode: shows each code segment's consumption of your time budget, or how fast all code should execute to ensure smooth 60fps (calculated as 16667 μs minus average between-frames time)
  • fc mode: shows the percentage of a single frame that each code chunk consumes at your current average framerate
  • volPROFILER panel overhead time is measured and shown, but excluded from all other results, so it won't pollute your findings
  • Continues to collect performance data for you even when panel not in use, with very tiny footprint (measured at approx. 4μs, or 0.000004 seconds per frame) 
  • Contains in-game help panel
  • Integrates seamlessly with VACCiNE
  • Open Source - made with well-commented Fusion events so you can easily modify it if you wish
  • Instantly save results to txt file with a keypress

Picture
You can get volPROFILER on the Clickstore here ($2.99). For more info and/or discussion about volPROFILER, see its forum thread here. To get just the Microtimer object on its own, go here (free).
0 Comments



Leave a Reply.

    Author

    Picture
    I'm Dave Bleja. I quit my career to make one the most immersive, deeply crafted platformers of this generation. 

    Spryke is the story of a dimension-hopping cyberfish who discovers the joys of dry land!

    Stay in the loop

    Sign up for newsletter
    Follow @Volnaiskra

    RSS Feed

get updates

Follow the progress of our original game Spryke, along with Skyrim mods and more, on the social media platform of your choice





© 2015 Volnaiskra
  • Spryke
  • Volblog
  • downloads
  • Presskit
  • About