Von Perkele's Forum Posts

  • Hi,

    If you have an equation that uses local variables, is it possible to save/load that equation in an array in a useful way?

    Let's say you have local variables "A", "B" and "C", and an equation like "lerp(A,B,C)", and you write that equation to an array. Is it possible to configure a condition that loads that array slot equation to variable "D" in a way that Construct will calculate the result of the equation, using your preset local variables, instead of thinking the array slot data is a string?

  • Thanks, this actually helps a lot when designing how to use effects. I did notice a slowdown when I moved the effects as much as possible to layers, and this certainly explains why.

  • Hi,

    Let's say that you use a specific effect, "brightness" for example. If you have conditions that affect the effect level of all instances equally it makes sense to control the effect by applying it to the layer the instances are placed in (if you can set a layer of their own for all these instances). It's supposed to increase performance. But if you have conditions that affect individual instances' "brightness" you have to add the effect directly to the object as well.

    But how should you set things if you have a combination of both situations mentioned above, meaning some conditions affect the effect levels of all the instances while some conditions only affect individual instances? If you in that case apply the effect to both the object and the layer, does that cause double rendering work that could be avoided by only having the effect added to the object? Or does it still increase performance if you can control the effect as much as possible through a layer, even though you in some conditions are still forced to also individually control the instance effect levels.

  • Link to Construct 3 Tutorials:

    tinyurl.com/y4jxv4f7

  • Great stuff.

  • Hi,

    Is collision checking only active if an "overlap condition" is run? In other words, does the fact that an object has collision checking activated matter at all performance wise unless collision checking is requested by a condition?

  • Hi,

    Yeah always have the loop conditions very last in the condition.

    Anyhow, it's good to know that functions that run every tick shouldn't cause slowdown any more than normal conditions that run every tick.

  • Hi,

    Yeah I have an UID parameter in all functions that identify which instance is picked. The function is run for each instance that meets the original conditions to trigger the function.

  • Should Functions then be always used to complete actions that take one tick to finish?

  • Hi,

    Is there any difference between having a subconditon action being run every tick and every tick calling a function that runs the same action?

    I'm asking because for some reason the FPS seemed to drop after I changed almost all of my actions to run as functions.

  • Hi,

    I think it could make sense storing the object related info in object variable if there is ever only one instance of that object, like a player character for example.

    But if you have a project that could potentially have 100 different "unit" objects and each unit has 30 "stats" (like max hp, max mp, attack, defense etc.), and there can be several instances of one unit simultaneously on the playfield, I don't think it makes sense to use object variables for that data if the stats are universal for all object instances. It doesn't make sense that each instance would have the same data cloned to its variables multiple times instead of using a single database.

  • Hi,

    So if you want to store lots of information it is better to use an array instead of creating a hundred local or global variables to store the information. Is it purely for practical reasons, because it's easier to handle the information in arrays? Is there a difference in performance between the methods?

    I'm planning to create rpg style stat system for around 100 units. Each unit has probably 20 - 30 different stats and they can all be upgraded and manipulated by different effects. In this case it seems obvious that either each unit should have it's own array for stats or all that information should be stores in a single array. Is there a benefit in choosing one big array or many smaller ones, or is it irrelevant performance wise and you should just choose to do whatever makes most practical sense?

    Then I have a biome system with 6 different biomes, a weather system with 3 weather states (clear, raining/snowing, foggy), and a season system with 1 - 4 seasons depending on the biome the player has chosen. I can set up all of these with relatively few LOCAL variables. The only global variables related to these systems are counters that count down when the player last played in each biome type, so let's say 6 global variables are needed to set up that. Is there a benefit to use an array to control that type of information as well?

  • Hi,

    Yes, doing a quick test with 1000 instances that have brightness and grayscale effects on vs their layer having the effects and changing the effect parameter value randomly every tick shows that using effects on layers is significantly faster.

    Thanks.

  • Hello,

    I have a cloud object that has the brightness, grayscale and luminosity effects. All the object instances are in the same layer. I have a day/night cycle and weather states that affect the effects same way equally to all instances (meaning that I could potentially use the effect in the layer instead of the object) but I also have set up conditions that affect some instance effect levels individually (clouds get individually more grayscaly as they move in distance and get a brightness flash with lightning etc.).

    So I could apply many of the effects' intensity levels to the objects' layer, but I couldn't replace the object's effects completely this way. would it still likely improve performance? I read in performance tips that you should render same effects in the same layer, I'm not sure how that applies in this case.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This was perfect, thank you so much.

    Finding it hard to learn these extra bits like "loopindex"

    Loopindex is simply the number of times the loop has repeated. It's very useful.