Better way to set Autoinvite timers?

03/08/2013 10:57 derpingson#1
Hello, I'm using a 5672 edited trinity base.

There are a lot of auto-invites timers for several events, but it's situated in Threading system, program.cs

this is kinda taking a lot of RAMs (+150mb on 0 players), even with a powerful host, ping is 200-500, it use to be less than 100 on other sources.

Do you suggest a better way to deal with these timers? to be honest, i've no idea what to do
03/08/2013 12:17 shadowman123#2
dude the Thread which handle the Auto invites not the main cause that the source consuming alot of ram .. the main cause is Loading Dmaps files ..anyways i dont think that there is other way to handle it you have to make checker every 1sec
03/08/2013 12:34 derpingson#3
Well , a lot of other sources have almost the same structure and only use 10mb or rams, are you sure it's because of loading dmaps?

if so, what to do?
03/09/2013 00:46 EOS 60D#4
Probably because of loading items.txt..
03/09/2013 01:23 go for it#5
Quote:
Originally Posted by shadowman123 View Post
dude the Thread which handle the Auto invites not the main cause that the source consuming alot of ram .. the main cause is Loading Dmaps files ..anyways i dont think that there is other way to handle it you have to make checker every 1sec
1 thread to do everything sounds to me a better idea than 9 threads as each new thread consume more ram than 1 doing everything
03/09/2013 01:49 pro4never#6
Threads do not consume much ram at all. Likely you're loading every dmap in the game versus just the maps which are currently populated (and possibly not using compressed versions of the maps)


As for auto invites, you could use timers, a global thread, etc. Many ways to handle the same thing but it's up to the programmer do decide what's best for their current needs.
03/09/2013 01:55 go for it#7
Quote:
Threads do not consume much ram at all
Quote:
[Only registered and activated users can see links. Click Here To Register...]
i think that 9 thread * 1mb is 9 mb, once thread is done the main thread call it again ?
so that 9 mb is each time the main thread run those threads again ?
explains why when you get server at steady state it still consume memory by time ?

im not being rude or anything , i just want to know how it works as what i know so far that this threads is called so many times and each consume 1 mb and it does not allocate all of that memory , bother to explain more :) ?

thanks for "(and possibly not using compressed versions of the maps)" i found it useful :D
03/09/2013 10:39 derpingson#8
Well, i blaimed Threads because

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]

Does this look like 9 Threads?
03/09/2013 16:24 go for it#9
Quote:
Originally Posted by derpingson View Post
Well, i blaimed Threads because

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]

Does this look like 9 Threads?
i said 9 as the basic threads in my source not in yours but it was an example of what people doing , being organized and adding more threads , or even being stupid and create thread like "kimo thread" on the edited trinity which send autoinvite and could be merged with other threads

and im sorry i said what i know till now and waiting someone who knows better to lemme know relation of threads with memory as it's kinda confusing to me too after what p4n said , but till now what you and i tested was proving what i've said eariler
03/09/2013 21:18 U2_Caparzo#10
1 thread for everything sounds like a big bottleneck and inefficient, the reason is the difference between their loop time, example
autoinvite each hmmm... xx:15 hrs, other every xx:00 hrs, and other at xx:40 hrs, u don't need to check every single second if its one of these hours, so a thread with a loop of 1 min or even more would be a good a idea, but in the other hand, u need to handle Characters stats(blessing, luck, stamina, etc...) a good idea would be a loop of less than a second.
then the thread would look like

Thread t = new Thread(500);//Loop time in ms
{
if(DateTime.Now.Minute == 15
{
//start X Event
}
....
foreach(Character c in GamePool.Vaues)
{
c.Bless++;//i know u need checks, its just an ex.
...
}
}


then add the Mobs movement, Dropped items remove, etc... would cause a delay in the code execution and make clients a bit more lag.
that is why most of the servers will have more than one thread.
i'm doing it like
1 thread for Characters.
1 Thread for Mob AI//not yet but i will
1 Thead for DroppedItems
1 Thread for other things(eventes, broadcast, etc...)

hope it help u