Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 12:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]Make the threading system better.[5165 NewestCOServer]

Discussion on [Release]Make the threading system better.[5165 NewestCOServer] within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
[Release]Make the threading system better.[5165 NewestCOServer]

Okay so,

I was bored so I thought I would release some easy shiz. Credits to Impulse for his Thread.cs

Goto Program.cs find
Code:
Console.WriteLine("The server is ready for connections.");
abit under that is the threading system. It's like
Code:
ServerThread = new ServerThread;
Delete all of that and change it to
Code:
Main.Thread CompanionThread = new Main.Thread(100);
            CompanionThread.Execute += new Action(CompanionThread_Execute);
            Main.Thread ServerStuff = new Main.Thread(100);
            ServerStuff.Execute += new Action(ServerStuff_Execute);
            Main.Thread MobThread = new Main.Thread(100);
            MobThread.Execute += new Action(MobThread_Execute);
            GC.KeepAlive(CompanionThread); GC.KeepAlive(ServerStuff); GC.KeepAlive(MobThread);
and make a new file called Thread.cs in the 'Main' folder
Replace everything inside with
Code:
using System;
using System.Threading;

namespace COEmulator.Core
{
    public class Thread
    {
        private readonly System.Threading.Thread _baseThread;
        public event Action Execute;

        public int LoopInterval { get; set; }
        public ThreadPriority Priority { get { return _baseThread.Priority; } set { _baseThread.Priority = value; } }
        public bool Close { get; set; }

        public Thread(int loopInterval)
        {
            LoopInterval = loopInterval;
            _baseThread = new System.Threading.Thread(Loop) { Priority = ThreadPriority.Normal };
            _baseThread.Start();
        }

        private void Loop()
        {
            while (true)
            {
                if (Close)
                    return;
                try
                {
                    if (Execute != null)
                        Execute.Invoke();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
                System.Threading.Thread.Sleep(LoopInterval);
            }
        }
    }
}
Vola.
_DreadNought_ is offline  
Thanks
4 Users
Old 09/08/2010, 18:48   #2
 
elite*gold: 0
Join Date: Jul 2010
Posts: 223
Received Thanks: 23
Good job =P
It's still needs a new socket system though! And... multiple other things >< lol

I'm sticking with my source for now =P
-Fáng- is offline  
Old 09/08/2010, 19:34   #3
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
I'll be releasing some shiz that will do that, May even release the massive fix for the socket system since I am very bored
_DreadNought_ is offline  
Old 09/08/2010, 19:36   #4
 
elite*gold: 0
Join Date: Sep 2010
Posts: 38
Received Thanks: 6
The DB should be fixed instead
TechBoX is offline  
Old 09/08/2010, 19:38   #5
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
The source needs a efficient threading, communication, and database, system.
Basser is offline  
Old 09/08/2010, 19:42   #6
 
elite*gold: 0
Join Date: Sep 2010
Posts: 38
Received Thanks: 6
Quote:
Originally Posted by Basser View Post
The source needs a efficient threading, communication, and database, system.
In other words, it needs to be rewritten
TechBoX is offline  
Old 09/08/2010, 19:45   #7
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
Quote:
Originally Posted by TechBoX View Post
In other words, it needs to be rewritten
Rewriting a source is definitely something different.
E.g. when a v2 would be released, by the original owner, and he would've created a new project and used the same system etc but rewrote it so it looks a bit different, has new features etc, that would be rewriting.

I'd call this editing on a epic scale.
Basser is offline  
Thanks
1 User
Old 09/08/2010, 19:48   #8
 
elite*gold: 0
Join Date: Sep 2010
Posts: 38
Received Thanks: 6
With system, I took it as anything else XD
TechBoX is offline  
Old 09/08/2010, 20:39   #9
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
I'll do a major rewrite then. Tanel wont ever release a V2 so I will
_DreadNought_ is offline  
Old 09/08/2010, 20:56   #10
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
Quote:
Originally Posted by Eliminationn View Post
I'll do a major rewrite then. Tanel wont ever release a V2 so I will
A rewrite means you start a new project and add all the code yourself, but only based on the same project. (afaik)
Basser is offline  
Thanks
1 User
Old 09/13/2010, 11:17   #11
 
elite*gold: 0
Join Date: Aug 2010
Posts: 452
Received Thanks: 75
This actually looks good
dowhatuwant is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Release] 5165 Warehouses Auth System
04/01/2011 - CO2 PServer Guides & Releases - 18 Replies
this is just a simple Auth system for warehouses. It will ask for password (set from WHGuardian) each time players will open their warehouse. Attempt limit is not included in this release... btw; with this release, warehouseGuardian will now save the password in Character file. here are the screenshots: http://img408.imageshack.us/img408/6986/98867182. jpg Click The Image to see more screen shots 1. Go to NPCDialog.cs and search for this code: public static void...
[Release] Flower System (5165)
09/25/2010 - CO2 PServer Guides & Releases - 71 Replies
Heya! Mostly complete... just figure a way to save it on your server.... ScreenShots: http://img98.imageshack.us/img98/1949/164947279.j pg http://img714.imageshack.us/img714/5372/64922998. jpg http://img59.imageshack.us/img59/1025/64930238.jp g
[RELEASE]Anti bot system 5165
06/15/2010 - CO2 PServer Guides & Releases - 15 Replies
Here is an simple anti bot system. Credits goes to Arco for the npc send thing :) First go to MyThreads.cs and find: interval = Interval; T = new Thread(new ThreadStart(Run)); T.Start();
[RELEASE]Fully Working AFK System 5165
05/16/2010 - CO2 PServer Guides & Releases - 9 Replies
Hello Elitepvpers. I will start release things again. I released a tdm for not long time ago, but now i will release a fully working afk system. If you are smart enough you can convert it with my anti bot thing. First go to Character.cs and search for: public ulong VP; under it put: public bool AFK;
[Release]NPC system 5165 simplified
05/10/2010 - CO2 PServer Guides & Releases - 14 Replies
//



All times are GMT +1. The time now is 12:11.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.