Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 36

Thread: Introduction / my efforts

  1. #11
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    Quote Originally Posted by Midgardsormr View Post
    Thats cool Mid but I cant see any clear sources for that name generator. Its hidden in the assembly of the main game I think and that requires considerable effort to decode - to the point that he mentions that one guy has done it and recoded it and how hard it was. What I am hoping to find is a name generator in any modern language like 'C' or something like that. Maybe its not possible without all the game code too as a means of hashing up the name.

    This is the closest I have but even this one reckons that its not the original code for it.

    http://www.parallelrealities.co.uk/p...domNameGen.php

    Maybe its impossible to get the original generator any more. Isomage - do you think you have the original Elite name generator or something approximately like it.

  2. #12

    Post

    Ian Bell has released C source code for a text-version of Elite, and it contains the name generator: http://www.iancgbell.clara.net/elite/text/

    I think I might have worked from Christian Pinder's reverse-engineered C code, which doesn't seem to be available from that site anymore.

    Here's my Python version. If you set ELITE = True, successive calls to name() will generate the sequence of names used in the game -- look for Lave on call 7 (starting from 0); otherwise you'll get a random sequence.

    Code:
    ELITE = False
    
    if ELITE:
        seed = [0x5A4A, 0x0248, 0xB753]
    else:
        import random
        seed = [random.randint(0, 0xffff), random.randint(0, 0xffff), random.randint(0, 0xffff)]
    
    def tweakseed():
        temp = (seed[0] + seed[1] + seed[2]) % 0x10000
        seed[0] = seed[1]
        seed[1] = seed[2]
        seed[2] = temp
    
    digraphs = "..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion"
    
    def name():
        longnameflag = seed[0] & 0x40
    
        name = ""
    
        for n in range(4):
            d = ((seed[2] >> 8) & 0x1f) << 1
    
            tweakseed()
    
            if n < 3 or longnameflag:
                name += digraphs[d:d+2]
    
        return name.replace(".", "").title()
    Last edited by isomage; 12-04-2008 at 04:35 PM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  3. #13

    Post

    Quote Originally Posted by Redrobes View Post
    So you must be running your cgi script as a full exe not a perl/PHP thing then unless there is some nice interface to Ghostscript from a script.
    I did it in Python, but the basic idea would be the same in PERL: open a pipe to the system's GhostScript converter and write your generated PostScript code to it like a file.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  4. #14
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    Wow that's excellent and totally rep worthy if I haven't already. I actually remember 'Lave' too. I think I might just try this to see what the names were and if I remember any more. Did you see all of our November challenge entries ? I think mine would have been improved with better names. Although our stars are named with Arabic, for some reason I think the ones in the sky sounded better than the ones I had used.

  5. #15
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    Quote Originally Posted by isomage View Post
    I did it in Python, but the basic idea would be the same in PERL: open a pipe to the system's GhostScript converter and write your generated PostScript code to it like a file.
    Very good. I don't think I am able to do that tho. I use an external web space provider which gives certain access rights. I don't think I can run GhostScript on their server in the cgi-bin area. Still, if your able, then thats a really excellent thing to do.

    I am gonna go and see if I can Perl up your python Elite code.

  6. #16

    Post

    Quote Originally Posted by Redrobes View Post
    I am gonna go and see if I can Perl up your python Elite code.
    Code:
    my $ELITE = 1; # Set to 1 for Elite names, other for random names
    
    my @seed = ($ELITE == 1) ? (0x5A4A, 0x0248, 0xB753)
                             : (int(rand(0xffff)), int(rand(0xffff)), int(rand(0xffff)));
    
    sub tweakseed() {
        push @seed, ($seed[0] + $seed[1] + $seed[2]) % 0x10000;
        shift @seed;
    }
    
    my $digraphs = "..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion";
    
    sub name() {
        my $longnameflag = $seed[0] & 0x40;
    
        my $name = "";
    
        foreach my $n (0 .. 3) {
            my $d = (($seed[2] >> 8) & 0x1f) << 1;
    
            tweakseed();
    
            if ($n < 3 || $longnameflag) {
                $name .= substr($digraphs, $d, 2);
            }
        }
    
        $name =~ s/\.//g;
    
        $name =~ s/^(.)/\U$1/;
    
        return $name;
    }
    Last edited by isomage; 12-05-2008 at 11:19 PM. Reason: Code tweak
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  7. #17
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    Hah ! Just done mine too...

    Code:
    my $elite = 1;
    
    my @seed;
    my $digraphs = "..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion";
    
    if( $elite )
    {
        $seed[0] = 0x5A4A;
        $seed[1] = 0x0248;
        $seed[2] = 0xB753;
    }
    else
    {
        $seed[0] = rand() & 0xFFFF;
        $seed[1] = rand() & 0xFFFF;
        $seed[2] = rand() & 0xFFFF;
    }
    
    sub tweakseed()
    {
        my $temp = ($seed[0] + $seed[1] + $seed[2]) & 0xFFFF;
        $seed[0] = $seed[1];
        $seed[1] = $seed[2];
        $seed[2] = $temp;
    }
    
    sub name()
    {
        my $longnameflag = $seed[0] & 0x40;
        my $name = "";
    
        for( $n=0; $n<4; $n++ )
        {
            my $d = (($seed[2] >> 8) & 0x1f) << 1;
            tweakseed();
    
            if( $n < 3 || $longnameflag )
            {
                $name .= substr( $digraphs, $d, 2 );
            }
        }
    
        $name =~ s/\.//g;
        return $name;
    }
    
    print name()."\n";
    print name()."\n";
    print name()."\n";
    print name()."\n";
    Lets compare !

  8. #18
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    I can tell your a better Perl programmer than I.

  9. #19

    Post

    Quote Originally Posted by Redrobes View Post
    I can tell your a better Perl programmer than I.
    The code's pretty similar -- I just took a couple of shortcuts. If it works it works!

    For testing, the first eight names generated in Elite mode should be:

    Tibedied
    Qube
    Leleer
    Biarge
    Xequerin
    Tiraor
    Rabedira
    Lave
    Last edited by isomage; 12-04-2008 at 05:16 PM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  10. #20
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,196
    Blog Entries
    8

    Post

    I have plumbed it into my Nov08 challenge star map drawing script. Shame I didn't have this a month ago. Its great that you have given it out now tho.

    Should be the first 50 Elite names now with Lave over on the right.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	tmp.png 
Views:	71 
Size:	96.7 KB 
ID:	8188  

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •