AttePatte Posted June 19, 2022 Share Posted June 19, 2022 I made a pretty resource heavy skript. I have been trying to make it more efficient for a year now. Not every day for a whole year, but sometimes I just come back to it and try to fix it. I am now settled to it's current state and am not willing to work on it anymore. It's pretty chill with 2-3 players but as soon as a 4th player joins the whole server starts struggling. I was wondering which server plan is enough for like 10 players with "mods". I hear some say that the 2gb upgrade is enough already, but should I get a plan with higher ram. The script is laggy because it makes zombies pathfind to a random player and stuff so yeah. Help is needed and appreciated! Link to comment Share on other sites More sharing options...
AgentGamerPro Posted June 19, 2022 Share Posted June 19, 2022 (edited) 4 hours ago, AttePatte said: I made a pretty resource heavy skript. I have been trying to make it more efficient for a year now. Not every day for a whole year, but sometimes I just come back to it and try to fix it. I am now settled to it's current state and am not willing to work on it anymore. It's pretty chill with 2-3 players but as soon as a 4th player joins the whole server starts struggling. I was wondering which server plan is enough for like 10 players with "mods". I hear some say that the 2gb upgrade is enough already, but should I get a plan with higher ram. The script is laggy because it makes zombies pathfind to a random player and stuff so yeah. Help is needed and appreciated! Can you send the skript? I could make compact it a bit. Also MH20 is good enough if you have a small playerbase. Edited June 19, 2022 by AgentGamerPro Lifestealed | Minecraft Servers OG [VIP] 12/26/20 - 10/27/2021 OG [PRO] 12/27/21 - 11/18/2022 OG [LEGEND] 11/18/2022 - 3/14/2023 [DEFAULT] 3/14/2023 - Present Link to comment Share on other sites More sharing options...
AttePatte Posted June 20, 2022 Author Share Posted June 20, 2022 (edited) Thank you for replying and for your time. The skript is very embarassing and it has a lot of nonsense which you will laugh at. I would be super thankful if you could tell me a better way to approach this lag problem so we could find a solution. I have been so far just lowering numbers, adding 'kill the loop-zombie' and 'if' statements all over the skript. It is VERY impractical and I know I have been looking at this the wrong way and REPEATING the same pattern that leads to this very laggy code. I sometimes think that it's ridiculous how I keep on working on this same zombie skript while the answer could be obvious. On the other hand I think that pathfinding is not working that well but why does it lag when there are more than 2-3 players? So I deeply apologise for the horrible mess I have created and spent my time on... maybe I just wanted to create something special and enjoyable, something fun! I think that end goal blinded me the goal of making a server which people enjoy hours upon hours a day. So i think that lead me to use the same laggy methods that ended me with this code. So again. That is why it is so horrible and that is WHY I want YOU to consider these mentioned things before you laugh at me, before you laugh at this. I have worked on other things such as scoreboards, abilities with cooldowns so I have not wasted all of my time on this. every 20 seconds in "world": #If i have it pathfinding zombies every second it will lag... obviosly and this is a poor method. The zombies aren't pathfinding all the time just set {p} to a random player out of all players loop zombies in radius 55 of {p}: #The radius has varied from 35 to 65 but I suspect that it affects performance if {p}'s world is not "nether" or "the_end": #This is so that it doesn't make zombies pathfind to somewhere that isn't the overworld if distance between {p} and loop-zombie is greater than 15: #pretty obvious, but it's so that it doesn't make zombies that are close pathfind for no reason if distance between {p} and loop-zombie is greater than 60: #This is so that zombies in caves or far away would 'despawn' chance of 25%: #i put this for... idk kill the loop-zombie if block below loop-zombie is stone or Deepslate or Tuff or Cobbled Deepslate: #so zombies underground wouldn't multiply to hundreds but instead courages the zombies to spawn and multiply aboveground chance of 25%: kill the loop-zombie if distance between {p} and loop-zombie is less than 60: #I think what affects performance is zombies having to pathfind from far away..? set path targets of loop-zombie to location of {p} #This, I think is SkBee method apply speed 3 without any particles to loop-zombie for 16 seconds chance of 25%: summon 2 zombies at location of loop-zombie #Multiply thingie wait 3 minutes #For example if zombies have been around one player for too long they will die thus allowing zombies to spawn near other players kill the loop-zombie #This whole code works with few players, desirably with 10 or less but as said it starts to lag at 3+ players Edited June 20, 2022 by AttePatte Link to comment Share on other sites More sharing options...
AgentGamerPro Posted June 20, 2022 Share Posted June 20, 2022 10 hours ago, AttePatte said: Thank you for replying and for your time. The skript is very embarassing and it has a lot of nonsense which you will laugh at. I would be super thankful if you could tell me a better way to approach this lag problem so we could find a solution. I have been so far just lowering numbers, adding 'kill the loop-zombie' and 'if' statements all over the skript. It is VERY impractical and I know I have been looking at this the wrong way and REPEATING the same pattern that leads to this very laggy code. I sometimes think that it's ridiculous how I keep on working on this same zombie skript while the answer could be obvious. On the other hand I think that pathfinding is not working that well but why does it lag when there are more than 2-3 players? So I deeply apologise for the horrible mess I have created and spent my time on... maybe I just wanted to create something special and enjoyable, something fun! I think that end goal blinded me the goal of making a server which people enjoy hours upon hours a day. So i think that lead me to use the same laggy methods that ended me with this code. So again. That is why it is so horrible and that is WHY I want YOU to consider these mentioned things before you laugh at me, before you laugh at this. I have worked on other things such as scoreboards, abilities with cooldowns so I have not wasted all of my time on this. every 20 seconds in "world": #If i have it pathfinding zombies every second it will lag... obviosly and this is a poor method. The zombies aren't pathfinding all the time just set {p} to a random player out of all players loop zombies in radius 55 of {p}: #The radius has varied from 35 to 65 but I suspect that it affects performance if {p}'s world is not "nether" or "the_end": #This is so that it doesn't make zombies pathfind to somewhere that isn't the overworld if distance between {p} and loop-zombie is greater than 15: #pretty obvious, but it's so that it doesn't make zombies that are close pathfind for no reason if distance between {p} and loop-zombie is greater than 60: #This is so that zombies in caves or far away would 'despawn' chance of 25%: #i put this for... idk kill the loop-zombie if block below loop-zombie is stone or Deepslate or Tuff or Cobbled Deepslate: #so zombies underground wouldn't multiply to hundreds but instead courages the zombies to spawn and multiply aboveground chance of 25%: kill the loop-zombie if distance between {p} and loop-zombie is less than 60: #I think what affects performance is zombies having to pathfind from far away..? set path targets of loop-zombie to location of {p} #This, I think is SkBee method apply speed 3 without any particles to loop-zombie for 16 seconds chance of 25%: summon 2 zombies at location of loop-zombie #Multiply thingie wait 3 minutes #For example if zombies have been around one player for too long they will die thus allowing zombies to spawn near other players kill the loop-zombie #This whole code works with few players, desirably with 10 or less but as said it starts to lag at 3+ players If the server lags the more people that join than its gotta be something about the second line. Set {p} to a specific player and see if the server lags the more people that join. Lifestealed | Minecraft Servers OG [VIP] 12/26/20 - 10/27/2021 OG [PRO] 12/27/21 - 11/18/2022 OG [LEGEND] 11/18/2022 - 3/14/2023 [DEFAULT] 3/14/2023 - Present Link to comment Share on other sites More sharing options...
TheCodingDuck_ Posted June 21, 2022 Share Posted June 21, 2022 13 hours ago, AttePatte said: Thank you for replying and for your time. The skript is very embarassing and it has a lot of nonsense which you will laugh at. I would be super thankful if you could tell me a better way to approach this lag problem so we could find a solution. I have been so far just lowering numbers, adding 'kill the loop-zombie' and 'if' statements all over the skript. It is VERY impractical and I know I have been looking at this the wrong way and REPEATING the same pattern that leads to this very laggy code. I sometimes think that it's ridiculous how I keep on working on this same zombie skript while the answer could be obvious. On the other hand I think that pathfinding is not working that well but why does it lag when there are more than 2-3 players? So I deeply apologise for the horrible mess I have created and spent my time on... maybe I just wanted to create something special and enjoyable, something fun! I think that end goal blinded me the goal of making a server which people enjoy hours upon hours a day. So i think that lead me to use the same laggy methods that ended me with this code. So again. That is why it is so horrible and that is WHY I want YOU to consider these mentioned things before you laugh at me, before you laugh at this. I have worked on other things such as scoreboards, abilities with cooldowns so I have not wasted all of my time on this. every 20 seconds in "world": #If i have it pathfinding zombies every second it will lag... obviosly and this is a poor method. The zombies aren't pathfinding all the time just set {p} to a random player out of all players loop zombies in radius 55 of {p}: #The radius has varied from 35 to 65 but I suspect that it affects performance if {p}'s world is not "nether" or "the_end": #This is so that it doesn't make zombies pathfind to somewhere that isn't the overworld if distance between {p} and loop-zombie is greater than 15: #pretty obvious, but it's so that it doesn't make zombies that are close pathfind for no reason if distance between {p} and loop-zombie is greater than 60: #This is so that zombies in caves or far away would 'despawn' chance of 25%: #i put this for... idk kill the loop-zombie if block below loop-zombie is stone or Deepslate or Tuff or Cobbled Deepslate: #so zombies underground wouldn't multiply to hundreds but instead courages the zombies to spawn and multiply aboveground chance of 25%: kill the loop-zombie if distance between {p} and loop-zombie is less than 60: #I think what affects performance is zombies having to pathfind from far away..? set path targets of loop-zombie to location of {p} #This, I think is SkBee method apply speed 3 without any particles to loop-zombie for 16 seconds chance of 25%: summon 2 zombies at location of loop-zombie #Multiply thingie wait 3 minutes #For example if zombies have been around one player for too long they will die thus allowing zombies to spawn near other players kill the loop-zombie #This whole code works with few players, desirably with 10 or less but as said it starts to lag at 3+ players I'll attempt to improve this for you, untested btw on join: while player is online: # Will have a constant loop until they leave, waiting the time specified below wait 1 second world of player isn't "nether" or "the_end" loop all zombies: abs((x-coordinate of player)-(x-coordinate of loop-value)) < 50 # The radius, absolute value of player's x - abs of zombie's x # EX: abs(50-60) would be abs(-10) which is 10 distance abs((z-coordinate of player)-(z-coordinate of loop-value)) < 50 # same for z value # The zombie is within 50 blocks set path targets of loop-value to player apply speed 3 without any particles to loop-value for 16 seconds set {_} to random number between 1 and 100 # Using "chance of" with skript is a horrible idea, instead check if {_} is between 1 and x if {_} is between 1 and 2: # 2% start chance, edit if you want, this triggers every second so would recommend this or below # Not required to be an integer, 2.63 is valid for example. Anything more than 2 decimals is ignored. summon 1 zombie at location of loop-value #Multiply thingie One of the most unique Minehut servers. Soon™ Link to comment Share on other sites More sharing options...
DrewDropper Posted June 21, 2022 Share Posted June 21, 2022 52 minutes ago, TheCodingDuck_ said: I'll attempt to improve this for you, untested btw on join: while player is online: # Will have a constant loop until they leave, waiting the time specified below wait 1 second world of player isn't "nether" or "the_end" loop all zombies: abs((x-coordinate of player)-(x-coordinate of loop-value)) < 50 # The radius, absolute value of player's x - abs of zombie's x # EX: abs(50-60) would be abs(-10) which is 10 distance abs((z-coordinate of player)-(z-coordinate of loop-value)) < 50 # same for z value # The zombie is within 50 blocks set path targets of loop-value to player apply speed 3 without any particles to loop-value for 16 seconds set {_} to random number between 1 and 100 # Using "chance of" with skript is a horrible idea, instead check if {_} is between 1 and x if {_} is between 1 and 2: # 2% start chance, edit if you want, this triggers every second so would recommend this or below # Not required to be an integer, 2.63 is valid for example. Anything more than 2 decimals is ignored. summon 1 zombie at location of loop-value #Multiply thingie sus Link to comment Share on other sites More sharing options...
DrewDropper Posted June 21, 2022 Share Posted June 21, 2022 Just now, DrewDropper said: sus sus Link to comment Share on other sites More sharing options...
TheCodingDuck_ Posted June 21, 2022 Share Posted June 21, 2022 44 minutes ago, DrewDropper said: sus Thanks for your amazing input! One of the most unique Minehut servers. Soon™ Link to comment Share on other sites More sharing options...
AttePatte Posted June 21, 2022 Author Share Posted June 21, 2022 Thank you all for your awesome feedback! I learned quite a lot of new stuff! @TheCodingDuck_Sorry for "pinging" u I haven't figured out how to reply. Ur code was amazing and had 0 error messages on the first try!! I like the approach it gave me a lot to gaze at and I hope it leads me towards an even improved code. Unfortunately your code does lag slightly but doesn't become unplayable but that could be because I don't know how to lower the distance of which zombies pathfind from. Okay, now I think this subject can be closed or whatever! Ty all! Link to comment Share on other sites More sharing options...
TheCodingDuck_ Posted June 22, 2022 Share Posted June 22, 2022 To lower the distance just change the 50 to whatever distance. If it's causing lag you could also make it be every 2 or 3 seconds instead of every 1 second. 1 One of the most unique Minehut servers. Soon™ Link to comment Share on other sites More sharing options...
TheCodingDuck_ Posted June 22, 2022 Share Posted June 22, 2022 If you found my stuff helpful, you can react to my posts to give me reputation! One of the most unique Minehut servers. Soon™ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now