Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Extensions » xy modification after game has started
xy modification after game has started Sun, 29 June 2014 22:48 Go to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Howdy folks,

I'm a newcomer here - my brother and I played Stars! back when we were kids, over BBS. We got into it again about 2 years ago and have been playing over a shared SSH server together against loads of AI. We love it, and our wives probably despise us for it...

Now to the question:

We are about 70 years into our current game but have discovered that we forgot to allow computer player alliances (my fault). Is there a way to adjust the server flag on this? If so, would it even affect how AIs work this late into the game?

I've been reading a lot on these forums and the wiki over the last 6 months or so. From my reading, I gather it is the .xy file that stores the data; however, I've read that it is encrypted (and apparently only a few people know how to decrypt, and just as few know the file formats). I have some coding ability and I am comfortable reading/modifying binary data, but I'm a little lost with all the dissociate information scattered about.

Any help would be appreciative.

Thanks!

Report message to a moderator

Re: xy modification after game has started Mon, 30 June 2014 13:35 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
raptor wrote on Sun, 29 June 2014 21:48
Howdy folks,

I'm a newcomer here - my brother and I played Stars! back when we were kids, over BBS. We got into it again about 2 years ago and have been playing over a shared SSH server together against loads of AI. We love it, and our wives probably despise us for it...

Now to the question:

We are about 70 years into our current game but have discovered that we forgot to allow computer player alliances (my fault). Is there a way to adjust the server flag on this? If so, would it even affect how AIs work this late into the game?

I've been reading a lot on these forums and the wiki over the last 6 months or so. From my reading, I gather it is the .xy file that stores the data; however, I've read that it is encrypted (and apparently only a few people know how to decrypt, and just as few know the file formats). I have some coding ability and I am comfortable reading/modifying binary data, but I'm a little lost with all the dissociate information scattered about.

Any help would be appreciative.

Thanks!


Hey, it's great to hear about other players outside this small forum community still enjoying the game. That's awesome.

As for altering that game setting, it's almost certainly possible (in a theoretical sense) to modify the .hst file (not the .xy file) to achieve that, but I've not heard of anyone trying it before. I haven't heard of anyone hacking the .hst file at all, in fact.

Why don't you guys jump into a multiplayer game here? Smile Just subscribe to the New Games forum and sit tight until something suitable starts up.



What we need's a few good taters.

Report message to a moderator

Re: xy modification after game has started Mon, 30 June 2014 18:33 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Hi,

Are you sure it's the .hst file? This page seems to indicate that it is the .xy file:

http://wiki.starsautohost.org/wiki/Technical_Information

But I suppose it could be both? Perhaps the original universe is in the .xy, then the .hst takes over from there?

Report message to a moderator

Re: xy modification after game has started Tue, 01 July 2014 09:27 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
I wanted to share my progress:

I found out that the StarsHostEditor.dll is a .NET assembly... jackpot! (C# is easily decompilable). Using .NET Reflector + FileDisassembly, I found a Decryptor class:

http://pastie.org/pastes/9343482/text

I haven't done too much analysis, but so far it looks like it reads in a 'block' from the file, checks its type, then decrypts it.

Here is the entire decompilation: http://www.megafileupload.com/en/file/546477/StarsHostEditor -Source-zip.html

I'm not super familiar with .NET, but it looks easily portable enough into Java or c++.


[Updated on: Tue, 01 July 2014 18:10]

Report message to a moderator

Re: xy modification after game has started Tue, 01 July 2014 21:41 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
Interesting stuff.

It seems an odd design to put the game settings in the .xy file, since the game client at runtime does not need to know about those settings. The turn generation engine needs the settings, so it seems like they should only live in the .hst file for multiplayer games.

But there are plenty of unintuitive design decisions about Stars. I'm sure there's a good reason for this one.



What we need's a few good taters.

Report message to a moderator

Re: xy modification after game has started Wed, 02 July 2014 03:10 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
The client needs to be le to tell the player those settings.

They are a fixed part of the universe.

Report message to a moderator

Re: xy modification after game has started Wed, 02 July 2014 14:59 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
XAPBob wrote on Wed, 02 July 2014 02:10
The client needs to be le to tell the player those settings.

They are a fixed part of the universe.


Duh. Of course. Player can look at the game setup from the client.

But then, does the .hst file read those settings from the .xy, or does the .hst have its own record?



What we need's a few good taters.

Report message to a moderator

Re: xy modification after game has started Wed, 02 July 2014 19:51 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
raptor wrote on Tue, 01 July 2014 15:27
I wanted to share my progress:

I found out that the StarsHostEditor.dll is a .NET assembly... jackpot! (C# is easily decompilable). Using .NET Reflector + FileDisassembly, I found a Decryptor class:

http://pastie.org/pastes/9343482/text

I haven't done too much analysis, but so far it looks like it reads in a 'block' from the file, checks its type, then decrypts it.

Here is the entire decompilation: http://www.megafileupload.com/en/file/546477/StarsHostEditor -Source-zip.html

I'm not super familiar with .NET, but it looks easily portable enough into Java or c++.

Aaannd the cat is out the bag! Sherlock

Nice work, btw. Cheers



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Wed, 02 July 2014 23:35 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Oh. Was I not supposed to release that? I can remove it if wanted...

I find the changes in the algorithms between the 0.2 and the 0.3 DLL interesting (2 are just cosmetic):

http://pastie.org/pastes/9348822/text

What would be the best language to rewrite this in (with documentation)? Java? python? python might be tricky...

Report message to a moderator

Re: xy modification after game has started Thu, 03 July 2014 15:08 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 been more or less in the public knowledge for a while, with nobody knowing what others might be doing in secret. It's more public now. Rolling Eyes

I'd say Java would be nice. And of course plain old C. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Thu, 03 July 2014 19:03 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
raptor wrote on Mon, 30 June 2014 04:48
would it even affect how AIs work this late into the game?

I'd daresay not enough for it to really matter. AIs aren't smart enough anyway. Hit over head



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Fri, 04 July 2014 06:52 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
raptor wrote on Thu, 03 July 2014 04:35
Oh. Was I not supposed to release that? I can remove it if wanted...

There have been enough discussions about it *not* being released - it was inevitable that would slip out publicly at some point.
I've always mildly disagreed with, but respected (and therefore supported), the "keep it quiet" mindset. With the code "out" there is a lower threshold to pass in terms of trying to put cheats together - but...

Quote:
What would be the best language to rewrite this in (with documentation)? Java? python? python might be tricky...

Python would be very interesting for a number of reasons (one of which being the current "rewrite" project)

Report message to a moderator

Re: xy modification after game has started Fri, 04 July 2014 11: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
XAPBob wrote on Fri, 04 July 2014 12:52
With the code "out" there is a lower threshold to pass in terms of trying to put cheats together - but...

The code has been more or less out for a long time. We have just seen how easy it was to decompile the DLL that kept its latest incarnation "secret". Pirate

I've always thought that "hush hush" was the second-best option. Lets now go for the best option, full steam ahead, and put some bug-stomping, anti-cheating, scenario-creating and MM-reducing apps together! Work at computer



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Fri, 04 July 2014 22:07 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
I need to take a break for a while - but I have progress!

I have rewritten the entire decryptor class into Java and documented everything I could. I also simplified much of it and made it easier to read/follow. Here is the code:

http://www.filedropper.com/stars-decryption-code-java_1

The decryption produces identical output to that of StarsHostEditor 0.3. The only tricky part was that Java doesn't have unsigned data types so I had to frequently use a larger type for storage (which added a little complexity in some areas).

The important method is Decryptor.readFile()

Enjoy!

Edit: Had to make last minute changes


[Updated on: Fri, 04 July 2014 22:26]

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 04:05 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
Looks nice! Cool

Perhaps not as terse and efficient as pure C, but I can think of many ways of making it worse. Pirate

Take your well-deserved break and be back soonish. This looks like the start of a great toolkit. Asleep at cptr



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 05:00 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
I notice 279 isn't a prime, besides being out of order. Confused

You also might want to take a look at the Stars! Supremacy Host, also by PaulCr, 1st mentioned in the Possible new utility for creating testbeds thread (with other interesting things). Lurking

Perhaps this could be of use to decode battles: My first battle report in the stars client Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 09:39 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Ha! You're right... also, it was one of the differences between the 0.2 and 0.3 decompiled sources. It's probably a fat-fingered mistake in 0.3 that was rarely triggered.



[Updated on: Sat, 05 July 2014 09:41]

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 10:38 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
I just added the code to a github repo in case anyone wants to add to it:

https://github.com/raptor/stars

I also moved around some files to be more API-like and committed that prime number change.

I looked at StarsSupremacyHost code and it looks like it shares most with StarsHostEditor 0.3.

I'm not really sure how far I want to go with this code - I chose Java first because it was quick to debug (eclipse is magic) and because it is slightly more portable than .NET. If a real API were to be developed, what language should it be in?

I have experience with c++, some in python, but not as much in C or perl.

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 12:34 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
(Sorry for so many posts in a row)

I just found this:

http://starsautohost.org/sahforum2/index.php?t=msg&th=50 59

A Java API started by 'gible'. Did I just duplicate someone else's work with my code? If someone is further along an API on this, could I can access and merge/update it with my current knowledge?

Looks like the intention was to keep it closed source, would this still apply?

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 15:12 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
raptor wrote on Sat, 05 July 2014 15:39
Ha! You're right... also, it was one of the differences between the 0.2 and 0.3 decompiled sources. It's probably a fat-fingered mistake in 0.3 that was rarely triggered.

I hope you've managed to trigger & test it? Who knows with the Jeffs and their penchant for little coding surprises. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 15:16 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
raptor wrote on Sat, 05 July 2014 18:34
A Java API started by 'gible'.

Far as I know, Gible never got too far with his API/knowledge-gathering project. Sherlock


Quote:
Did I just duplicate someone else's work with my code?

Who knows. Perhaps. Those who have it don't publish it, and without working decryption it's very hard for anyone else to go further. Wall Bash



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 19:15 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
No, I have not managed to trigger it - but now I see that it could have been a fat-finger in the original programming of the game. I will revert and leave a note, unless someone has any other information...

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 20:37 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
Peeking around stars.exe I find a list of what seem the 1st 128 prime numbers, with 279 in the middle of it. Hhmmmm. Sherlock


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 21:10 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
128?

There are only 64 in the decryption table from the code I decompiled...

How are you looking at the EXE?

Report message to a moderator

Re: xy modification after game has started Sat, 05 July 2014 21:30 Go to previous messageGo to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
raptor wrote on Sun, 06 July 2014 03:10
128?

There are only 64 in the decryption table from the code I decompiled...

Perhaps the decryption code doesn't use the whole table, or can be optimized to work with just half of it. Sherlock


Quote:
How are you looking at the EXE?

Squinting carefully thru Ultraedit. Whip



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: NSA Helping to Decompile Stars!?
Next Topic: Utility to clean .m files
Goto Forum:
  


Current Time: Thu Mar 28 11:30:45 EDT 2024