Author Topic: Multiplayer Combat Lag  (Read 670 times)

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Multiplayer Combat Lag
« on: February 25, 2011, 12:51:47 pm »


               I've searched around, and I've seen numerous lag threads (both on the old forum and new) but nothing that specifically talks about what I'm experiencing. 

I have 10-15 players that play on a module I've made every saturday night.  There are no real issues until we get into a combat situation that has all of them, and multiple NPCs.  At a certain point, the delay between actions gets so long that it's painful.  Especially when using AoE spells.  Now, I get the obvious - the computer calcs in combat are probably slowing the game down significantly.  My question is whether there is some sort of script tweaking/caching I can use to head off this.  How to players out there who run persistant worlds with 50 players manage it?  

Should I be experiencing this kind of slowdown with so few players?  Something smells fishy.

Thanks for any help.
               
               

               
            

Legacy_spool32

  • Jr. Member
  • **
  • Posts: 57
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #1 on: February 25, 2011, 02:53:57 pm »


               A lot goes into solving this problem - Most of the PWs who host 50ish players have done things like shutting off some spell animations, working with factions in the NPCs, removing heartbeat scripts that run on the module... then there's the more fundamental part - more bandwidth, faster hardware. Are you running a game client on the same box hosting the module? If so, stop it.



Your main problem is going to be with AoE spells and vfx. If you can stop your NPCs using AoE casting, it will help performance.
               
               

               
            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #2 on: February 25, 2011, 03:00:23 pm »


               No, the server is a separate machine (one I pay through a host - Trinity Games).  Again, the lag is absolutely fine until we get into combat.  Once in combat, it begins to grow.  If there are more than, say 6 or 7 enemies (with 10-15 pcs) the lag is horrific.  Even when the NPCs arent even casters.

 I'm wondering if there is a combat aspect of this (script wise or otherwise) that can be tweaked to get something better in terms of performance.

Thanks for the reply.
               
               

               


                     Modifié par Ivanovich, 25 février 2011 - 03:01 .
                     
                  


            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #3 on: February 25, 2011, 05:39:24 pm »


               Are there any specific scripting systems being used in the module that deal with creatures, spawning, etc?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #4 on: February 25, 2011, 07:38:23 pm »


               Well AFAIK that the problem of the NWN multiplayer code. Higher Grounds limited the player partys to 10 members because of that and I would follow them... There probably can't be done anything, high power server machine won't help...
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #5 on: February 25, 2011, 07:52:55 pm »


               You are running into multiple problems that are contributing to the lag:

AoE spells (like fireball): By default, these spells calculate damage once per creature (and sometimes door and placeable) in the area of effect, then recalculate damage based on saving throws for each creature, then create and apply the damage effect to each target.  Hurling multiples of these types of spells per round means more such calculations.  Editing the spell scripts to do a single initial damage calculation (then reuse it in the "while" loop) can cut down on, but not eliminate, the processing required of the server.

NPC scripts: Every NPC is running multiple scripts in combat (onperception, onheartbeat, onspellcastat, ondamaged, ondeath, onspawn, etc.).  Rescripting some of these to streamline the code, simplify functions, and remove redundant function calls may lead to minor speed improvements.

Multiple PCs in same area: This is a big one.  Think of it this way...

A single PC is fighting an NPC in an area on your server.  The server must process all of the scripting and actions of the NPC (running scripts, calculating attacks/saves/etc., working with effects, and more), and must take into account commands and status (hitpoints, effects, items, feats, spells, etc.) of the PC, all the while sending data to the player's computer and getting information from the player's computer and recalculating everything sometimes multiple times per round (think of a character with multiple attacks/round).

You know the combat log and how cluttered that can look?  There's more information being passed to your computer than just that text.

Now in comes a second PC to the same area to help (no other additional NPCs yet).  Now the server has to increase the amount of data moved and processed.  It has to still do all the NPC data crunching, and still do everything for the first PC, but now much of it has to be done again for the second PC (sending data back and forth, processing position/status of the 2nd PC), and processing any possible interconnection actions of both PCs.

Say it's a tough NPC the first two are fighting, and a third PC joins the fray.  Now the server has to increase its processing again.  Yes, the server's workload is multiplying with each additional PC in the same area (a single PC in an area is much less work for the server).

Now the NPC called in some buddies (or more are spawned).  Oh, look, even more interactions for the server to process.  Then the PCs start summoning balors and familiars and such.  Even more objects to track and process and to communicate with outside computers about.

Wait, these are high level NPCs and PCs?  So now the server is dealing with multiple attacks/round from multiple PCs and NPCs, changing the statuses of multiple creature objects multiple times per round (let's not get into my monk/ranger that dual wields dev. critting (fort. save calculations) vampiric regen (hitpoint changes on wielder) kamas with multiple elemental damage types (multiple resistances to get checked with each attack and damage being applied) and gets 9-10 attacks per round when hasted and using flurry of blows), all the while sending this information to and from multiple computers over the internet (and NWN can be played by folks on dial-up connections!)
               
               

               
            

Legacy_Elhanan

  • Hero Member
  • *****
  • Posts: 842
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #6 on: February 25, 2011, 08:06:18 pm »


               For you Techies, is there any way for such gatherings to have all the AoE effects turned into some generic FX, and have buff visual effects fade after a single round? While this may not aid in background calculations, it may help on the graphics cards.
               
               

               
            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #7 on: February 25, 2011, 10:25:27 pm »


               Ok, I appreciate all of the answers.  It would appear that it's just the nature of the game engine.  It is obvious not a whole lot of thought went into the concept of large groups of PCs (like in WoW or EverQuest, etc)...



Thanks again.
               
               

               
            

Legacy_spool32

  • Jr. Member
  • **
  • Posts: 57
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #8 on: February 25, 2011, 10:51:37 pm »


               NWN1 was released in 2002... there was no WoW or Everquest back then. '<img'>
               
               

               
            

Legacy_Karvon

  • Sr. Member
  • ****
  • Posts: 430
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #9 on: February 26, 2011, 12:19:00 am »


               In addition, you have to recall NWN was originally designed to recreate the traditional PNP table top game, a group of maybe 4-8 folks playing together.  The fact that it can even be stretched to handle MMO/PW style larger parties and worlds is a pretty strong statement to the flexibility of the game engine.



Karvon



               
               

               
            

Legacy_Elhanan

  • Hero Member
  • *****
  • Posts: 842
  • Karma: +0/-0
Multiplayer Combat Lag
« Reply #10 on: February 26, 2011, 01:59:32 pm »


               

spool32 wrote...

NWN1 was released in 2002... there was no WoW or Everquest back then. '<img'>


No WoW that I recall, but UO, EQ, and a Microsoft MMO were fairly strong at the time, I came across NWN from research gathered on upcoming games while studying these among others.

NWN1 still is the benchmark that I hope can be achieved agin this coming decade.