Playing with universe gen

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderator: Oberlus

Message
Author
wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Playing with universe gen

#1 Post by wobbly »

Started playing around in universe gen. I don't really speak python so its slow going, but after headbutting it for a while I managed to make a small tweak without it spitting errors at me.

Anyway if anyone is interested its over here:
https://github.com/MichaelCourtney/free ... mentBranch

It's the normal generation with 1 tweak: It tries to pick empire starting places with a minimum spread of planet types. I haven't adjusted the part where it adds planets yet, it just makes an attempt at a good spot. As far as I can tell its working. Maybe useful? If it isn't, at the very least I understand python a bit better then I did when I started it.

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#2 Post by wobbly »

Updated.

It'll now guarantee the minimum number of planet types in home system vicinity.
It'll try (but not guarantee) not to repeat native species. - If it picks an already used native it'll try up to the next 2 planets instead and if it's still getting a repeat it places it.

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

Re: Playing with universe gen

#3 Post by Oberlus »

Vezzra will like to have a look at this, but I already know this is PR material.

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Playing with universe gen

#4 Post by Vezzra »

Oberlus wrote: Sun May 21, 2023 5:41 pm Vezzra will like to have a look at this, but I already know this is PR material.
While the original code has been written by me, several other people have been working with that code since then. So everyone may feel free to tinker with it to their hearts desire ;)

However, @wobbly, if you want me to look at your code I can do that. #4524 is the PR in question, right? What kind of feedback do you want from me?

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#5 Post by wobbly »

Vezzra wrote: Mon May 22, 2023 5:51 pm
Oberlus wrote: Sun May 21, 2023 5:41 pm Vezzra will like to have a look at this, but I already know this is PR material.
While the original code has been written by me, several other people have been working with that code since then. So everyone may feel free to tinker with it to their hearts desire ;)

However, @wobbly, if you want me to look at your code I can do that. #4524 is the PR in question, right? What kind of feedback do you want from me?
Thanks Vezzra, as far as what feedback, to be honest I'm not sure. Cjkjvfnby ended up leaving some comments and it'll probably take me a bit of time going through them. If you do end up looking at it you are of course welcome to chime in. I know it runs without spitting out an error in the logs or causing a noticeable slow down. I guess it would be mostly about whether the implementation could be cleaner, or if there is something obviously wrong that I'm not spotting.

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#6 Post by wobbly »

I had a thought on native placement. I can probably just pre-calculate how many natives to place and work out how many duplicates are necessary?

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

Re: Playing with universe gen

#7 Post by Oberlus »

wobbly wrote: Wed May 24, 2023 8:02 am I had a thought on native placement. I can probably just pre-calculate how many natives to place and work out how many duplicates are necessary?
That sounds right.
For me it is a bit of a down when there are 3+ copies of Ugmors in the galaxy and not a single one of two other natives species. But also it makes sense for replayability/diversity that not all species are present for huge galaxies.
Maybe you could reuse the "allow repeated species" toggle for this: if set to "yes", don't enforce uniform spread of native species (i.e. allow many of some and none of others).

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#8 Post by wobbly »

Hmm, maybe something like:

In gen_options:
Native repeat factor = 2 (default)

Max. Repeat = (number to place / number of scripted natives) * repeat factor

User avatar
LienRag
Cosmic Dragon
Posts: 2103
Joined: Fri May 17, 2019 5:03 pm

Re: Playing with universe gen

#9 Post by LienRag »

wobbly wrote: Wed May 24, 2023 8:02 am I had a thought on native placement. I can probably just pre-calculate how many natives to place and work out how many duplicates are necessary?
Do you mean around starting positions or in the whole Galaxy ?

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#10 Post by wobbly »

LienRag wrote: Wed May 24, 2023 4:55 pm
wobbly wrote: Wed May 24, 2023 8:02 am I had a thought on native placement. I can probably just pre-calculate how many natives to place and work out how many duplicates are necessary?
Do you mean around starting positions or in the whole Galaxy ?
So in current master it works like this:
  • get a list of native safe planets
  • go through the list and roll probability
  • place natives
I'm suggesting:
  • get a list of native safe planets
  • get the length of the list
  • roll probability x times where x is length of list and y is number of successes
  • randomize the order of the list
  • place y number of natives
The 2nd is pretty similar to how it places specials

User avatar
LienRag
Cosmic Dragon
Posts: 2103
Joined: Fri May 17, 2019 5:03 pm

Re: Playing with universe gen

#11 Post by LienRag »

OK, thanks for the explanation.
I don't really understand what will be the effect on the Galaxy, though.
Am I just really thick or the way you just described is equivalent to the way it works as of now, just organized differently ?
I guess you want to make additional checks in between ?

wobbly wrote: Wed May 24, 2023 5:07 pm The 2nd is pretty similar to how it places specials
Last time I checked the Specials code, no it wasn't.
Specials are (were ?) placed similarly to the first way you described (planet by planet).

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#12 Post by wobbly »

I said similar not same. With specials it's already rolled the chance to place for each planet before it places a single special. It's worked out how many it needs to place before actually placing a single special. With natives it places directly after each probability roll. That's the 1st point, you know how many before actual placement starts.

The 2nd point is each environment has only a few valid natives. If you are avoiding duplicates but want the same number of natives you want to be able to place on a different planet to the roll.

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#13 Post by wobbly »

Coming up to the weekend, so I'll have free time to clean it up (I hope) and add 1 last thing (for now). An option to guarantee a good/average planet in its simplest form. Defaulted to off.

What the option will do:
  • guarantee a good/average planet
What it won't do:
  • guarantee it's free from natives/monsters/bad specials
  • guarantee any fairness: Egassem will always have inferno, Sly always GG-size, laenfa will have to hope the stars aline, so to speak.

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#14 Post by wobbly »

Ok, done. I took out the native changes which I'll redo in another PR, along with changes to monster nests.

https://github.com/freeorion/freeorion/pull/4524

If anyone feels like trying it out, it doesn't need a recompile, just the files in the PR. The stringtable is based on master, so probably needs to be manually edited to use it with release version.

wobbly
Cosmic Dragon
Posts: 1809
Joined: Thu Oct 10, 2013 6:48 pm

Re: Playing with universe gen

#15 Post by wobbly »

There's another aspect of native placement I dislike. We'll actually a few, that I'd like to lump together. The main one is furthest not being placed furthest, seeing them closest to an empire just annoys me. I'd like to lump them in with a couple of other problems like acirema, that spawn ships and can be an issue too close to an empire.

So the idea is isolationist natives, and it'll be any native species that likes isolation policy. Now that policy's effect is 150uu so I was thinking, don't place an isolationist within 150 of other natives.

Now the reverse is more problematic, if I don't place within 150 of an isolationist it'd cause potential balance issues. So I was thinking: don't place in the same system if an isolationist is already there?

Any thoughts?

Post Reply