Serious Help

06/17/2012 02:19 shadowman123#1
Well I Wanna Code :-

1 - Flower Ranking

2 - Guild Donation Ranking

3 - Pk Exploit

ill save them with Database And load them Either when Source Start or When Player Join Game but this isnt the issue the Main issue that i feel its going to Make Server Slower or make it less efficient as its going to Load 3 Tables that conatins alot of Data so this Kind Affect badly on Server.... Right ? or iam Wrong About that
06/17/2012 04:21 Zeroxelli#2
What do you mean make it slower? The actual data amount on those tables wouldn't take a lot of memory if you do the class/struct that holds the data correctly and don't duplicate the data. I had my rankings/top guilds/top players/etc tables in the server for easy updating, and it never even took up more than 1MB of memory.
06/17/2012 04:59 shadowman123#3
Well for Pk Exploits :-

1 - Lets Assume that i have 300 Player in Server and each player's total killing is 30 so thats 300 x 30 = 9000 Line in Database and thats very low killing rate..1 Player can kill for example 40 Player in one Day so thats Huge load on database ..So i need to understand how it works ? Surely TQ didnt Make smthing like that ..weird
06/17/2012 05:04 Zeroxelli#4
Quote:
Originally Posted by shadowman123 View Post
Well for Pk Exploits :-

1 - Lets Assume that i have 300 Player in Server and each player's total killing is 30 so thats 300 x 30 = 9000 Line in Database and thats very low killing rate..1 Player can kill for example 40 Player in one Day so thats Huge load on database ..So i need to understand how it works ? Surely TQ didnt Make smthing like that ..weird

Well for Pk Exploits :-

1 - Lets Assume that i have 300 Player in Server and each player's total killing is 30 so thats 300 x 30 = 9000 Line in Database and thats very low killing rate..1 Player can kill for example 40 Player in one Day so thats Huge load on database ..So i need to understand how it works ? Surely TQ didnt Make smthing like that ..weird
Actually, you might only have to send one page at a time, so it wouldn't be that high a load anyway. And if you're worried about them killing 9000 different people, just limit the amount you can save. Or, when you send it when they log on, add
Code:
LIMIT 100
to the end of your SQL query, so only 100 are loaded. You may want to also use the SORT clause in your SQL query to make sure you only get the highest killcounts.
06/17/2012 05:08 shadowman123#5
Quote:
Originally Posted by Zeroxelli View Post
Actually, you might only have to send one page at a time, so it wouldn't be that high a load anyway. And if you're worried about them killing 9000 different people, just limit the amount you can save. Or, when you send it when they log on, add
Code:
LIMIT 100
to the end of your SQL query, so only 100 are loaded. You may want to also use the SORT clause in your SQL query to make sure you only get the highest killcounts.
what do u mean by limit the Amount i Should save .. u mean i make just only 100 ROws in Database if Yes that would be USeless cuz once The Table is completed with 100 it would Stop Saving ..
06/17/2012 05:09 Zeroxelli#6
Quote:
Originally Posted by shadowman123 View Post
what do u mean by limit the Amount i Should save .. u mean i make just only 100 ROws in Database if Yes that would be USeless cuz once The Table is completed with 100 it would Stop Saving ..
No, the LIMIT 100 was for how many you load.. As for limiting the amount you save, just keep the table inside the server. Make a class or struct for each table entry, and keep them in a ConcurrentDictionary or something.
06/17/2012 05:16 shadowman123#7
Quote:
Originally Posted by Zeroxelli View Post
No, the LIMIT 100 was for how many you load.. As for limiting the amount you save, just keep the table inside the server. Make a class or struct for each table entry, and keep them in a ConcurrentDictionary or something.
well i can do Dictionery of the Class or Struct that contains the variables but whats the use of Dictionery ? i never Used it b4 and i Fail at using it seriously which make me kinda disappointed
06/17/2012 05:29 Zeroxelli#8
Quote:
Originally Posted by shadowman123 View Post
well i can do Dictionery of the Class or Struct that contains the variables but whats the use of Dictionery ? i never Used it b4 and i Fail at using it seriously which make me kinda disappointed
Example, we don't need a dictionary for now.
Code:
public static List<PkExploit> pkeDatabase = new List<PkExploit>();
Put that somewhere in your main file, probably Program.cs.

Code:
public class PkExploit
{
    public int KillerUID = 0; // The killer's UniqueID / Identity
    public int KilledUID = 0; // The victim's UniqueID / Identity
    public ulong TimeStamp = 0; // Timestamp of when they were killed
    public ushort KillCount = 0; // How many times Killer has PKed Killed
}
That's a sample class for a PkExploit.

Code:
PkExploit PKE = new PkExploit();
PKE.KilledUID = Target.Char.UniqueID;
PKE.KillerUID = Client.Char.UniqueID;
PKE.TimeStamp = Program.Microtime(); // I'll give you this function if you don't already have one of your own.
PKE.KillCount = 1; // Or, check if they're already in the table, and just increment it.

Program.pkeDatabase.Add(PKE);
There's a sample of creating one.

Microtime function:

Note, first you need the Unix Epoch date.

Code:
public static readonly DateTime Epoch = new DateTime(1970, 1, 1);
Code:
public static long Microtime()
{
    return Convert.ToInt64((DateTime.UtcNow - Epoch).TotalMilliseconds);
}
If you need these for later:

Code:
public static long MilliSecondsSince(long UTS)
{
    return (Microtime() - UTS);
}

public static long SecondsSince(long UTS)
{
    return ((Microtime() - UTS) / 1000);
}
Anyway, surely you can understand the rest.
06/18/2012 15:16 _DreadNought_#9
serious help? Give me a fucking break you make a thread almost daily.
06/18/2012 17:50 shadowman123#10
Quote:
Originally Posted by _DreadNought_ View Post
serious help? Give me a fucking break you make a thread almost daily.
Nah thats untrue i dont make daily maybe each 3 - 4 days and thats not Alawys too