Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Javascript Race Wizard
Javascript Race Wizard Mon, 15 June 2009 21:51 Go to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Did someone post a link to a javascript RaceWizard? I seem to remember seeing it mentioned, but I can't find it in my searches of the forum.

Anyone have a copy of it?

Report message to a moderator

Re: Javascript Race Wizard Mon, 15 June 2009 22:18 Go to previous messageGo to next message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
Were you thinking of this one: http://home20.inet.tele.dk/craebild/hab_range_tool/habcalc.h tml


Have fun.

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 12:10 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
I saw that one and it's pretty deluxe. I thought there was one that calculated the points for a race ala the race wizard. I can do it on the server side but I thought it would lend to a better user experience to have that calculation done client side as well.

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 12:31 Go to previous messageGo to next message
craebild is currently offline craebild

 
Lieutenant

Messages: 568
Registered: December 2003
Location: Copenhagen, Denmark
If you have the formulas for calculating the points, then it isn't impossible that I or m.a@stars can add point calculations to the hab and econ calculator.


Med venlig hilsen / Best regards / Mit freundlichen Grüßen
Christian Ræbild / Christian Raebild

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 14:12 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
There are formula's in the freestars source code:

http://freestars.svn.sourceforge.net/viewvc/freestars/trunk/ Server/Race.cpp?revision=14

It's not too tricky to follow until it gets to the part about calculating the Hab points by generating a bunch of planets. I haven't read that enough to fully understand it but the points calculations are probably fairly accurate. LEit and the freestars guys are highly dedicated to accuracy.

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 14:39 Go to previous messageGo to next message
craebild is currently offline craebild

 
Lieutenant

Messages: 568
Registered: December 2003
Location: Copenhagen, Denmark
That would be in C++, not Javascript. Still, AFAIK the logic and math commands are the same in C++ and Javascript, so the fact that I do not know C++ should not be a major obstacle.

You mention "calculating a bunch of planets". The code for the hab and econ calculator contains code for calculating the theoretical spread, i.e. the equivalent of averaging an infinite number of random planets.

If Stars! uses a sufficiently low number of planets, then that means that creating the same race twice could give different point totals in Stars!. I would suggest using the theoretical spread for any Stars! clone instead of a limited number of random planets. In my opinion, there is no need to reproduce the bugs in Stars! in a Stars! clone.

I haven't taken a look at the code you linked to yet, but I will - It might not be today, though.



Med venlig hilsen / Best regards / Mit freundlichen Grüßen
Christian Ræbild / Christian Raebild

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 16:40 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
craebild wrote on Tue, 16 June 2009 18:31

If you have the formulas for calculating the points, then it isn't impossible that I or m.a@stars can add point calculations to the hab and econ calculator.

Actually, I already did. It's not complete, though... Whip



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 16:41 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
sirgwain wrote on Tue, 16 June 2009 20:12

There are formula's in the freestars source code:

http://freestars.svn.sourceforge.net/viewvc/freestars/trunk/ Server/Race.cpp?revision=14

It's not too tricky to follow until it gets to the part about calculating the Hab points by generating a bunch of planets. I haven't read that enough to fully understand it but the points calculations are probably fairly accurate. LEit and the freestars guys are highly dedicated to accuracy.

If that code is there then they must have used the reverse engineered code that surfaced a couple years ago. Nobody understands it fully, but it comes from the Stars! exe itself and is 100% accurate. Deal

EDIT: They not only used the reverse engineered code, they seem to also have a slightly better understanding of it. Twisted Evil


[Updated on: Tue, 16 June 2009 18:03]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 16:46 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
craebild wrote on Tue, 16 June 2009 20:39

You mention "calculating a bunch of planets". The code for the hab and econ calculator contains code for calculating the theoretical spread, i.e. the equivalent of averaging an infinite number of random planets.

If Stars! uses a sufficiently low number of planets, then that means that creating the same race twice could give different point totals in Stars!. I would suggest using the theoretical spread for any Stars! clone instead of a limited number of random planets. In my opinion, there is no need to reproduce the bugs in Stars! in a Stars! clone.

I haven't taken a look at the code you linked to yet, but I will - It might not be today, though.

That "equivalent of averaging an infinite number of random planets" is not done randomly at all. It's wholly deterministic for a given race design. Teleport

Odds are it's not completely fair across all possible race designs, though, by giving more points to habs that aren't so much better than other hab schemes that get less points. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Javascript Race Wizard Tue, 16 June 2009 16:48 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
sirgwain wrote on Tue, 16 June 2009 18:10

I saw that one and it's pretty deluxe. I thought there was one that calculated the points for a race ala the race wizard. I can do it on the server side but I thought it would lend to a better user experience to have that calculation done client side as well.

I built something like that to help ConstB debug his C++ calculations. Never published it, though, I think. Rolling Eyes



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Javascript Race Wizard Wed, 17 June 2009 12:20 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
I haven't looked into the code enough to know what it's doing about hab ranges. It could be that it is doing a theoretical spread.

As for the code, does this look like a bug to anyone else?
	for (h = 0; h < 3; ++h)
	{
		int DesireFactor;
		switch (h) {
		case 0:
			TTCorrFactor = TerraformFactor0();
			DesireFactor = 7;
			break;
		case 1:
			TTCorrFactor = TerraformFactor1();
			DesireFactor = 5;
			break;
		case 2:
		default:
			TTCorrFactor = TerraformFactor2();
			DesireFactor = 6;
			break;
		}



If you do a ++h wouldn't that cause h to never be 0, therefore you'd never get that DesireFactor of 7?

Report message to a moderator

Re: Javascript Race Wizard Wed, 17 June 2009 14:37 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Nevermind, I looked it up, the pre-increment makes no difference in a for loop.

Report message to a moderator

Re: Javascript Race Wizard Wed, 17 June 2009 19:26 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
It's an h++ in my code. Should work the same, tho. Rolling Eyes


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Javascript Race Wizard Wed, 17 June 2009 21:23 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

sirgwain wrote on Thu, 18 June 2009 04:20

for (h = 0; h < 3; ++h)


the difference between h++ and ++h the is order of the incrementing of h and evaluation of the expression as a whole:
++h increments h before the evaulation and thus affects the evaluation.(preinc)
h++ increments h after the evaluation and thus does not affect the evaluation.(postinc)

The simplest examples are:
h=1;
x=(++h);
//A

h=1;
y=(h++);
//B
at both points (A&B) h has been incremented so h=2 but at A, x=2 and at B, y=1.

The third part of the for loop tuple is a statement to be run after each iteration. As a stand alone statement not included as part of a larger expression, both h++ and ++h have the same effect since the evaluation is never used - such as in a for loop.


[Updated on: Wed, 17 June 2009 21:30]

Report message to a moderator

Re: Javascript Race Wizard Thu, 18 June 2009 08:15 Go to previous messageGo to next message
scottrick49 is currently offline scottrick49

 
Master Chief Petty Officer

Messages: 98
Registered: August 2003
Location: Minneapolis, MN
Also, pre-increment is faster, because it doesn't create a temporary copy, so it is preferred.


scottrick

Report message to a moderator

Re: Javascript Race Wizard Thu, 18 June 2009 11:11 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Lucky me, this race points calculation exposed a bug in my planet hab value calculation.

If you are a regular old humanoid with 20,80 habs in all categores, and you come across a planet that is (20, 20, 20), what is your growth rate? My algorithm is showing a growth rate of 0% for that least ideal planet. For a planet of (80, 80, 71) I'm getting a growth rate of 3%. Does this sound correct?

Report message to a moderator

Re: Javascript Race Wizard Thu, 18 June 2009 18:16 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
My calculations appear to be slightly off. The standard humanoid race comes out at a value of 26, but when I change the cost of mines it is sways way more than the standard race wizard. This guy's race wizard appears to be more accurate:

http://www.gible.net/WebStars/WebStars%20-%20RW.html

Anyone know who's that is and whether the source is published somewhere?

Report message to a moderator

Re: Javascript Race Wizard Thu, 18 June 2009 18:36 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

sirgwain wrote on Fri, 19 June 2009 10:16

My calculations appear to be slightly off. The standard humanoid race comes out at a value of 26, but when I change the cost of mines it is sways way more than the standard race wizard. This guy's race wizard appears to be more accurate:

http://www.gible.net/WebStars/WebStars%20-%20RW.html

Anyone know who's that is and whether the source is published somewhere?


Flash Race Wizard
author: ninja_squirrel (Andrew)
Abode Flash version of the Stars! race wizard.

Report message to a moderator

Re: Javascript Race Wizard Fri, 19 June 2009 11:15 Go to previous message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
I emailed his address and it bounced back. I did find a flash decompiler (for Mac even!) that allowed me to peruse a terribly obfuscated version of his source code and I determined that his logic was the same as the freestars logic. At the end he divided his advantage points by 3, which freestars was doing at a later step, and I did see it.

My code is mostly functional though a bit off. I think my planet hab calculations are to blame because making a tri-immune race comes out with the correct numbers.

Report message to a moderator

Previous Topic: Does a starbase persist damage?
Next Topic: I miss Stars! How do I get back in?
Goto Forum:
  


Current Time: Thu Mar 28 11:10:05 EDT 2024