Script complexity/lags relation

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
151
Hi, I'm looking for an advice from someone experienced in this topic. Would it be laggy if the script would spawn npc actors in every 50x50m square of the map? (each of them would do something else + each of them would have its own set of skills like attack, defense, hp etc.). The aim is to create multiplayer-rpg like gothic. Is it possible to make the script that complex and maintain high performance?

I'm a complete noob when it comes to pawn scripting and an answer can potentially save me a lot of time wasted on trying to make something which won't work anyway. Thanks
 

|]_ReT1neX_[|

Active member
Joined
Jul 28, 2014
Messages
132
Reaction score
0
You're going to need a good host or a good vps. and....
You're saying that you want to spawn a NPC in every 50x50m square of the map.
You do realise you're going to spawn approximately 120 NPC's.... "or more" RIGHT? :eek:mg_run:

So. The answer is

YES
It will lag your entire server!


(* I Mean... that's what i think *) :dont_care:
 

Kyance

Member
Joined
May 26, 2013
Messages
10
Reaction score
0
monday link said:
Hi, I'm looking for an advice from someone experienced in this topic. Would it be laggy if the script would spawn npc actors in every 50x50m square of the map? (each of them would do something else + each of them would have its own set of skills like attack, defense, hp etc.). The aim is to create multiplayer-rpg like gothic. Is it possible to make the script that complex and maintain high performance?

I'm a complete noob when it comes to pawn scripting and an answer can potentially save me a lot of time wasted on trying to make something which won't work anyway. Thanks
If you make it efficiently, then no, it wouldn't lag, since there are many servers(DayZ for an example), which have 50-150 NPCs, and the server doesn't lag.

You create a 2.5(2500) second timer(Or 2 seconds (2000), 1.5seconds (1500).. below that would be risky i guess), and do NPC switches (switch(something_like_npc_amount)), case 0: .... case 1: ..... case 2: ....), and on each switch, you check if a player is near the NPC, if there is, then you do something..
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,116
Reaction score
167
In SA:MP no (except u want it to be really choppy), In MTA:SA yes.

Also it depends highly on your available bandwith, you won't be successfull with a 10 Mbit/s connection p:

[member=2315]Kyance[/member]:
These servers stream the npc's so it only creates them for available players in ranges etc, but you can't make it look like they are all there.
 

Kyance

Member
Joined
May 26, 2013
Messages
10
Reaction score
0
0x688 link said:
In SA:MP no (except u want it to be really choppy), In MTA:SA yes.

Also it depends highly on your available bandwith, you won't be successfull with a 10 Mbit/s connection p:

[member=2315]Kyance[/member]:
These servers stream the npc's so it only creates them for available players in ranges etc, but you can't make it look like they are all there.
Oh :eek:
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
151
Spawning them only if some player is around would do the thing too, but what about the calculations to give every player statistics/skills like exp, lvl, attack, defense, speed, mana etc. Would it lag the game for sure or it's worth to give it a try?
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,116
Reaction score
167
monday link said:
Spawning them only if some player is around would do the thing too, but what about the calculations to give every player statistics/skills like exp, lvl, attack, defense, speed, mana etc. Would it lag the game for sure or it's worth to give it a try?
well not really, would not lag either it's all data that is hold virtually in the memory.
 
Top