Hi everyone!
I had read about performance on Machine. So I have a little question and also want to discuss performance and organizing your project with Makinom in the long run!
Let say we have below example:
- Make 1 big schematic and put it in 1 machine on the Object.
(I think this may be good for performance because it used less machine in the long run, but it not easy to manage and also not very modular)
-Divides 4 small schematics from that 1 big schematic and put it in 4 machines.
(With this I can add and remove a system that I like or don't on that object to test what work best for me without having to edit schematic and fear that is will break other systems in the same schematic. So I'm not fear of breaking anything, but it uses more machine so... performance will be worse in the long run. But the tradeoff is acceptable right?)
- Also 4 small schematics but call it in another schematic by Start machine node with check condition and put it in 1 machine on the Object.
(I still not try this method and see how it compare to other 2, I just think about it when I write this topic xD. So I don't know what the advantages of doing this way. But I think it may be just may be better than the other two combined, I mean you just use 1 machine to run it all 4 and if you don't like any system for that object you remove it from the schematic check condition so...Better??)
So what do you think the better way to do for performance and organized to scale well with your project when it has more and more schematic?
Also if you have any other option, please share with everyone!
Makinom does what it can to improve performance, and as long as you check this how-to and keep it in mind, you should be good.
Generally, yes, each additional machine adds an overhead (since there's a lot more stuff hanging on it) and reduces performance. However, this usually isn't really noticable, unless you deal with a huge number of machines at the same time.
E.g. spawning 100 game objects with 5 machines running on each will have a much higher performance impact than only 1 machine per object.
One thing I can recommend for machines that run each frame is making use of the Repeat Schematic node to restart the already running schematic in the next frame. This is also mentioned in the how-to :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
So for a huge number of machines at the same time do you have a number for it? like 1000 machine runs on a single frame?
Doesn't spawning a new object already have a big impact on performance?
What I really want to know is if I have 1 object than run just only 1 machine but it has a huge number of node in its schematic, let's say it has 10 layers of node every layer contain 100 nodes for example and then spawning 100 objects like that to the scene and let it run.
Vs
With 1 object that runs 10 machine every machine that 1 layer of the node with 100 nodes and spawning 100 objects like that to the scene and let it run.
The performance when the object got created doesn't important right now.
What important is, the performance when is doing stuff that we tell it to do and interact with each other on a single frame.
Wish we have a stress test about this. But Makinom 2 is in development so benchmark Makinom 1 is not really important.
Or do you know a specific way to setup it? To test how many machines can it handle in the same place before dropping the frame rate on the low-end device like mobile!
And yes! I have read about that and use it in my project. If I just want to check for variable change for example then use Auto node with repeat execution and check delay every 1s or 0.1 instead of using Tick machine, because every frame is really fast right? like 0.01666 or something if I remember correctly.
Yes, spawning and destroying game objects has a performance impact, but only at the time they're spawned/destroyed. You can use Makinom's game object pooling to ease that stress.
In your use case (100 objects with 1 big vs 10 smaller schematics), I'd say having 1 big schematic would perform better. However, there's no definite answer to that, as it depends on how the machines are used (e.g. Repeat Schematic node), what the schematic performs and also on the hardware it's running.
It'd definitely have a higher initial impact when initializing 100x10 machines instead of 100x1 machines, but on the long run (if all machines keep running without restarting), it wouldn't make that much of a difference (theoretically :D).
Something to consider would be using 'manager' schematics, i.e. instead of having a schematic per game object you'd use a single schematic that manages all those objects - but this depends on what the schematic's task is :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
And now want to understand better how to organized schematic and machine, so I don't have to dig in every single object just to find where did I put that schematic machine (= =!) For tweak and update it stats!
Like I want to understand better on how to use the 'Start machine' node. What is good in which situation? Right now I don't how to use that for! Or use it for like an FSM or something?
Like when AI on 'idle state' run 'Ai idle' schematic and on 'See Enemy State' run 'Chase Enemy' schematic?
E.g. the match 3 tutorial makes use of that to execute tasks on found jewels in a schematic.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!