Randomized universe in single player game broken

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
gonse
Space Krill
Posts: 6
Joined: Mon Jun 08, 2020 8:20 pm

Randomized universe in single player game broken

#1 Post by gonse »

Hi there,

i noticed today that starting a random single player game is not random anymore. It always starts with the same universe.

Regards

User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

Re: Randomized universe in single player game broken

#2 Post by Oberlus »

It's working fine for me:
- Set seed to random (clicking on the dice button) and start game.
- Check out visible galaxy and leave game.
- Quickstart, check out visible galaxy (it is different from previous one), rinse and repeat.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Randomized universe in single player game broken

#3 Post by Geoff the Medio »

What versions are you both using?

gonse, what is your process for "starting a random single player game"?

User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

Re: Randomized universe in single player game broken

#4 Post by Oberlus »

Latest weekly test build 613c260
It also worked fine for me in all previous versions.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Randomized universe in single player game broken

#5 Post by Geoff the Medio »

There is a bug in the recently-reworked random generation code, which should be easy to fix... See if you can spot the problem? https://github.com/freeorion/freeorion/ ... pp#L32-L40

User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

Re: Randomized universe in single player game broken

#6 Post by Oberlus »

I've been staring at it for a while, checking out reference manuals (here and here), reviewing change history... I'm barely beginning to understand the code, but I can't find any bug.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Randomized universe in single player game broken

#7 Post by Geoff the Medio »

Code: Select all

    if (min <= max)
        return min;

User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

Re: Randomized universe in single player game broken

#8 Post by Oberlus »

Geoff the Medio wrote: Thu Jun 11, 2020 6:11 pm

Code: Select all

    if (min <= max)
        return min;
OMG!
Of course, should be

Code: Select all

min >= max
Same for RandDouble.

gonse
Space Krill
Posts: 6
Joined: Mon Jun 08, 2020 8:20 pm

Re: Randomized universe in single player game broken

#9 Post by gonse »

Hi there,

problem is solved in:
Building v0.4.10+ build 2020-06-13.ed213fb

Regards

Post Reply