Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-06-2007, 06:44 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Thumbs up New NPC-option: newnpcstorage=true

We have added a new option for optimized storage of npcs (putnpcs2).

By default those npcs are all stored in the same folder and loaded at startup. The problem is that some servers started to use huge amounts of those npcs or storing tons of data in them. That makes the startup take a lot of time, and the server takes a lot of memory.

But many of those npcs don't need to be loaded at startup and don't need to sit in the memory all the time. They are like local npcs, but want to store additional data.

For that there is now a new option:
Server-options: newnpcstorage=true
NPC-variable: this.savelocally = true;

If the new npc storage is enabled, and you set the flag savelocally = true, then the npc is saved into a subfolder (uses the level name as folder name) and is only loaded when that level is loaded (when a player enters the room).

On N-Pulse that reduced the memory from 300 MByte to 35 Mbyte, on Unholy Nation from 400 MByte to 110 MByte, so it should be less laggy now.

Important things to keep care of:
- by default npcs don't use that storage system, you need to set savelocally = true, e.g. like that:
Graal Script Code:
function onCreated() {
  
this.savelocally true;

If you want to use this for already existing npcs, then add this to the class:
Graal Script Code:
function onInitialized() {
  
this.savelocally true;

- this is currently only used for npcs in single levels, not for npcs on gmaps
- to actually benefit of the lower memory usage you eventually need to restart the npcserver again, you will see a lower number of dbnpcs in /stats then.
- if you set savelocally = true; then the npc is not loaded before a player enters the level, and the npc is also removed from memory when there is no player for a few minutes, so don't use it for npcs which you want to access from everywhere and where you want to have the script running forever
- if you want to see the npcs in the filebrowser then add "r npcs/*/*" to your rights
- this thing will also be used by the future online level editor to store npcs
- it is currently only enabled for Unholy Nation and N-Pulse, but will also be available for the other servers soon (or on request)

Last edited by Admins; 11-06-2007 at 07:23 PM..
Reply With Quote
  #2  
Old 11-06-2007, 06:57 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Sounds great. Maybe you could enable it on Rudora sometime.
__________________
Skyld
Reply With Quote
  #3  
Old 11-06-2007, 10:04 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Wicked!
Reply With Quote
  #4  
Old 11-06-2007, 11:22 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Would like this enabled for Ol' West when you have time, Stefan.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 11-08-2007, 04:59 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Ok enabled on Rudora and Ol-West.
I've also uploaded the new npcserver to all machines, to watch the new npcs folder on other servers you will need a complete server-restart though (to support folders like "npcs/mylevel.nw/")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:22 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.