Register for your free account! | Forgot your password?

You last visited: Today at 11:22

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

Advertisement



Is this the best way?

Discussion on Is this the best way? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old 07/06/2011, 13:47   #16
 
elite*gold: 0
Join Date: Aug 2004
Posts: 26
Received Thanks: 4
Quote:
Originally Posted by Lateralus View Post
In my proxy, I use class Hero to describe MY character, and class Player to describe other players. Just saying.
Why have 2 classes that do the same thing?
Yaksha is offline  
Old 07/06/2011, 14:19   #17
 
Lateralus's Avatar
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
Quote:
Originally Posted by Yaksha View Post
Why have 2 classes that do the same thing?
They don't do the same thing, not nearly. The packet that initializes your character and other characters are different, plus there are more fields in my character (such as thread controllers), that aren't needed in other players. Remember - this is for a proxy. In a server, yeah, all characters should have the same specifications.
Lateralus is offline  
Old 07/06/2011, 20:34   #18
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by Kiyono View Post
Or people just like using Hero, really you don't have the right to decide what people call things in their source.
owned, and yea i like using Hero, i'm in no way following TQ,
-Shunsui- is offline  
Old 07/06/2011, 21:26   #19
 
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
I personally use "*****." I only do this so I can go "*****.Money -= XX" xD
Santa is offline  
Thanks
3 Users
Old 07/06/2011, 21:41   #20
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
On ******* topic:

No, this is extremely inefficient.
No need to sort the list to get the max battle power (that's a lot more (n/logn times as many comparisons needed)) even if you do it that way.
_tao4229_ is offline  
Thanks
1 User
Old 07/06/2011, 21:53   #21
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,381
Personally I just love whoever wrote the class names for CoEmu ISMA.

It has all sorts of handy class names like the "IMMASOCKET" class.


It brings untold joy to my heart looking through that source finding all the fun class names.
pro4never is offline  
Thanks
3 Users
Old 07/06/2011, 23:02   #22
 
Lateralus's Avatar
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
Quote:
Originally Posted by _tao4229_ View Post
On ******* topic:

No, this is extremely inefficient.
No need to sort the list to get the max battle power (that's a lot more (n/logn times as many comparisons needed)) even if you do it that way.
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.

Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
Lateralus is offline  
Old 07/06/2011, 23:33   #23


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Lateralus View Post
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.

Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
Very much agreed, been using them for a while
Korvacs is offline  
Old 07/07/2011, 00:49   #24
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
Quote:
Originally Posted by Lateralus View Post
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.

Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
why do you need a try/catch blocks as long as there is no way the void well throw an exception ?

Quote:
if (Client.Team == null) { return 0;} int bp = 0;
foreach (Character C in ThreadSafeDictionary(Client.Team).values)
if (C.BattlePower > bp) { bp = C.BattlePower; }
return bp;
i know you said thats how (YOU) do it but... i wold like to know how is it gonna return any errors and why does it need a try/catch blocks and how can it be easier than that and why do you need to sort such dictionary that contains less than 6 items ?
{ Angelius } is offline  
Old 07/07/2011, 01:32   #25
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
why not simply do inside the team ...

public ushort BP = 0;

//shall use it when a new mem is added
public void NewMate_CHK(MemberInfo Mem)
{
//check the clan
//if he/she belongs to the same clan then
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is

//them send to the team membs the new potency value...
}

//shall use this when a player logout or just leave the team...
public void CHK_WholeLogOut()
{
BP = 0;
foreach(MemberInfo m in members.values)
//check if he/she belongs to clan... if not ... then just pass it with continue;... else
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is

//them send to the team membs the new potency value...
}
12tails is offline  
Thanks
1 User
Old 07/07/2011, 01:49   #26
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Quote:
Originally Posted by 12tails View Post
why not simply do inside the team ...

public ushort BP = 0;

//shall use it when a new mem is added
public void NewMate_CHK(MemberInfo Mem)
{
//check the clan
//if he/she belongs to the same clan then
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is

//them send to the team membs the new potency value...
}

//shall use this when a player logout or just leave the team...
public void CHK_WholeLogOut()
{
BP = 0;
foreach(MemberInfo m in members.values)
//check if he/she belongs to clan... if not ... then just pass it with continue;... else
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is

//them send to the team membs the new potency value...
}
Inside the team? is it inside the team packet?
or when creating the team, team leader BP is the base for sharing to the team.member with appropriate calculation of BP sharing. Or searching the Highest BP within the Team.Leader and Team.Member and make it as the base for sharing BP. is it correct?
marlyandedsel is offline  
Old 07/07/2011, 06:07   #27
 
Lateralus's Avatar
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
Quote:
Originally Posted by { Angelius } View Post
why do you need a try/catch blocks as long as there is no way the void well throw an exception ?



i know you said thats how (YOU) do it but... i wold like to know how is it gonna return any errors and why does it need a try/catch blocks and how can it be easier than that and why do you need to sort such dictionary that contains less than 6 items ?

I'm just kidding man. That would be ridiculously inefficient.
Lateralus is offline  
Old 07/07/2011, 21:05   #28
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
thanks for the help, lol i guess ill just do it how, 12talis said.
-Shunsui- is offline  
Old 07/07/2011, 23:18   #29
 
Lateralus's Avatar
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
Quote:
Originally Posted by -Shunsui- View Post
thanks for the help, lol i guess ill just do it how, 12talis said.
And use concurrent dictionaries.
Lateralus is offline  
Reply




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


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

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