Graal Forums  

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

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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

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 09:10 AM.

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