Page 2 of 12
Re: Galaxy seeds and system properties
Posted: Thu Jun 14, 2012 11:16 am
by Pleb
I don't fully (or even pretend to) understand how the code works in Oolite, but I have been told before that the 0-7 (1-8) galaxies in Oolite are hardcoded, which I actually do understand. But the number range of 0-7, could that be extended easilly to 0-13 for instance? Or would like just cause a system error of some kind?
Also I think that the reason you are having problems Wildeblood is as AC said, the game isn't designed so you can play around with your save game file (even though it is very simple and often tempting for testing/debugging purposes!). It may be a fail-safe feature built into the code to avoid messing with the core game. Thank you again though for sending me that galaxy seed, I can't wait to check it out when I finish work!
Re: Galaxy seeds and system properties
Posted: Thu Jun 14, 2012 9:24 pm
by Pleb
It does work! I won't say how again, but I changed one number value and when I jumped from Galaxy 8 I ended up in Galaxy 9! So it proves it isn't hard to modify the game to allow more than 8 galaxies after all. However, as this had now gone far off topic I will get back to my exploring of "illegal" galaxies...
Re: Galaxy seeds and system properties
Posted: Thu Jun 14, 2012 11:14 pm
by Tricky
Pleb wrote:I don't fully (or even pretend to) understand how the code works in Oolite, but I have been told before that the 0-7 (1-8) galaxies in Oolite are hardcoded, which I actually do understand. But the number range of 0-7, could that be extended easilly to 0-13 for instance? Or would like just cause a system error of some kind?
From txtelite.c
Code: Select all
/**+Generate galaxy **/
/* Functions for galactic hyperspace */
uint16 rotatel(uint16 x) /* rotate 8 bit number leftwards */
/* (tried to use chars but too much effort persuading this braindead
language to do bit operations on bytes!) */
{ uint16 temp = x&128;
return (2*(x&127))+(temp>>7);
}
uint16 twist(uint16 x)
{ return (uint16)((256*rotatel(x>>8))+rotatel(x&255));
}
void nextgalaxy(seedtype *s) /* Apply to base seed; once for galaxy 2 */
{ (*s).w0 = twist((*s).w0); /* twice for galaxy 3, etc. */
(*s).w1 = twist((*s).w1); /* Eighth application gives galaxy 1 again*/
(*s).w2 = twist((*s).w2);
}
/* Original game generated from scratch each time info needed */
void buildgalaxy(uint galaxynum)
{ uint syscount,galcount;
seed.w0=base0; seed.w1=base1; seed.w2=base2; /* Initialise seed for galaxy 1 */
for(galcount=1;galcount<galaxynum;++galcount) nextgalaxy(&seed);
/* Put galaxy data into array of structures */
for(syscount=0;syscount<galsize;++syscount) galaxy[syscount]=makesystem(&seed);
}
As Oolite uses this code (or something similar) you can see that 8 galaxies is your lot.
I do remember an interview where Braben and Bell said that originally you could have over 2 billion galaxies, but Acornsoft rightly suggested that they limit that. I just wish I could remember the source.
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 7:11 am
by Pleb
Regardless of what that code says, I modified one value in PlayerEntity.m and managed to jump from the 8th galaxy into a 9th galaxy no problem (well there WAS an issue but turns out its with the Trunk - replicated code into source code for 1.76.1 and it was successful!). Literally only one value was changed from 7 to 15... Also, as I said before, even ElitePlus had 9 galaxies!
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 7:51 am
by Griff
Tricky wrote:...I just wish I could remember the source.
I think this may be mentioned in the chapter dedicated to the making of Elite in the book "Backroom Boys: The Secret Return Of The British Boffin, by Francis Spufford"
http://www.amazon.co.uk/The-Backroom-Bo ... 0571214967
I'm not entirely sure though, it's been ages since i read it and i think afterwards i went straight into the Craig Revell-Horwood autobiography which acted as a sort of mind bleach
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 7:53 am
by Pleb
But from what I discovered last night it seems the code is limited by one line in PlayerEntity.m as there is a line that suggests when it gets to Galaxy 7 (8) and tries to jump to the next galaxy it resets itself. But if you change the value to a higher number it keeps on jumping...
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:00 am
by cim
Pleb wrote:But from what I discovered last night it seems the code is limited by one line in PlayerEntity.m as there is a line that suggests when it gets to Galaxy 7 (8) and tries to jump to the next galaxy it resets itself. But if you change the value to a higher number it keeps on jumping...
Does Galaxy 9 look suspiciously similar to Galaxy 1, though?
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:07 am
by Pleb
That could be possible, admitedly because it was late I was messing with a save game in galaxy 1(0), changed the value to galaxy 8(7) in notepad, and noticed when jumping from galaxy 8(7) it now said 'Galactic Chart 9' on long range chart. It could be that if you were in the actual galaxy 8(7) and jumped to galaxy 9(8) it would just look like galaxy 1(0). If so, back the drawing board! (Although to be honest I'm not keen to promote modifying of the source code, I was simply curious for my own reasons!)
Of course there must be a way to do this though...
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:10 am
by Smivs
Pleb wrote:...I was messing with a save game in galaxy 1(0), changed the value to galaxy 8(7) in notepad...
Aaargh! Never, ever use Notepad! It adds all sorts of unwanted characters to files and can completely screw things up. Use Notepad++ or any other good text editor.
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:16 am
by Pleb
Sorry I do use Notepad++ - best file editor EVER! But I will explore this possibility when I get home. Again, I must state I do not condone or recommend people mess with the source code as let's be honest, the game is fine as it is just the idea of more galaxies has always interested me and the fact I know I can use Oolite to generate multiple galaxies by modifying either the save game file (with Notepad++ of course
) or the source code to effect where the player starts. In fact, the code can be modified to make the player start in any system...but again: don't mess with the source code people! Unless you are a developer of course...
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:23 am
by SandJ
Pleb wrote:TOf course there must be a way to do this though...
Use the galaxy generation algorithm outside of Oolite to generate what the galaxy would look like. Ditto for the system names.
That way you could get maps very quickly (and lists of names for putting into a dirty words search, if desired).
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 8:29 am
by Pleb
SandJ wrote:Use the galaxy generation algorithm outside of Oolite to generate what the galaxy would look like. Ditto for the system names.
That way you could get maps very quickly (and lists of names for putting into a dirty words search, if desired).
Lol, yes I'm always on the hunt for that 'Arse' system haha... But if they managed to produce 9 galaxies in ElitePlus surely with enough code modifying you could do the same in Oolite?
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 9:12 am
by cim
Pleb wrote:But if they managed to produce 9 galaxies in ElitePlus surely with enough code modifying you could do the same in Oolite?
Oh, it's not that it's impossible. There are two problems:
1) The current galaxy jump algorithm "rotates" the galaxy seed. Like a Thargoid ship, the galaxy seed is octagonal, so after eight rotations the algorithm gives the original seed. This is why Thargoids have such command of witchspace. Anyway, for Galaxy 9 you would need a different way of generating the galaxy seed number, which if it was in the core game would require a decision to be made on what Galaxy 9 should be like.
2) There are probably numerous places in the current code (I can think of several in OXPs, too) which assume in some way that galaxyNumber is in the range 0..7, and that a galactic jump from 7 takes you back to zero. Finding them all would be a significant piece of work.
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 9:24 am
by Pleb
cim wrote:1) The current galaxy jump algorithm "rotates" the galaxy seed. Like a Thargoid ship, the galaxy seed is octagonal, so after eight rotations the algorithm gives the original seed. This is why Thargoids have such command of witchspace. Anyway, for Galaxy 9 you would need a different way of generating the galaxy seed number, which if it was in the core game would require a decision to be made on what Galaxy 9 should be like.
So in theory when the code calls for the eighth turn to take place, a condition would have to be applied to generate another galaxy seed and then maybe when jumping beyond that reset the seed back to the first one (for Galaxy 1)?
cim wrote:2) There are probably numerous places in the current code (I can think of several in OXPs, too) which assume in some way that galaxyNumber is in the range 0..7, and that a galactic jump from 7 takes you back to zero. Finding them all would be a significant piece of work.
Lol I would imagine this would be quite a task, as there are hundereds of files in the source!
Re: Galaxy seeds and system properties
Posted: Fri Jun 15, 2012 11:10 pm
by Pleb
Okay I was right and wrong - It is possible to jump from Galaxy 8 and jump into a new Galaxy 9, by adding an IF statement when jumping into the ninth galaxy it changes the galaxy seed to a pre-defined seed. Then it can turn the seed another 7 turns totalling in 16 galaxies! Then, another IF statement to replace the original statement that sets 7(8) as the maximum galaxy and instead resets the galaxy number to 0(1) and sets the seed to Galaxy 1's seed when jumping past Galaxy 16. All of this is changed in one file. You could even keep putting in conditions and new seeds to expand in sets of 8 galaxies at a time!
Edit: By changing another file I have been able to write scripts that now allow the galaxyNumber value in JavaScript to go up to 15 rather than 7!