View previous topic :: View next topic |
Author |
Message |
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Wed Aug 20, 2014 20:37 Post subject: |
|
|
Are the LUA CPU calculations performed by the server or the NWNX2 exe?
nwserver is annoying in that it's not multi-threaded, so the best CPU I could get it was a dual core with as high GhZ as possible, but in the end only 50% of that can go to the server.
Will using LUA's similar functions instead have most calculations performed by the nwnx2 program? If so this does enable a mod builder to effectively use a dual core as giving ~~~75% of that CPU to the server(quad core is still just nasty though with nwserver maxing at 25% )
Note I've never actually hit a processing limit on my server as I TRY to be efficient in scripting to avoid such issues(I do know it maxes at 50% though, due to one point of me accidentally having an infinite loop in tileset changer script), BUT it is still a future problem as I continue to add more and more into the server. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Fri Aug 22, 2014 21:35 Post subject: |
|
|
nwserver has no multithreading compatibility, its not possible to call any nwn related functions or memoryspace without risking corruption from an outside thread. In short; nwserver runs the lua script. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Sat Aug 23, 2014 3:30 Post subject: |
|
|
That's a shame, I thought since the way results are returned is through locals, it meant nwserver was passing a command to nwnx2, nwnx2 calculated it, and then set that local to that result.
Oh well |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Sat Aug 23, 2014 15:18 Post subject: |
|
|
It is possible to introduce new threads to the work order of NWNX/nwserver.
But as Terra said - its not a default and supported behavior of nwn.
For the most part however- multithreading short order tasks would be unnecessary.
Eg: Executing a 'AddFeat' command on a player on another thread is not going to see any improvement in performance.
However - And this is me from a .net development background.
I use the .net nwnx plugin - and I develop my own nwnx .net code to extend functionality.
If you had a large work order - that you wanted to execute in the background - without locking the nwserver process.
Then yes- you can execute that on another thread.
As long as you don't need that thread to return values to the nwserver process - it will be error free.
Eg:
I have functionality that sends e-mails from the nwserver process.
Sending e-mails is considered an I/O intensive task.
Eg: It needs to connect to smtp servers, and then write the e-mail across the network to the server.
This can take about a second to complete.
In order to make this lag free for the nwserver - I trigger a method that then spawns a new thread to do the e-mail functionality on another thread.
The result is that the function that nwserver kicks off ends / returns immediately, but in the mean time - the e-mail will still be in the process of 'sending'
So - while interacting with nwserver process memory from other threads is risky - there are however other uses for threads.
You can use them to execute functionality that is ordinarily laggy or I/O intensive - and the result is that they will not impact the main server thread. |
|
Back to top |
|
|
Sir Vendel
Joined: 19 Dec 2015 Posts: 7
|
Posted: Mon Dec 28, 2015 7:47 Post subject: nwnx_cool not working |
|
|
Hello!
I have been trying nwnx, and found the very promising damage "override" nwnx_cool. However, I have not found, anywhere, the source for the include file "inc_cool". Without that, I cannot compile or use nwnx_cool.
Can anyone please post the source code for "inc_cool", so I can copy and paste it into my toolset, and try it out? |
|
Back to top |
|
|
|