TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Perfomance Monitor/ Get FPS

Open trelemar opened this issue 8 years ago • 7 comments

Tools like FPS, CPU usage, Memory would be nice for optimizing our code. Working on very demanding games it is hard to tell if a code change effects frame-rate much. At least having a built in fps function would be very appreciated.

trelemar avatar Aug 06 '17 22:08 trelemar

I started working on a profiler for TIC-80 in a fork. You can see what I have so far in schraf/TIC-80. It shows the frame time in the top panel, the frame details in the middle panel, and then the memory usage in the bottom panel. Looking for feedback. It still needs some polish and minor bug fixes, but I think it is almost there. To add profile markers to the code you need to add perfbegin("some tag") and then a perfend() call. It should be fairly low overhead to use. profiler

schraf avatar Nov 18 '17 04:11 schraf

is it ready or abandoned?

geekhunger avatar Jun 12 '18 14:06 geekhunger

I tried to keep it updated with the master branch but eventually stopped working on my TIC-80 project. Not sure how hard the merge would be at this point. If I recall the feature itself was pretty much working with maybe some edge cases that still needed to be addressed.

schraf avatar Jul 08 '18 19:07 schraf

Working on very demanding games

Do you have an example of such a game, just for reference?

. At least having a built in fps function would be very appreciated.

I actually don't think this is what we want if we're trying to make games that work for everyone. What matters is the lowest common denominator setup, not someone's personal development workstation. You might not be dropping frames, but your game might still be WAY too slow on someone else's setup.

That's the information you really need to know.

This is related to #1788. If we could figure out what a proper "expense" per frame was (that wasn't bound to CPU speed) then we could easily tell if someone was within that constraint or not. You could back convert this metric into a FPS (or "CPU" like) calculation (like Pico-8) does, but really you just want an absolute way of measuring resources consumed against some idea of what a "good" utilization actually is.

If you're dropping frames on MODERN hardware you're way, way off into dangerous territory. We need to provide warnings way before someone would start skipping frames on most modern PCs.

joshgoebel avatar Jan 10 '22 01:01 joshgoebel

Do you have an example of such a game, just for reference?

I'd love it if we had an example of some carts that were CPU (math) bound rather than drawing bound...

joshgoebel avatar Jan 10 '22 01:01 joshgoebel

Screen Shot 2022-01-09 at 10 58 50 PM

See "CPU" utilization meter in bottom right.

joshgoebel avatar Jan 10 '22 03:01 joshgoebel

I'd love it if we had an example of some carts that were CPU (math) bound rather than drawing bound...

As you said it depends on the machine you use. On my nintendo 2DS this cart https://tic80.com/play?cart=2452 is CPU bound at the beginning of the game when the bot has to test many options. It could be CPU bound on any machine if I was using brute-force methods. (Note that it's also far from being optimized, I'm not a programmer even though I love coding ^^.)

Skeptim avatar Aug 24 '23 20:08 Skeptim