Jump to content

Our Own WOL?


Recommended Posts

Ok ladder points should now be accurate, I'm using a new system:

   $winner_percent = round($points_winner * 0.1);
 $loser_percent = round($points_loser * 0.1);

 $winner_exp = 1 / (pow(10, ($points_loser - $points_winner) / 400) + 1);
 $loser_exp = 1 / (pow(10, ($points_winner - $points_loser) / 400) + 1);

 $winner_diff = round(64 * (1 - $winner_exp));
 $loser_diff = round(64 * (0 - $loser_exp));

 if ($winner_diff < 0 && $winner_diff < -$winner_percent)
$winner_points = -$winner_percent;
 else
$winner_points = $winner_diff;
 if ($loser_diff < 0 && $loser_diff < -$loser_percent)
$loser_points = -$loser_percent;
 else
$loser_points = $loser_diff;

 $players[$winner] += $winner_points;
 $players[$loser] += $loser_points;

Link to comment
Share on other sites

Anyone with some programming experience can read that.

For who who can't:

$... stands for a variable.

= means that the left variable gets the value of what is on the right.

when the line stated after "if" is true, then the line below it will be executed.

Otherwise the line will be executed beneath "else"

and ';' means the end of a "line"

Dunno what "round" means, but it some sort of calculation method

Link to comment
Share on other sites

I guess that points_winner and points_loser are the current ladderscores for the two players, right?

The function "round" usually returns the integer closest to the argument, so round(2.4)=2 and round(2.67)=3, I don't speak PHP but I guess (and hope) that this behavior is normal for a programming language.

Gobalopper, can you comment on the code? I think that I understand how it works, but it seems that the same general behavior can be achieved somewhat simpler; unless you are trying to reproduce some old scoring system. If so, how did that work?

-JB

PS I notice that I'm no longer a sandflea, does that mean that I'm vulnarable to wormattacks now ?? ;)

Link to comment
Share on other sites

Ah thanks. What you stated about round is very likely to be true, and it makes sense too since you don't see points with numbers behind the '.'

And you always are vulnerable for worm attacks :D

Link to comment
Share on other sites

What are you talking about? Are you sure you clicked the right link?

http://www.dune2k.com/?page=download&id=715

Will this link allow me to use the ladder? And will the program run completely seperate from Emperor (emperor will just treat it as if it were sending results to the Westwood Online server)? I'm just worried that the program may cause errors to occur in the actual game.

Link to comment
Share on other sites

JB thats just a simplified version of the code so its a little easier to read. $points_winner/loser is the current number of points going into the game. The reason it rounds is that otherwise you get a lot of decimals which aren't used.

Link to comment
Share on other sites

Also depending on how much money we get from ads there might be prizes each month. Nothing amazingly expensive but its better then nothing. :)

woaw cool prizes!! maybe that should attrackt mor pple :)

Link to comment
Share on other sites

Also depending on how much money we get from ads there might be prizes each month. Nothing amazingly expensive but its better then nothing. :)

>:( I really hoped this site would never have ads.

If you like to play the game, you don't need the prices

Link to comment
Share on other sites

Off Topic:

The ads are small, dont flash or animated, simple text, only on main fed2k page and other subsidiaries. (not in forum)

Do have relative similiar items that people from forum may be interested in.

As long as they're not popups or animated its all good.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...