Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

Massive FPS drop after I modify anything in my code live

A topic by gerecsgo created Jul 14, 2022 Views: 244 Replies: 3
Viewing posts 1 to 3
(2 edits)

Hi, I just purchased GMlive and I'm using it with a pretty big project. I created a simple object to test it, and I realized that after I alt+tab out of my game and modify anything in my code (the Draw GUI  event in this case), the FPS drops significantly. ( From 350 - 400 FPS to 70FPS). The FPS stays decreased until I recompile my game, but if I put the whole content of the Draw GUI  event in a comment live, it climbs back to the normal value.

I thought that the if(live_call()) return live_result; calls are affecting the performance but then I realized that the FPS drops only after I modify the Draw GUI event at least once and I save it live. Is this normal?

EDIT: I made some testing, it looks like it only happens with the Draw GUI event.

Developer

Strictly speaking, this doesn’t make any sense - GMLive has no drawing logic whatsoever beyond an example in obj_gmlive (which isn’t in Draw GUI either). If you can send me a small sample project that reproduces this, I can send it to YoYo Games and try to explain the issue to them.

(3 edits)

Thank you for your fast response.

So I realized that this must be a weird memory leak issue that I still don't understand. You can see it in the video, that after I modify a variable that is not even referenced, the FPS decreases significantly. When I put the repeat loops in comment, the FPS goes back to the normal value, but I don't understand why, since the loops did not decrease the FPS until I modified something.

Check out this short clip: 

And this is the code: https://pastebin.com/cH623DuXAs you can see, in the debugger there is a spike in memory usage and that is when the FPS starts to drop. Before that, the memory usage stays at a constant level. Does the GMS VM have a memory limit or something? Do I need to increase the memory limit somehow? How does putting the repeat loop inside a comment fix this problem?

I tested it with the old inventory's Draw GUI event too,( which is way more complicated with more loops) and the results were the same.

Developer

You can try with a new version - since GMLive has to compile and run changed code itself, it’ll always be slower than original GML code, but it should be faster now.

I also recommend getting rid of copy-pasted expressions for item count outline in favor of local variables.