[Solved*] Low Performance, large program. (Typical solution: Reboot ... )

edited June 2015 in Using Processing

Hi I'm new posting to the forum but I've been using a lot of useful information on it lately,

I'm developing a 2D platform game with processing 3.0a5 and Java 2.0 mode using PImages (most of them from kenney.nl) and SoundFile in the future. When I started the project I made my character to move using the keyboard, running at the default frameRate, which if I'm not wrong is 60. When the character movements were finished, added some platforms with collision (so it don't fall down)[still need to be polished], and after that, made a menu (New game, Load Game, Controls...).

After adding the menu, which is screen 0 and selecting New Game which sends us to screen 1, we can see the selected character and move it, but the performance by now decreases, it's like the program runs at 30fps or so (you see the character movements a bit clumsy). If I execute the program changing screen 0 for 1 since the very beginning, it executes with normal performance. The program has almost 1000 lines, but it's not finished yet.

To "clear" the screen I'm using background(img);, is it the best way to do it ? How can I solve this performance problem ?

Link to Github repository.

Sorry for my english. Thanks, Maral.

Sorry to bother you guys it seems a good reboot is all it needed... Windows 7.

Answers

  • Answer ✓

    You'll have much better luck if you boil your problem down to an MCVE instead of posting your entire project.

  • edited June 2015 Answer ✓

    To "clear" the screen I'm using background(img);

    Yes for JAVA2D renderer! For OpenGL-based renderers, image(img, 0, 0); is better though.
    Also set(0, 0, img); is equivalent to background(img);! ;)

Sign In or Register to comment.