Try to build multiple threading, 1st threading handles the database and the second threading handles characters, if you can pull it off your server will run with around 3 CPU most of the time, when a character disconnects make sure it dumps the character thread otherwise the cpu will rise.
Edit:
Also go into program.cs, Event_Handler and try to remove the catch, try's because this also rises your CPU.
Also another thing you can do, is make a partition on your :C Drive and store your database there, it helps load your database faster if its on its own drive, and causes less lag.
CPU is the brain of a computer it handles what does what, ram is the speed of the computer
The better your CPU the faster it handles obviously better CPU is better performance on the other hand speed is essencial too.
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post
No its because when you get 250 people online you have 250 active threads where a handful/a threadpool would do the same job.
when a character disconnects make sure it dumps the character thread otherwise the cpu will rise.
Quote:
Originally Posted by Korvacs
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
Quote:
Originally Posted by sonofskeletor
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post
..Ok well they are entirely different and seperate things, a character class or structure uses up memory, not CPU, your right that the character should be disconnected from the server and provided that is done then the GC will remove the character object provided its no longer being referenced, which should be the case if the disconnection is handled correctly.
But that has nothing to do with threads.
A thread could be compared to a road, things move along/through it and are handled depending on their circumstance, a class/struct/object could be likened to a vehicle that travels along that road and exits at various points depending on their circumstance.
This is a weak analogy since its just a generalisation of threads, but you get the general idea.
I don't use 1 thread per character...i use 2 threads to handle character effects (sit, xp ko, buffs) and 2 threads to handle attacks (for all characters online).
Using 1 thread per character when a large amount of players are online will indeed make CPU go crazy as Korvacs said...anyway the most important thing that makes the CPU stressed are drops (searching in database items) and mobs searching for a target (I managed to reduce this as much as possible).
Even so...I'll make a few tests with stopwatch to see what threads take the most amount of time to run.
Increasing FPS and Optimizing PC [To get rid of SF lag or any games] 03/25/2010 - Soldier Front - 7 Replies Step 1:
Cleaning and Defragmenting Hard Disk
A) Download Ccleaner
Go to FileHippo.com - Download Free Software
Next click Ccleaner and click "Download Latest Version"