AI Aggression Randomization
Moderator: Committer
Re: Am I the only one who never won a game?
PlayerID() by itself doesn't seem to provide too much randomness either...
I'm now trying to combine empire name & galaxy seed to the Seed() call to see if rand0 gets simultaneously consistent & a bit more random!
Patch incoming if it does!
I'm now trying to combine empire name & galaxy seed to the Seed() call to see if rand0 gets simultaneously consistent & a bit more random!
Patch incoming if it does!
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Am I the only one who never won a game?
What do you mean by "doesn't seem"?Foocaux wrote:PlayerID() by itself doesn't seem to provide too much randomness either...
Re: Am I the only one who never won a game?
In my system AI number 1 will always be at max aggression, regardless of galaxy seed, or actual empire name, etc, etc...
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
Re: Am I the only one who never won a game?
Ok, I've managed to make some progress: I got AI aggressiveness to be random in windows, and dependant on both AI empire name & AI playerID. I've started playing around with it a bit, bu RL is calling, so here's my patch, warts & all...
EDIT: in my first version of this post I somehow sent a patch that confused the AI name with its empire name. Not anymore! I don't think there are any major warts left & I'm pretty happy with it as it is now. 'Course, there could be warnings from gcc and/or clang lurking in there...
EDIT: in my first version of this post I somehow sent a patch that confused the AI name with its empire name. Not anymore! I don't think there are any major warts left & I'm pretty happy with it as it is now. 'Course, there could be warnings from gcc and/or clang lurking in there...
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: AI Aggression Randomization
As noted above, using the player ID for random seeding is probably a bad idea as it prevent reproducibility of setup results if the mapping between player name and id and empire id changes between game starts.
Also, the use of the custom name hashing function is potentially problematic. I suggest using the boost hashing method posted above.
Also, comments explaining some of what's going on with the range tests would be useful... it's very unclear what some of the code changes are doing.
Also, the use of the custom name hashing function is potentially problematic. I suggest using the boost hashing method posted above.
Also, comments explaining some of what's going on with the range tests would be useful... it's very unclear what some of the code changes are doing.
Re: AI Aggression Randomization
Is this what you had in mind?
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: AI Aggression Randomization
This doesn't make sense:
Empire names are not (generally) string representations of integers.
Re:Why?
Code: Select all
boost::lexical_cast<unsigned int>(empName)
Re:
Code: Select all
// if it's in the top 25% then decrease aggression.
Re: AI Aggression Randomization
That cast (as a fallback in case hashing fails) was there to still provide some variety based on the Chars comprising the empire name.
I simply followed the original example for galaxy seeds: they seem to be mostly alphabetical, but that very cast is used as a fallback: given that you told me to do the same for empire names as what was done for galaxy seeds, I imagined you meant for me to do everything the same way. Apologies if I misunderstood.
The 25% of AI with lower aggression is already implemented in trunk, for osx & linux.
I've just followed what was there already, implemented by Dilvish, I believe.
The 8% of AI having even less aggression was totally my idea, though.
I did pluck that second number - and lower aggression level - out of thin air, it kind of 'felt right', somehow.
I simply followed the original example for galaxy seeds: they seem to be mostly alphabetical, but that very cast is used as a fallback: given that you told me to do the same for empire names as what was done for galaxy seeds, I imagined you meant for me to do everything the same way. Apologies if I misunderstood.
The 25% of AI with lower aggression is already implemented in trunk, for osx & linux.
I've just followed what was there already, implemented by Dilvish, I believe.
The 8% of AI having even less aggression was totally my idea, though.
I did pluck that second number - and lower aggression level - out of thin air, it kind of 'felt right', somehow.
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
Re: AI Aggression Randomization
Ok, last iteration on mySeed generation. Yesterday evening I misread FO's original code, so the fallback mySeed generator was pretty useless.
Now with a working fallback generator, that can also be commented out... tbh I'm not clear why there's a need to bracket boost::hash inside a try/catch...
Now with a working fallback generator, that can also be commented out... tbh I'm not clear why there's a need to bracket boost::hash inside a try/catch...
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
Re: AI Aggression Randomization
hey guys, I'm back. The combo of galaxy seed and empire name sounds fine/good to me, enabling reproducibility without creating excessive predictability.
As for aggression distribution, I had originally started with a broader distribution, but after a fair bit of feedback we settled on the current distribution simply having 25% to be a level below max. I think that's been working out fairly well, and I think that at least for 0.4.4 we should not change that.
We could certainly have another discussion about it, and perhaps we should wind up adding a new table for it into universe_tables.txt so that it could be more readily user-customizable.
As for aggression distribution, I had originally started with a broader distribution, but after a fair bit of feedback we settled on the current distribution simply having 25% to be a level below max. I think that's been working out fairly well, and I think that at least for 0.4.4 we should not change that.
We could certainly have another discussion about it, and perhaps we should wind up adding a new table for it into universe_tables.txt so that it could be more readily user-customizable.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: AI Aggression Randomization
Hello Dilvish, do pick what's good from my patch, discard the rest!
Cheers.
Cheers.
The small print: Any code contribution I make to FreeOrion is made under GPL v2.0, any graphic contribution is under CC-by-SA 3.0
Re: AI Aggression Randomization
Yep, and please merge the fix into the release branch too
Re: AI Aggression Randomization
Sounds fine, though it may be another day or two until I get to that. Yesterday morning and this morning I took my daughters freediving for abalone (we got 4, hurrah)-- first time for them, and it's been over a dozen years since I've gone, so I am rather a bit exhausted just now.Vezzra wrote:Yep, and please merge the fix into the release branch too
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
Re: AI Aggression Randomization
Take your time, FO is a hobby we do for fun, no need to rush anything
Oh, btw, concerning merging commits between branches/trunk (because you mentioned it in one of the other threads): The method you described of course should work, but there is a simpler solution: svn merge is your friend!
Oh, btw, concerning merging commits between branches/trunk (because you mentioned it in one of the other threads): The method you described of course should work, but there is a simpler solution: svn merge is your friend!
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: AI Aggression Randomization
NO! svn merge without proper parameters will merge everything. Read http://svnbook.red-bean.com/en/1.7/svn. ... rrypicking before merging.Vezzra wrote:Oh, btw, concerning merging commits between branches/trunk (because you mentioned it in one of the other threads): The method you described of course should work, but there is a simpler solution: svn merge is your friend!
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz