Jump to content
Sign in to follow this  
NaruTheHuman

Naru's Corner #7 - Optimization tips & tricks

Recommended Posts

Hello there, everyone! :)
This week, we will go over some basic optimization tips, and look at some common problems that the games generally encounter. ^^ 



If you have any additional questions, feel free to ask me right here! :)
This will be all for today, see you next time ^^

  • Like 2
  • Thanks 4
  • Upvote 1

Share this post


Link to post
Share on other sites

hello .. can you please tell me if there is a possibility in the script to specify the position of the block that is contained in the group?I've already tried to use a block, a reference point, but it still throws out the zero position of the map .. the only tile that can determine the GLOBAL position is the tile of the path, and it probably won't help me .. 

  • Upvote 1

Share this post


Link to post
Share on other sites

Thank you so much, @NaruTheHuman! I did think of a few more questions:

  1. Is the script tile "follow" better or worse for lag than a "position animator" game logic? Or is it the same?
  2. Is there ever a time to *not* weld things together? If I don't want the forest to be interactable anyways, should I weld the trees together? Or will that not do anything because they are not touching?
  3. In an upcoming Naru's Corner, can you go over how to use "environment" game logics and good settings for these, so we can get rid of even more lights? ^_^
  4. Is there anything not mentioned in the video that we should avoid because it causes too much lag?
  5. I know you already figured out what I was talking about after the video was made, but should have called it "Performance monitor" (F11) and "Profiling" (F10) from within the testing scenario. oops ?

Ylands_201103_143237.thumb.png.4c066d6f5c39008ff8e75111cbb6c718.png

P.S. There is no right way to say Ocnog. It is a made up word ?
 

  • Upvote 2

Share this post


Link to post
Share on other sites

@NaruTheHuman sorry to tag you, but you are tha man ?

first question: 

I have a script that blinks "labeled entities" every "1" second (time trigger). In that "each tick" it runs through an array of colors (around 10 colors).
[ By the way I couldn't figure out how color lerp in ylands work even after i researched about color lerping. It just goes straight to the "last color". ]

That being said, are you saying it is better to get rid of time triggers and make a recursive function with a delay inside, instead? 


Second question:

Would you have a trigger zone spawning at target's position to perform actions and despawn it after (so i can see which players are inside the area) or would you use overlap tiles?
Let's say, turret shoots at the player and a trigger zone is spawned at that "target position" and make "bullet MOVE TO target's position". Inside "bullet ON Movement end" I despawn each trigger zone respectivly.
I think trigger zones can get confused if "On Enter and On exit" occurs at same time especially if you place delays inside (yes, I know I can make some scripting tweaks to avoid that).

 
The question is: would you get rid of trigger zones (thus less logics in the map) and instead use the tiles Overlap for this? Because on "bullet movement end" I can call a circle overlap for example, get an array of overlaped entities and check if there are any players inside that overlap array? Because this is not for only 1 enemy shooting, so it will end up with like 10 enemoes and let's say 2-3 bullets moving for each enemy.

Hope this last question makes sense.

This was an mazing video. We know about limitations but we also want to make a lot of cool stuff work together.
Many times the culprit is the script and work flow itself but also the ylands limitations.

So, I leave the suggestion to make ylands process animations/effects more effectivly. You know we need a better performance.

As you've seen, players are getting better and better at building and scripting because Editor+scripting is so awesomwe that we are trying to make more than ylands let and it's a shame sometimes we cannot put all together.

This was all while I stopped video at 14 minutes. So, expect more questions  ?

Thanks crazy hair man ?
 

Edited by jchob
  • Upvote 1

Share this post


Link to post
Share on other sites

@NaruTheHuman My question is: Are those flags "animated objects"? Or flags are not hard for memory? I have more than 15 flags in visible radious on my map. Thx for advice ?
image.png.da20deb5fbd40a35fb1a1ec8a481a671.png

Edited by Azaren

Share this post


Link to post
Share on other sites
On 11/7/2020 at 8:53 PM, Azaren said:

@NaruTheHuman My question is: Are those flags "animated objects"? Or flags are not hard for memory? I have more than 15 flags in visible radious on my map. Thx for advice ?
image.png.da20deb5fbd40a35fb1a1ec8a481a671.png

Hi :) in this case, flags are not counted as mentioned animated objects :) they are not demanding on memory at all afaik, so that shouldn't be a problem!^^

  • Thanks 3

Share this post


Link to post
Share on other sites

@jchob Hello there!:)

first Q:
Not at all, recursive function with 1s delay would be basically the same as the time trigger that goes through the colors, since it would just fulfill the exact same operations as the time trigger does. ^^ 

Lerp is quite simple, really. You pass two colors, and then a number between 0 and 1, 0 being the first color, and the second color being 1. Your problem might be passing in numbers greater than 1, that is why it goes straight to the second color... x] I've used lerp in many scripts, so it should work fine. If it still won't work, feel free to write to me again with some closer specifications. ^^

second Q: 
If I understand that correctly, you are creating some sort of a missile launcher, where you need to deal AoE damage? :) I would definitely try to go with the overlap tiles, since spawning the trigger zones, despawning them etc can cause a lot of issues by itself. :) so definitely go with the overlap approach. That being said, I haven't really gotten to trying the overlap tiles myself that much. :D So I will definitely have to try and create something with them. :D
 

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

@Mello1223 Hi ^^ As far as I know, we don't really have a way of returning local position in a group. :c I would suggest using some other blocks position and just subtracting them or something like that ^^ Feel free to drop some exact use case where you'd need it, and maybe we can come up with some solution. ^^

Share this post


Link to post
Share on other sites

@NaruTheHuman.hi.. for rotations I currently solve it using reference points located outside the group, and at the same time I rotate not only the group but also the given reference point so that I can later get its rotation, and similarly I solve it with animators .. but it's a double work of extra :(:(:( ... that's why I you asked about it ... 

 

Share this post


Link to post
Share on other sites

@ocnoglittle Hellooo ^^

1. At this moment, they are both just about the same. There might be situations where one is slightly faster, but since there is a very little difference, I would just go with the one that's more suited for your game ^^
2. The only reason not to weld something, is when you want to interact with it somehow, or you want for single blocks to be breakable. ^^ As far as the trees go... mm. I don't think it will make much of a difference since there will remain more or less the same number of colliders (unless you turn off the colliders, of course, :D). But I would say that you can go ahead and weld them together, you can never go wrong with welding, just remember that they will act and receive damage as one object from that point, so probably make them indestructible. :D
3. Will try to incorporate them into one of the following videos ^^ 
4. I'm not sure! :D I didn't really come up with anything so far, but I will make sure to mention it if something comes up ^^
5. Performance monitor is really just for monitoring some unexpected spikes where you unknowingly spam 1000 entities at once etc. :) Generally, you'd want frame time less than 300ms, and polygon count is more or less just for informational purposes now.. :) Script profiler is good for checking how many times have the functions been called and how fast your functions are. I haven't been using the perf monitor that much to be honest, I really use it just to check for some big spikes that would show some greater issue in my script. :)

  • Thanks 2

Share this post


Link to post
Share on other sites

@Mello1223 Ah yeah, that's unfortunate :( Wait so if you use get rotation in the group, it returns a different rotation than it should? I'm afraid that for now, there won't be a better way to solve this. :/ but try to use transform rotation with 0,0,0 offset instead of get rotation. It's just a guess, but it could return the correct rotation that you need.

  • Thanks 1

Share this post


Link to post
Share on other sites

in fact, I've spent a lot of hours solving animation and rotation in a group, but as far as I can remember the beginnings, yes, it was one with the problem that the same thing happened with rotation .. hmm, transform position or rotation .. it would could work ..?thanks for the tip ?

  • Like 1

Share this post


Link to post
Share on other sites

@NaruTheHuman I have one more question please...If i have animated object too far from player, but still "active" animated, is animation active or paused? Or you have to stop animation play manually? 

PS: nejde mi ani tak o to, zda se animuje nebo ne, ale spíše o to, zda to zpomaluje hru...

  • Upvote 1

Share this post


Link to post
Share on other sites

@Azaren I think that the animation is still being calculated, since there is an option that it would be like a train that goes from one island to another, and you don't want it to stop going just because its not being displayed, at the moment. I'm not 100% sure, but I would say that it will still have an effect on the performance, even though much smaller, since it's not being shown. :) 

  • Thanks 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×