Skip to content

Add a little code optimization to Sprite_Character

WARNING

  • To ensure anyone can test without Studio 2.0, this MR has been made from the PSDK .26.20 commit. Please make sure to NOT rebase the branch until the merging can be done (after the code review and tests)

MR Description

  • This MR adds a little optimization to the code that manage the bush_depth attribute (and its consequences) of the Sprite_Character. Currently, when the value sent to #depth_bush= is superior to 0, the code does some value assignation. As this method is called every single update, this means that these assignations are run each update if the value is positive, for each Sprite_Character. This MR ensures this update isn't done if the value sent is the same has the one currently known by the Sprite_Character, saving some precious calls at each update.
  • During my test, I was able to see an increase of about 150-200 Ruby FPS at max, and around 100-150 FPS at mean.

Tests to realize

  • Launch PSDK without this MR on a map and record your Ruby FPS min/mean/max, then record the same thing, this time with the MR applied: you should see an increase of the Ruby FPS.
  • Test if tiles set as bushes still work well (the swamp systemtag acts as one, and you can add the bush property to the tile using RMXP's tileset editor (should be the fourth option)
Edited by Zøzo

Merge request reports