Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Bar » Stars race wizard habitat ranges advantage points
Stars race wizard habitat ranges advantage points Sun, 26 April 2020 14:15 Go to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 182
Registered: February 2004
Location: Norway
For a little project I envisioned (maybe more on that later), I have tried to duplicate the Stars Race Wizard in Java. As I am more familiar with C# than C/Cpp, I looked to the Stars Nova source for this. And it seems that their code nailed it! ... as long as all habitat ranges are set to immune.. Razz If not, I cannot get the advantage points to match. Traits, production, tech etc seems fine, but the points are always off when messing with the habitat values. Is the freestars code for this any better? Does anyone know the exact formulas for the habitat range advantage points except the Jeffs?

Report message to a moderator

Re: Stars race wizard habitat ranges advantage points Sun, 26 April 2020 15:49 Go to previous messageGo to next message
ricks03 is currently offline ricks03

 
Officer Cadet 1st Year
Creator of TotalHost and Stars! utilities
Created TotalHost and Stars! utilities

Messages: 209
Registered: January 2012
Location: NC
How about this thread?>

https://starsautohost.org/sahforum2/index.php?t=msg&goto =46049&rid=1532&srch=race+wizard+hab+points#msg_4604 9



https://www.irelandbybicycle.com
http://totalhost.sinister.net:999
https://github.com/ricks03/TotalHost

Report message to a moderator

Re: Stars race wizard habitat ranges advantage points Fri, 01 May 2020 08:09 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 182
Registered: February 2004
Location: Norway
Hi and thanx for the link. There was the links to sirgwains craigstars race wizard for Java, but the links were down. I then found another link to github since he had later published the code on github, but the repository now seemed recently deleted (404). I was able to get a file or two from the repository from google cached pages, but nothing much. I haven't been able to get in contact with sirgwain. Then I saw that Daniel had downloaded the java-files for the racewizard back in 2010, so I contacted him, and as luck would have it, he still had the files. So I now have integrated sirgwains race logic with my race wizard! I have tested it vs real stars, and the results seems promising.. The Humanoids even start on 25 points, which nova did not Very Happy
PRT/LRT points checks out ok. tech, resources, factories, mines are ok. Immunities combinations ok. Shrinking / extending habitat settings ok. Growth rate calculations ok. Ahh, so close... BUT, when I start adjusting the hab values left or right, small discrepancies start showing up at once Sad Sad
Anyone who knows if all attempts to recreate the race wizard has failed over the years, and good approximations are all we have?
Or does someone has the perfect code hidden away somewhere?

Report message to a moderator

Re: Stars race wizard habitat ranges advantage points Fri, 01 May 2020 09:31 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 135
Registered: June 2014
I don't know if this will help, but I used IDA to disassemble Stars! and then exported it to Ghidra to use its free decompiler. Below is the resulting code from the race wizard page 4, which may provide some insights for the pesky point calculations:

word __stdcall16far
RaceWizardDlg4(int param_1,int param_1_00,int param_3,uint param_4,int param_5,undefined2 param_6)

{
  undefined2 uVar1;
  undefined *puVar2;
  int iVar3;
  undefined *puVar4;
  int unaff_SI;
  RECT *pRVar5;
  word *pwVar6;
  byte local_292;
  word local_3a;
  word local_38;
  RECT local_36;
  word local_2e;
  PAINTSTRUCT local_2c;
  word local_c;
  RECT local_a;
  
  if (param_4 == 0xf) {
    uVar1 = BEGINPAINT();
    GETCLIENTRECT();
    _DrawRaceAdvantagePoints();
    SELECTOBJECT();
    SETBKCOLOR();
    GETDLGITEM();
    GETWINDOWRECT();
    SCREENTOCLIENT();
    GETDLGITEM();
    GETWINDOWRECT();
    pwVar6 = &local_a.right;
    SCREENTOCLIENT();
    local_36.right = local_a.right;
    local_36.bottom = local_a.bottom;
    _ExpandRc(&local_36,(int *)(_dyArial8 + 2),(int)_dyArial8 >> 1,(int)pwVar6);
    local_36.top = local_36.top - 4;
    __Draw3dFrame(uVar1,&local_36,(word *)0xffff,(int)pwVar6);
    _CchGetString(0x112,(uint)&_szWork,(undefined *)pwVar6);
    TEXTOUT();
    GETCLIENTRECT();
    local_a.top = local_36.bottom + 0xc;
    local_a.left = local_a.left + 0xc;
    local_a.right = local_a.right - 0xc;
    GETDLGITEM();
    GETWINDOWRECT();
    pRVar5 = &local_36;
    SCREENTOCLIENT();
    local_a.bottom = local_36.top - 6;
    __Draw3dFrame(uVar1,&local_a,(word *)0xffff,(int)pRVar5);
    puVar2 = _CchGetString(0x113,(uint)&_szWork,(undefined *)pRVar5);
    TEXTOUT();
    iVar3 = _GetRaceStat((int)&_vplr,0xe,(int)puVar2);
    local_3a = (iVar3 + 0x5c) * 3;
    local_38 = 0;
    local_c = 0;
    while ((int)local_c < 3) {
      puVar4 = _CchGetString(local_3a,(uint)(&local_292 + local_38),puVar2);
      local_38 = (word)(puVar4 + local_38);
      local_c = local_c + 1;
      local_3a = local_3a + 1;
    }
    _ExpandRc(&local_a,(int *)(-2 - _dyArial8),-((int)_dyArial8 >> 1),(int)puVar2);
    local_a.top = local_a.top + 4;
    DRAWTEXT();
    _rcCargo = local_a.left;
    WORD_b6c9_23a0 = local_a.top;
    WORD_b6c9_23a2 = local_a.right;
    WORD_b6c9_23a4 = local_a.bottom;
    ENDPAINT();
  }
  else {
    if (param_4 == 0x14) {
      GETCLIENTRECT();
      FILLRECT();
    }
    else {
      if (param_4 == 0x19) {
        local_c = 0x10f;
        while (((int)local_c < 0x119 && (iVar3 = GETDLGITEM(), iVar3 != param_1))) {
          local_c = local_c + 1;
        }
        if ((0x118 < (int)local_c) && (param_1_00 != 6)) {
          return 0;
        }
        SETBKCOLOR();
        return 0;
      }
      if (param_4 == 0x110) {
        _SetRCWTitle();
        iVar3 = _GetRaceStat((int)&_vplr,0xe,0x118);
        iVar3 = iVar3 + 0x10f;
        CHECKRADIOBUTTON();
        if (_fRCWReadOnly != 0) {
          local_c = 0x10f;
          do {
            GETDLGITEM();
            ENABLEWINDOW();
            local_c = local_c + 1;
          } while ((int)local_c < 0x119);
        }
        _StickyDlgPos(param_5,(int)&_ptStickyRaceDlg,(word *)&UNK_b6c9_0001,iVar3);
      }
      else {
        if (param_4 != 0x111) {
          return 0;
        }
        if (param_3 == 0x76) {
          WINHELP();
        }
        else {
          local_c = 0;
          while (((int)local_c < 4 && (*(int *)((int)&_rgidRaceBtn + local_c * 2) != param_3))) {
            local_c = local_c + 1;
          }
          if (3 < (int)local_c) {
            if (param_1_00 != 0) {
              return 0;
            }
            if ((uint)param_3 < 0x10f) {
              return 0;
            }
            if (0x118 < (uint)param_3) {
              return 0;
            }
            _SetRaceStat((int)&_vplr,0xe,param_3 + -0x10f,unaf
...

Report message to a moderator

Re: Stars race wizard habitat ranges advantage points Fri, 01 May 2020 11:21 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 182
Registered: February 2004
Location: Norway
Thanx raptor, but I am unsure of what in that code block is the actual code for the hab, if it is there at all?
I have pushed my current racewizard-project to our stars-4x github if you want to have a go at it yourself Wink

I also noticed that m.a@stars mentioned he had some working javascript code, so I have also sent him a message. Maybe there exists some working code after all.. (crossing fingers)

Report message to a moderator

Re: Stars race wizard habitat ranges advantage points Fri, 31 December 2021 11:20 Go to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2761
Registered: October 2004
Location: Third star to the left
Oh, my. How time flies! Shocked

I do have both the exact RW and habcalc code. I've used the JavaScript version of the habcalc code for planet scouting and trading in many games. Twisted Evil

The RW code is not pretty, tho. Confused

My old tools were gathering dust in an unbelievably small disk. I've dug them up, but need to make sure they still run. Rolling Eyes

Meanwhile, there's this old post: The Academy ยป Planet value calculation made easy!

Merry Xmas!


[Updated on: Fri, 31 December 2021 20:09]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: New game?
Next Topic: Stars! Official Strategy Guide - uptodate links to other sites
Goto Forum:
  


Current Time: Thu Jan 20 20:14:16 EST 2022