A. Don't use shortcuts. GetFirstPC is a shortcut for people who don't try to figure out how to do the specific job they are attempting, and it's basically not ever needed. If you don't do this, well the main difference between MP and SP is it's a lot easier to see the bugs when you got 30 folks using something at the same time. Remember when natural AC was bugged so it stacked, this affected everyone ( SP and MP ) and our DM team was monitoring it for a good 6 months prior to the SP folks noticing it. ( if you have to use GetFirstPC, use my Get Main PC function instead which i posted here and will be in the next CSL library )
B. Assume much more abuse due to multiple players using the same things at the same time. While a case statement is fine in a single player, which might take a half second to run and not be noticed, that half second will be run by 20 players at once. Assume you have 60 players if you are actually going to have 10 and that everything you do just has to be optimized, clean and easy to read. Assume there is no main PC, let them do what they want to some degree if they are just a henchman. I guess this is more like the sandbox vs railroaded games, but remember that the main PC is not the only one trying to have fun.
C. Clean up your mess. A SP module will shut down after a while. A MP module can stay up for 6 months at a stretch, that means objects keep getting created for loot, monsters, whatever. Make sure they decay, delete and go away to keep memory good. ( monitor server memory. )
D. 90% of all the problems are the AI. Fix it so it's not going nuts. This is caused by pathfinding, doors, spawning and recursive on perception calls. Compared to your code the AI is absolutely nuts and if you could make it clean you'd not notice anymore issues unless you are just plain nuts. ( note i have a working CSL library revamp of this, and as i keep releasing new versions i am slowly moving this large library of code from psychotic to merely eccentric. )
E. Too much of anything is a problem. Loops, delays, heartbeats, fake heartbeats, triggers, loot on the ground, too big of an area, megabytes, AOE's, number of placeables, or anything else really, even too many waypoints. The game has to iterate all the variables on an object to find the one with a given name when you use GetLocalInt, which makes that function slow to a crawl when you have 5000-10000+ variables on a single object. While i pointed out variables, it's ANYTHING in the game. If you have to have a lot of something or other, you should work on reducing quantities in other areas ( so if you have 32x32 areas, you should work on the AI and spawning and despawning and AOE's and triggers in the areas to compensate ).
F. Use the database, make it work for you. MySQL is made for servers much more demanding than NWN2 and it's got a lot of programatic functions you can use. I use it to determine the current date for example. While this won't help SP, it's almost required in MP only servers.
G. If skywing did it, use it. He has a replacement script engine you should be using on your server. Am working on a way to use Never launcher to make that an option for those playing SP modules.
H. If a guy in IRC who runs a major PW is saying it's a good idea to do X, Y, and Z ( and there is general agreement ), it's probably going to be a lot less work just doing what they say than the work of doing what they recommend. Show your scripts there and they will mention issues they had doing similar things.
I. xp_profiler allows you to see logs of usage in game to know what to fix. Do it clean, then review the log to see what code needs to be optimized.
J. My CSL library is set up for PW's, and is designed for worlds with 60+ players. It is based on code used on DEX in the NWN1 days for 5 years when we had 30 players maxed out on 2 servers, and we had 30 players up until SOZ came out. I've worked with the other PW admins and revised things to be completely optimized for running a massive PW, with every little detail reviewed and using xp_profiler to judge and compare, added some intense caching, lots of bug fixes, and most of the options i have seen others using, not to mention anything folks suggest. This all works in SP or MP by design and it's goal is to make those of you doing SP modules to be able to use it and not really worry about if it'll work in MP.
K. Make your module DMFI friendly ( or CSL friendly which i am working towards being fully DMFI compliant ) Remember a DM can host your module just like they used to do PNP games, and add a lot more depth to it.
Modifié par painofdungeoneternal, 11 janvier 2012 - 06:47 .