About the Galaxy Seeds
Moderator: Oberlus
Re: About the Galaxy Seeds
Here we go.
I fooled around quite a bit last night trying to figure out which random function I was to use. All in all, I ended up using Rand(), but I didn't check where it truly came from.
I fooled around quite a bit last night trying to figure out which random function I was to use. All in all, I ended up using Rand(), but I didn't check where it truly came from.
If this post contains code, it's released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13587
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: About the Galaxy Seeds
Did you do anything about the multiplayer setup layout issue?
Re: About the Galaxy Seeds
I tested a few things in order to see if something was wrong in the way I'm calculating the button's X position, but it appeared to be OK. I thought it might have been under the galaxy image.
Do you have an idea where else I could look?
Do you have an idea where else I could look?
If this post contains code, it's released under GPL 2.0 or later.
Re: About the Galaxy Seeds
using "this->UpperLeft()" in the location specification was not done for any of the other controls, and was throwing off your button because the GalaxySetupPanel is set up with different left x coords between single and multi player. works just fine.
Also, with any code please try to eliminate compiler warnings. Your code generates an initializes out of order type message with respect to m_seed_edit and m_random, which in this case is because you've got m_random declared in a strange place. It shouldn't normally be declared up in the Accessors, it should be down in the private section, right after the declaration of m_seed_edit.
Code: Select all
m_random = new SettableInWindowCUIButton(2 * LABELS_WIDTH + 3 * CONTROL_MARGIN - 30, row * PANEL_CONTROL_SPACING + 5, GG::X(20), "", font, GG::CLR_WHITE);
Also, with any code please try to eliminate compiler warnings. Your code generates an initializes out of order type message with respect to m_seed_edit and m_random, which in this case is because you've got m_random declared in a strange place. It shouldn't normally be declared up in the Accessors, it should be down in the private section, right after the declaration of m_seed_edit.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: About the Galaxy Seeds
Thank you Dilvish, I'll look into this tonight and submit my code again.
If this post contains code, it's released under GPL 2.0 or later.
Re: About the Galaxy Seeds
I don't understand. When I declare m_random down with the other controls, in the private section, FreeOrion.exe crashes right away when I run it. It works fine if I declare it in the accessories.
I attached the patch anyway, so that someone can look it up and let me know what's wrong that makes it crash right away. I suspect it has to do with private vs public scope.
I attached the patch anyway, so that someone can look it up and let me know what's wrong that makes it crash right away. I suspect it has to do with private vs public scope.
Nom de l’application défaillante FreeOrion.exe, version : 0.0.0.0, horodatage : 0x51e9e3bc
Nom du module défaillant : boost_signals-vc100-mt-1_51.dll, version : 0.0.0.0, horodatage : 0x503e6fa4
Code d’exception : 0xc0000005
Décalage d’erreur : 0x00004960
ID du processus défaillant : 0xc5c
Heure de début de l’application défaillante : 0x01ce84e60ff3daf0
Chemin d’accès de l’application défaillante : C:\FreeOrion\FreeOrion\FreeOrion.exe
Chemin d’accès du module défaillant: C:\FreeOrion\FreeOrion\boost_signals-vc100-mt-1_51.dll
ID de rapport : 4e927a25-f0d9-11e2-9d79-bcaec5e13788
If this post contains code, it's released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13587
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: About the Galaxy Seeds
If you're not using the functionality of SettableInWindowCUIButton to set the InWindow function, you should probably just use CUIButton instead.
Re: About the Galaxy Seeds
I changed it to CUIButton, but it still crashes.Geoff the Medio wrote:If you're not using the functionality of SettableInWindowCUIButton to set the InWindow function, you should probably just use CUIButton instead.
Are you able to reproduce the crash yourself, or is it an issue on my end?
If this post contains code, it's released under GPL 2.0 or later.
Re: About the Galaxy Seeds
No, something else must have gotten corrupted in your build; it works just fine of for me. I went ahead and comitted it.MarcThibeault wrote:I don't understand. When I declare m_random down with the other controls, in the private section, FreeOrion.exe crashes right away when I run it. It works fine if I declare it in the accessories.
I attached the patch anyway, so that someone can look it up and let me know what's wrong that makes it crash right away. I suspect it has to do with private vs public scope.
Code: Select all
[6247] - -- Random Seed button by MarcThibeault
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: About the Galaxy Seeds
Good then, I'll reload everything into place from a fresh SVN update.
Thanks for you help on that one!
Thanks for you help on that one!
If this post contains code, it's released under GPL 2.0 or later.
Re: About the Galaxy Seeds
Whoops, you guys had that exchange while I was testing the previous version. I just confirmed that it still worked fine as plain CUIButton so I went ahead and committed that update. Sorry if I jumped the gun, Geoff.
While doing this last testing I also noticed that it seems I get the same sequence of random seeds. The RandomSeed button should probably first seed with the clock before getting a new random seed -- mind if I make that change?
While doing this last testing I also noticed that it seems I get the same sequence of random seeds. The RandomSeed button should probably first seed with the clock before getting a new random seed -- mind if I make that change?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: About the Galaxy Seeds
In response to a PM'd question, I wanted to confirm in this thread that I had proceeded with my proposal in the previous post; it has been the case for quite some time now that the random seed button first seeds the RNG by the system time, and then has the RNG generate a number which gets converted to the new Galaxy Seed, so the sequence of seeds provided by the random seed button should always be different from game execution to execution.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: About the Galaxy Seeds
It would be useful if this were also the case for multi-player games. I actually prefer to start single player games in the multi-player screen because I can choose what AI I am playing against, whereas the single-player screen just hands me a random AI.MarcThibeault wrote:The Galaxy Setup screen always keeps every settings from the last played game, including the seed. By keeping the seed, it allows you to play on the same exact map as you did in your previous game.
And if the seed variables actually had specific meanings then there would be another layer of galaxy generation. If I knew that inclusion of any specific Alpha-Numeric character would, say for example sake - spawn a galaxy with all AI's beginning locations far from me, then I would know from reading the random seed that would be in a game and could thus change the seed to get another random number.
I understand that this is a work in progress and that my comments here are just comments and NOT requests for immediate code fixes.
Thank you for the work done so far - please continue with whatever part of the game you are currently working on.
Thank you for the work done so far - please continue with whatever part of the game you are currently working on.