![]() |
Loading flags on login
What's the best way to load commonly used variables from files? upon login or just when they are needed? I currently have like 50 variables loaded from files whenever a player logs on because I assumed it's better to just load everything at once but on the other hand could it cause server lag if say 10 players logged on simultaneously?
|
Well account data is a flat file, and the server seems to handle that just fine every time a player logs on.
Idea: Stress-test your login.. PHP Code:
|
I usually load data on login, and then maintain a cache (clientr.vars or something)
|
Quote:
Quote:
|
Quote:
One of the things I recommend though is the use of getfilemodtime(file), and using it with your cache to determine if you have to load the file or not. Once upon a time Zodiac loaded a text file for every item the player had, every time they logged on. Using getfilemodtime(file) I was able to decrease login loading time (after the initial load) dramatically. A test.. PHP Code:
PHP Code:
|
I've always found saving data to files to be more hassle than it's worth it, and a definite speed decrease comparing to SQLite tables. The way I handle items, skills etc. on Maloria is that I load everything once upon login to a player.items TStaticVar, and whenever an item is obtained during gameplay it's added both to that TStaticVar and saved into the SQLite table.
|
Speed check:
PHP Code:
PHP Code:
PHP Code:
|
| All times are GMT +2. The time now is 06:43 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.