Impulse Based Source Bugs / Problem

07/09/2012 16:27 shadowman123#1
Well I've Been working On this Source for 1 year or so Fixed alot of its bugs / added alot of thins but am looking for stability Right now .. making sure everything is well coded but Alot Told me that :-

1 - Thread system is Weakly Coded

2 - Monster Spawn is badly Coded

So what i was asking if sm1 tried Impulse based source ..Could Tell me :-

1 - How They r bad Coded ?

2 - What can be Done to improve them ?

3 - What do u see need to be Recoded ?

Regards
shadowman123
07/09/2012 19:33 _DreadNought_#2
If you're asking us what's wrong with it what makes you think you can fix it?
07/09/2012 20:38 shadowman123#3
Quote:
Originally Posted by _DreadNought_ View Post
If you're asking us what's wrong with it what makes you think you can fix it?
ill Depend on My Experience in Source beside my C# knowlage then give it a try .. And i think i can handle it ..but my problem is that i dont know whats wrong with Threading system !! thats y am asking
07/09/2012 20:53 _DreadNought_#4
Quote:
Originally Posted by shadowman123 View Post
ill Depend on My Experience in Source beside my C# knowlage then give it a try .. And i think i can handle it ..but my problem is that i dont know whats wrong with Threading system !! thats y am asking
Do some searching, It's been pointed out by InfamousNoone in a DuelistAI thread.

It uses GC.KeepAlive, which really shouldn't be used.
07/09/2012 21:01 shadowman123#5
Quote:
Originally Posted by _DreadNought_ View Post
Do some searching, It's been pointed out by InfamousNoone in a DuelistAI thread.

It uses GC.KeepAlive, which really shouldn't be used.
ThanQ Dread
07/11/2012 00:09 I don't have a username#6
Well it uses a lot of bad coding habits.
07/11/2012 17:28 shadowman123#7
Quote:
Originally Posted by I don't have a username View Post
Well it uses a lot of bad coding habits.
What do u think need to be Recoded ? Honestly Only Things i Recoded Are Reincarnation and Floor Item / Flower system / Lottery system .. Nothing else i went thought Threads But Havent Learned Much ..
07/11/2012 21:34 _DreadNought_#8
Threads do need recoding.

I'd also recode the Screen class, infact, I'd recode everything... iashdfai;sd, idunno, I can't use public sources anymore, own sources ftw.
07/11/2012 23:42 shadowman123#9
Quote:
Originally Posted by _DreadNought_ View Post
Threads do need recoding.

I'd also recode the Screen class, infact, I'd recode everything... iashdfai;sd, idunno, I can't use public sources anymore, own sources ftw.
Well Im Abit DisAppointed but i Can Handle it At last But Please When you Say smthing is Bad Tell me Y it is for Screen System idk whats Wrong with it..Can u ? .. For Threads i Searched for it But All i got is Different Techniques of Making Thread For Example Using This Way

Code:
Thread MyThread = new Thread(new ThreadStarter(Target));
MyThread.Start();
MyThread.Join();
07/12/2012 00:11 _DreadNought_#10
Quote:
Originally Posted by shadowman123 View Post
Well Im Abit DisAppointed but i Can Handle it At last But Please When you Say smthing is Bad Tell me Y it is for Screen System idk whats Wrong with it..Can u ? .. For Threads i Searched for it But All i got is Different Techniques of Making Thread For Example Using This Way

Code:
Thread MyThread = new Thread(new ThreadStarter(Target));
MyThread.Start();
MyThread.Join();
Threading is so, so, so simple, Why do people over do it?
It's as simple as:
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ConquerSource.Game;
using System.Diagnostics;

namespace 
ConquerSource.Core
{
    public class 
Threading
    
{
        static 
TIME _LastCheck;
        public static 
void Fireup()
        {
            
_LastCheck TIME.Now;

            
//Main thread
            
new Thread(Core).Start();
            
Program.WriteLine("[Threading] Core threads has been created and started.");
        }
        public static 
void Core()
        {
            while (
true)
            {
                
TIME CurrentTime TIME.Now;
                if (
CurrentTime.Time >= _LastCheck.Time)
                {
                    
_LastCheck TIME.Now;

                    
Stamina_Check();
                }
                
Thread.Sleep(100);
            }
        }
        private static 
void Stamina_Check()
        {
            foreach (
GameClient client in Kernel.GamePool.Values)
            {
                
TIME CurrentTime TIME.Now;
                
double Time 0;
                
bool Quick false;
                if (
client.Char.Action == ConquerAction.Sit)
                {
                    
Time 800;
                    
Quick true;
                }
                else
                    
Time 1200;
                if (
client.Char.StaminaStamp.Time <= CurrentTime.Time)
                {
                    
client.Char.StaminaStamp CurrentTime.AddMilliseconds((int)Time);
                    if (
client.Char.Stamina != 100)
                    {
                        switch (
Quick)
                        {
                            case 
false:
                                {
                                    if (
client.Char.Stamina <= 96)//7?
                                        
client.Char.Stamina += 3;
                                    else
                                        
client.Char.Stamina 100;
                                    break;
                                }
                            case 
true:
                                {
                                    if (
client.Char.Stamina <= 93)//10?
                                        
client.Char.Stamina += 7;
                                    else
                                        
client.Char.Stamina 100;
                                    break;
                                }
                        }
                    }
                }
            }
        }
    }

I wrote that over a year ago, there's no need for a load of fancy threading shit, keep it simple, keep it good.

Note: Over a year ago, Yes I should be going through the dictionary as an array for faster speeds, and the stamina code is abit fucked up, ontop of the initial thread check, but it works, very well.
07/12/2012 01:27 Zeroxelli#11
Never create a thread like that, it's a bad idea in servers. You always want to have a way to access it later on in case something happens. Create a variable and assign the thread to that, then call start. Thus why MSDN uses that method.

Also, why did that example call Join()? That's all fine and dandy in a desktop application, but in a server you never want to block the thread of the socket. That would mean that no other connections were accepted until that connection disconnected or the thread handle was terminated. Bad idea.

My $0.02 + tax.