AI race

For topics that do not fit in another sub-forum.

Moderator: Oberlus

Post Reply
Message
Author
Setjhaba
Space Floater
Posts: 28
Joined: Sat Aug 13, 2005 2:42 pm
Location: Germany

AI race

#1 Post by Setjhaba »

Is it possible to determine or edit the race(s) played by the AI?

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

Re: AI race

#2 Post by Oberlus »

You can start (host) a multiplayer game and set the species of the AI players. If you edit the species you are not going to pick for yourself...
But when random, AI will pick species among the playable ones, same as human players.

tabbydan
Space Floater
Posts: 22
Joined: Tue Aug 18, 2020 7:45 pm

Re: AI race

#3 Post by tabbydan »

It would be nice (for single player vs the computer) to have some simple toggle options before playing a game.

For solo vs the computer it would be nice to have all the AI players be something other than the player's race. Story wise, it seems odd to encounter yourself in another part of the galaxy.

For a game with all human players it is slightly more work. In the case that two players pick the same race either allow messaging to decide who backs off (or, even easier, a built in Rock/Paper/Scissors (or random number) to determine who has to pick another race).

It also seems odd (story wise) to encounter the same natives in multiple places, one could explain it as they once had an empire which fell apart- but then that seems inconsistent for the races that can't both build ships and colonize other worlds.

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

Re: AI race

#4 Post by Oberlus »

tabbydan wrote: Sat Dec 12, 2020 1:53 am For solo vs the computer it would be nice to have all the AI players be something other than the player's race.
You could avoid repeated playable species by removing the "* 2" in this line of code:

Code: Select all

    pool = fo.get_playable_species() * 2
https://github.com/freeorion/freeorion/ ... py#L37-L40

In multiplayer games the most common is to pick random species, so the above change would also work well when there are less players than playable species. When players can pick their species most often you'll get boring games where everybody is picking the most powerful species.

For natives the fix would not be so direct:
https://github.com/freeorion/freeorion/ ... ves.py#L15

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

Re: AI race

#5 Post by Vezzra »

The underlying issue here is that we allow for games with more players (AI or human) than we have species. And we allow more native planets on a map than we have native species. Consequently we have to allow for the same species to get selected by more than one player/spawn multiple times on the map. Otherwise we'd have a serious problem...

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

Re: AI race

#6 Post by Oberlus »

Vezzra wrote: Sun Dec 13, 2020 11:12 am The underlying issue here is that we allow for games with more players (AI or human) than we have species. And we allow more native planets on a map than we have native species. Consequently we have to allow for the same species to get selected by more than one player/spawn multiple times on the map. Otherwise we'd have a serious problem...
Yes.
The current code for selection of empire species allows for up to two instances of each species even when there are less empires than playable species. Removing that "* 2" I pointed out above would stop that but would not disallow for repeated species when there are more empires than playable species.
AFAIK, the code for natives does not use the same mechanic of repopulating the container with available species when it gets empty, so it would require a more thorough redesign to make it work the same way.

tabbydan
Space Floater
Posts: 22
Joined: Tue Aug 18, 2020 7:45 pm

Re: AI race

#7 Post by tabbydan »

It's kind of standard in most of these games for the AI to not duplicate the player's race (and would make single-player games feel a little better).

I'd think putting a toggle on the "Content" area (where you have "Allow experimenters") that says "Allow duplicate player races" should be fairly easy. In the case that there are more players than races you could have a dialog box.

I'd also recommend persisting at least the content settings. Right now I have to repeatedly go to the "Content" area and uncheck experimenters before games.

For all human player games, having duplicate races is more likely to be a desired feature sometimes (if everyone wants to play the same race to be on a more level playing field). Another feature that could help with such games (where human players want to be on equal footing) would be a symmetric star map (not realistic, but a good way of reducing the huge luck factors that can happen with random map generation).

For natives, I can suggest a lot of workarounds.

1) for species that can colonize other worlds and build ships, allowing duplicates seems natural. The storyline could be that Ugimors, Hhiho, etc either once had empires, or were part of some empire that has since disappeared (but some of the colonies persisted)
2) for species that can colonize other worlds but not build ships- the storyline might say they were part of some unknown empire, the master race of which has died off
3) for species that can't colonize other worlds, I'd really recommend having only one of these in the whole galaxy. It seems very weird to bump into multiple copies of them (a storyline bug).

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

Re: AI race

#8 Post by Vezzra »

Oberlus wrote: Sun Dec 13, 2020 11:46 amThe current code for selection of empire species allows for up to two instances of each species even when there are less empires than playable species. Removing that "* 2" I pointed out above would stop that but would not disallow for repeated species when there are more empires than playable species.
That's a reasonable approach. Also very easily done if it's desired and we have a general consensus on such a change.

Native species selection would be tougher to adjust, as you pointed out. The proper approach here would be instead of selecting a planet and then pick a random native species out of those that fit that planets environment, iterate over the native species and randomly pick planets which environment fits the species. Only if you run out of native species before you've placed enough natives, iterate over the native species again. Lather, rinse, repeat until enough planets have been settled with natives. Only repeats native species if necessary.

Or something along that lines. If we want to get more sophisticated, we could try to incorporate the conditions tabbydan suggested. Makes even more sense, but makes things also even more complicated... ;)

Post Reply