Two small questions about performance

  • Hello everyone,

    Coming from C2, I refrained to use the SetColor effect on my (numerous) spritefonts since I noticed it was quite taxing on the CPU. In general I used as little effects as possible to run on older configurations.

    Now I see in C3 you can Set the Color directly as an Appearance action. I read it is more like 'Tint' than 'SetColor' but for spritefonts it's perfect.

    Is it costly in terms of performance to use this feature ?

    In my case I can have hundreds of spritefonts visible at the same time, either black or greyed. The text is always a figure from 0 to 9 and I used to have the two colors in my spritefont sheet with 0-9 being the black numbers and A-J being the grey numbers as a workaround to save on CPU. Setting the color the new way would definitely be a more flexible way to do it.

    My second question is unrelated and is regarding Picking.

    Would you say this :

    is much more efficient than this ?

    I used to do it the second way but I recently realized that grouping all the different checks in one single Picking could maybe be more efficient since every Sprites would need to only be checked and picked once. Do you think that's true ?

    Thanks for your opinion :)

    Have a nice day

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You're right, I have to try and make measurements myself whenever possible, it's not something that comes to my mind instinctively.

    However these were simple questions and I didn't want to reinvent the wheel ;)

    Ok ended up doing two tests and here are the results. I hope it will come useful to someone. Personnally that's the kind of good practices I'd like to see listed somewhere ^^

    1/

    - The "Set Color" appearance action is not CPU intensive (apart from the very first draw call when the action is used). It is thus entirely safe to use on a lot of spritefonts at the same time and is a convenient way to change color.

    - The "SetColor" effect is still very CPU intensive. It WILL bump the Draw Calls in a continuous manner if there are a lot of sprites using it.

    If you need to use it, consider disabling it as soon as you don't need it anymore.

    mediafire.com/file/qz9t8ps9czt172y/TestSetColor.c3p/file

    2/

    - Yes, several picking actions appear logically to be more CPU intensive (on the Event side) than a single "grouped" picking action. I'll try to use this method of picking as a good practice from now on.

    mediafire.com/file/2uqco0qx99nphkz/TestPicking.c3p/file

    See you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)