We have this game that, after an hour or two of being up on a public server, more or less chokes and people who enter the game cannot sign in to their characters. It's pretty consistent too.
Could this be due to some coding in the game, or is the game too large, or is it the server? Does anyone have any idea? Could it be caused by run-time errors? We're lost...
-Dagolar
ID:175096
![]() Jun 12 2003, 3:10 pm
|
|
Well, if it becomes necessary there are always ways to can setup the game to work without everything existing all at once. In other words, objs and mobs might be saved and removed when a certain area becomes inactive, and restored when a player enters that area again. Then they don't have to exist idly while the area is totally unused.
|
What I mean is about all the variables? Here's what I mean.
When a player makes a character, there are something like 40 variables attached to that character. Statistics, which missions have been completed, which bosses have been knocked off, and so on. Can this create problems with the game running? -Dagolar |
I don't know, and I'm not sure there are too many people that would, since its internal BYOND stuff that would cause a crash or a shutdown. Only thing I can suggest is that you use lists to store missions completed and bosses defeated :P
<code>mob/var stat1 stat2 stat3 list/missions = list() list/bosses = list() proc/EncounterBoss(mob/M, boss/B) if(M.bosses[B.name]) M << "[B] has already been defeated." else M.Encounter(B)</code> :P |
That's not a bad idea. I haven't used a single list in my variables. They're all separated. Would it solve a lot of lag to put a lot of it into lists?
-Dagolar |
I don't think lag is caused by variables. It just makes it much more convenient to access, in my opinion, and you don't have to create a new variable for each new mission or boss, since the list either has it or doesn't.
|
Well here's a verb that displays all the players in the game. It's very slow to display, almost choppy.
who() set category="Commands" usr<<"List of Players:" for(var/mob/M in world) if(M.client) usr<<"\icon [client] [M.name]([M.key]) - \red L [M.Level] [M.Class]\black - House: [M.Guild]" Is there a way to identify only clients. Because if the if(M.client) line is removed, it displays ALL mobs, including monsters. Maybe a list would be better? I'm trying to remove lag producing verbs and variables, because the game has been on the hub and just stops working after a couple of hours... -Dagolar |
Dagolar wrote:
What I mean is about all the variables? Here's what I mean. If you have a lot of flags(yes/no or true/false) type variables it's best to just pack 16 of them in one variable by setting and clearing bits. Here are some useful macros for doing this. #define SET_BIT(VAR,BIT) VAR |= (BIT) Then to use these you'd do something like //Make sure the first flag starts at two and each one after is two times the last. If you do this you can dramatically opimise memory usage in your game. |
Dagolar wrote:
That's a revamp and a half. :| But it's well worth it and very memory effecient. Even if you don't use this in your current game keep it in mind for the next. Since the less variables you have the less bandwidth and system memory your game takes. If you replace 16 variables with one that is a major bosst in effeciency. |
Dagolar wrote:
Is there a way to identify only clients. Clients are objects too, you know. =) <code>for (var/client/C) //Don't put "in world"! Clients are never "in the world".</code> Because if the if(M.client) line is removed, it displays ALL mobs, including monsters. Maybe a list would be better? Yes, it would be better. Looping through a list is much faster than looping through the world. <code>var/clientlist[0] client/New() .=..() if (.) clientlist+=src client/Del() clientlist-=src .=..()</code> You can do similar things with various types of atoms, too. So if you often loop through all the mob/enemy/monster objects in the world, then do the above but replace "client" with "mob/enemy/monster". |
-Dagolar