Go Back   RunUO - Ultima Online Emulation > RunUO > General Discussion

General Discussion General discussion for the RunUO community, all off-topic posts will be deleted. This forum is NOT FOR SUPPORT!

Reply
 
Thread Tools Display Modes
Old 01-28-2003, 05:38 PM   #1 (permalink)
 
Join Date: Nov 2002
Posts: 42
Default max damage - min damage

right now runuo calculates the damage using a random between the min and the max damage, will it be changed sometime to osi system that is using dices?
garlor is offline   Reply With Quote
Old 01-28-2003, 06:06 PM   #2 (permalink)
Administrator
 
Zippy's Avatar
 
Join Date: Aug 2002
Location: Baltimore, MD
Age: 25
Posts: 4,868
Default

Dice and Randoms are the same thing

4d6+5 is the same as random from 9 to 31

And actually there is a utility function for dice rolls.
__________________
Zippy, Razor Creator and RunUO Core Developer
The RunUO Software Team

"Intuition, like a flash of lightning, lasts only for a second. It generally comes when one is tormented by a difficult decipherment and when one reviews in his mind the fruitless experiments already tried. Suddenly the light breaks through and one finds after a few minutes what previous days of labor were unable to reveal."
~The Cryptonomicon

Zippy is offline   Reply With Quote
Old 01-28-2003, 06:51 PM   #3 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 487
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

Wouldn't the numbers be distributed differently with dice then by using random numbers?

2d6+1 may be a random number between 3 and 13, but wouldn't 8 be a more common number then 13 this way? Choosing a purly random number between 3 and 13 the odds for all numbers are distributed evenly.
Bradley is offline   Reply With Quote
Old 01-28-2003, 07:12 PM   #4 (permalink)
 
Join Date: Jan 2003
Location: Canadia
Age: 22
Posts: 1,935
Send a message via ICQ to Dalius Send a message via AIM to Dalius
Default

How does dice work anyway?
Dalius is offline   Reply With Quote
Old 01-28-2003, 07:32 PM   #5 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

2d6

means the lowest is 2

1 and 1

the highest is 12

6 and 6
Phantom is offline   Reply With Quote
Old 01-28-2003, 07:36 PM   #6 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 487
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

2d6+5 would be 2 6-sided dice, roll them, add the numbers, and add 5
Bradley is offline   Reply With Quote
Old 01-28-2003, 09:01 PM   #7 (permalink)
Forum Administrator
 
krrios's Avatar
 
Join Date: Aug 2002
Posts: 2,850
Default

There should be no difference between 2d6+1 and [3..13].
krrios is offline   Reply With Quote
Old 01-28-2003, 09:08 PM   #8 (permalink)
 
Join Date: Jan 2003
Posts: 22
Default

Quote:
There should be no difference between 2d6+1 and [3..13].
This is a quite common misconception, if you don't mind me jumping in here for just a moment. While it would appear like they're not different from each other, they are in reality.

Consider this:

2d6 gives a range of 2-12.

Roll 2d6 500 times and you'll get the same average as if you did a random 2-12 500 times.

-But- the difference is obvious when rolling just once. 7 is the most common result with 2d6. How? Well, take a look at the dice. There are a total of 3 combinations that can give a total result of 7.

1 + 6
2 + 5
3 + 4

But! There's only one combination that gives 2, and the same thing applies for 12.

1 + 1

or

6 + 6

So, in conclusion, while it averages out over a large number of rolls, using a die system tends to give less extreme individual rolls, and more "average" rolls.

[Edit for typos in the numbers]
Warder is offline   Reply With Quote
Old 01-28-2003, 09:52 PM   #9 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 487
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

I play plenty of Pen & Paper Dnd games. Rolling 2d10 is always much safer then rolling 1d20.

This is fairly easy to test. Write a short program that loops and chooses a random number bewteen 2 and 10, count the number of times each number shows up. Then do the same thing but choose 2 random numbers between 1 and 5, add them together and count the number of times each number shows up. If you loop enough times, say 1000 times, and graph the results on a line graph you will see the following.
The [2-10] will be a straight horizontal line, the [1-5] + [1-5] will result in a Bell Curve. The average of the numbers will be preserved, but the chance of getting a 10 or a 2 is significantly less when choosing 2 random numbers and adding them.

I'm really not trying to be annoying about this, but there is an important distinction in the results. It really helps to stop the occurance of getting a really high attack on 1 roll, and a really low on the next. there is still a chance it's going to happen, but it would pull the attach closer to a mid range, and make powerful, or pityful attacks more rare.
Bradley is offline   Reply With Quote
Old 01-28-2003, 10:40 PM   #10 (permalink)
 
Join Date: Jan 2003
Location: Canadia
Age: 22
Posts: 1,935
Send a message via ICQ to Dalius Send a message via AIM to Dalius
Default

too confusing for me
*flees*
Dalius is offline   Reply With Quote
Old 01-28-2003, 11:20 PM   #11 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 487
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

I whipped together a quick example program to show the results. Create a blank VB.Net project, add a module and paste in the following code, then point the program to use this sub as the entrypoint.

the 1st column will the the Result of the roll.
the 2nd column is the count of times that number occured by choosing a random number between 2 and 12.
the 3rd column is the count of times that number came up by choosing 2 random numbers between 1 and 6, and adding them.

[code:1]Module Module1
Sub Main()
Randomize()
Dim Arr1(12) As Integer
Dim Arr2(12) As Integer
Dim I As Integer
For I = 1 To 10000
Dim r1, r2, r3 As Integer
r1 = Int(Rnd() * 11) + 2 'random between 2 and 12
r2 = Int(Rnd() * 6) + 1 'random between 1 and 6
r3 = Int(Rnd() * 6) + 1 'random between 1 and 6
Arr1(r1) += 1
Arr2(r2 + r3) += 1
Next
Dim R As String
For I = 2 To 12
R = R & I & " - " & vbTab & Arr1(I) & vbTab & Arr2(I) & vbNewLine
Next
MsgBox(R)
End Sub
End Module[/code:1]
Bradley is offline   Reply With Quote
Old 01-28-2003, 11:26 PM   #12 (permalink)
Administrator
 
Zippy's Avatar
 
Join Date: Aug 2002
Location: Baltimore, MD
Age: 25
Posts: 4,868
Default

oh god I hate VB

Anyway, here's a C# comparison:


Quote:
Dice:
2: 110844
3: 221727
4: 333868
5: 222490
6: 111071
Rand:
2: 200425
3: 200106
4: 199996
5: 199864
6: 199609
[code:1]
using System;

namespace Dice
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
int[] dice = new int[]{ 0, 0, 0, 0, 0 };
int[] rand = new int[]{ 0, 0, 0, 0, 0 };
for (int i=0;i<1000000;i++)
{
dice[Dice( 2, 3, 0 )-2] ++;
rand[Random( 5 )] ++;
}

Console.WriteLine( "Dice: " );
for (int i=0;i<dice.Length;i++)
{
Console.WriteLine( "{0}: {1}", i+2, dice[i] );
}

Console.WriteLine( "Rand: " );
for (int i=0;i<rand.Length;i++)
{
Console.WriteLine( "{0}: {1}", i+2, rand[i] );
}

Console.ReadLine();
}

private static Random m_Random = new Random();
//4d6+8 would be: Utility.Dice( 4, 6, 8 )
public static int Dice( int numDice, int numSides, int bonus )
{
int total = 0;
for (int i=0;i<numDice;++i)
total += Random( numSides ) + 1;
total += bonus;
return total;
}

public static int Random( int count )
{
return m_Random.Next( count );
}
}
}
[/code:1]
__________________
Zippy, Razor Creator and RunUO Core Developer
The RunUO Software Team

"Intuition, like a flash of lightning, lasts only for a second. It generally comes when one is tormented by a difficult decipherment and when one reviews in his mind the fruitless experiments already tried. Suddenly the light breaks through and one finds after a few minutes what previous days of labor were unable to reveal."
~The Cryptonomicon

Zippy is offline   Reply With Quote
Old 01-28-2003, 11:29 PM   #13 (permalink)
Forum Administrator
 
krrios's Avatar
 
Join Date: Aug 2002
Posts: 2,850
Default

Thank you kind sirs, I see the error in my ways.
krrios is offline   Reply With Quote
Old 01-29-2003, 04:41 AM   #14 (permalink)
 
Join Date: Nov 2002
Posts: 42
Default

that's why I asked it here, weapons in osi have dice throws, like katana (3d8+2), and it's fairly better to use dice throws instead of random values, I've modified my baseweapons.cs to do it but would be better if it's in the same runuo release scripts

someone said there's an utility to make the dice throws, how do I use it? (I'm a bit noob with runuo script)
garlor is offline   Reply With Quote
Old 01-29-2003, 07:56 AM   #15 (permalink)
 
Join Date: Dec 2002
Posts: 140
Default

Law of big numbers.

The random function gives you an uniform probability. So all numbers have the same probability to appear.

But when you add a lot of those random variables, the new result isn't uniform anymore. It's a gaussian curve.

Check this link to clarify a bit what I said:
http://www.willamette.edu/~mjaneba/h...rmalcurve.html

As for the dice roll, this is his sintaxis (it's on Utility):
int Dice(int numDice,int numSides,int bonus)

I haven't use it never, but maybe a 3d8 + 1 will be:
Utility.Dice(3,8,1);

Edited: garlor, use the Sharpdevelop IDE. With him you can see the hardcoded functions that runuo.exe have inside, and has code completion. Really useful to program.
mrkroket is offline   Reply With Quote
Old 01-29-2003, 08:11 AM   #16 (permalink)
Forum Expert
 
Kiwi's Avatar
 
Join Date: Sep 2002
Location: Northeast Ohio
Age: 22
Posts: 3,178
Send a message via ICQ to Kiwi Send a message via AIM to Kiwi Send a message via MSN to Kiwi
Default

I made a script to test dice formulas by dclicking on a stone, and as some people said, they were much less random..
Kiwi is offline   Reply With Quote
Old 01-29-2003, 11:28 AM   #17 (permalink)
 
Join Date: Nov 2002
Posts: 42
Default

where can I find the sharpdevelop IDE ?
garlor is offline   Reply With Quote
Old 01-29-2003, 01:10 PM   #18 (permalink)
Newbie
 
Join Date: Oct 2002
Posts: 77
Default

FYI, Dougan_Ironfist has modified the weapons scripts to use dice rolls (and use the OSI specs for each weapon). He's hosting it for download on his site.

If the RunUO designers decide to convert to using a dice function for weapons, they should really take a look at his script. He does this cool thing with a Point3D to plug in the variables.

If I remember correctly, he used:

Point3D (X, Y, Z)

So you can use (and easily change) XdY + Z
ardsdap is offline   Reply With Quote
Old 01-29-2003, 01:24 PM   #19 (permalink)
 
Join Date: Nov 2002
Posts: 42
Default

I've got it made too, it's very easy, it's lot harder to make the hitpoints a weapon has (my next goal) than make this change, but hey, it's my first step in runuo, better go slowly
garlor is offline   Reply With Quote
Old 01-29-2003, 01:48 PM   #20 (permalink)
 
Join Date: Dec 2002
Posts: 140
Default

Where to download SharpDevelop
http://www.icsharpcode.net/OpenSource/SD/default.asp

How to configure it to allow code completion:

http://www.runuo.com/discussion/view...t=sharpdevelop

In Spanish:
Arrancas el runuo y cuando haya acabado de cargar lo cierras. Busca el archivo Script.dll y copialo a otro lado con otro nombre.
Te bajas el sharpdevelop del primer link. Lo instalas y una vez dentro creas un nuevo proyecto vacio.
Pon el sharpdevelop en español (ya que te dan la opción ^^)
En la columna de proyectos vete a tu proyecto y dentro de él aparece la etiqueta 'Referencias'. Con el segundo botón eliges agregar referencia->Visor de Ensamblajes .NET->Browse.
Te pedirá que elijas un archivo. Elige el runuo.exe y el script.dll renombrado que tenías. Con esto te saldrán las dos nuevas referencias, y puedes ver las clases que tienen dentro (y sus propiedades), además de que completa el código. Es muy muy útil. Ni intentes scriptear algo sin él, porque para "bucear" buscando ese método o variable que buscas no hay nada mejor.
mrkroket is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5