Jump to content

Which server plan is the Best (in value)


AttePatte
 Share

Recommended Posts

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

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 by AgentGamerPro

On vacation, will not respond to DMs or mentions for a couple days.

  

[VIP] 12/26/20 - 10/27/2021
[PRO] 12/27/21 - Present

 

Link to comment
Share on other sites

Posted (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 by AttePatte
Link to comment
Share on other sites

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.

On vacation, will not respond to DMs or mentions for a couple days.

  

[VIP] 12/26/20 - 10/27/2021
[PRO] 12/27/21 - Present

 

Link to comment
Share on other sites

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share



×
×
  • Create New...