Global game rules refactoring

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

Moderator: Committer

Post Reply
Message
Author
o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Global game rules refactoring

#1 Post by o01eg »

While thinking about implementing turn timeout UI I got idea about re-using whole game rules concept:
  • Use game rules UI already exists to manage them in starting multiplayer game.
  • Move galaxy options into game rules.
  • Use the same UI to show game rules in the playing game instead of encyclopedia page.
  • Introduce editable rules and allow to change those game rules in the playing game from this UI.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

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

Re: Global game rules refactoring

#2 Post by Geoff the Medio »

The original / current idea of game rules was to modify how the game works while it's being played. The balance / statistics of content could be adjusted (eg. tech costs, how strong armour parts are, planet population levels), content could be enabled or disabled (eg. fighters exist or not, super testers exist or not), basic game mechanics could be modified (eg. how many combat rounds, does the visibility system exist).

Galaxy setup options are somewhat different, in that they don't affect how they game functions after the setup; they are most parameters for the galaxy generation scripts. (There are also other setup options like how many and what kind of AI players to spawn, which are hard to tell apart from galaxy settings in the UI). Once a galaxy is generated, then those settings don't matter any more and don't impact how the game works / is played. This distinction may or may not be worth keeping... I'm not sure.

A probable future feature is having a way that custom edited galaxies could be loaded, in which case those galaxy generation settings would be meaningless. There could be a variety of different galaxy generation scripts made available, which would require different galaxy setup options than the default ones now present. Currently the galaxy setup settings don't really support this, while rules are probably a bit more flexible in that the structure for them more easily should support having or not having rules defined in some cases and not in others, depending on what content is used. Alternatively, default / undefined values for some rules could be set in cases where they aren't meaningfully defined... I'm not sure how things would work in practice when switching between content or different scripts that define different rule sets... possibly both would need to be handled. So, it would probably be reasonable to record how a galaxy is generated in the rules, instead of in a separate galaxy settings structure, even though that is inconsistent with the idea of rules defining how the game works, not how it is set up, as is the case now.

It would also be reasonable to have a "galaxy setup" tab in the rules interface rather than a separate UI section for that.
Introduce editable rules and allow to change those game rules in the playing game from this UI.
This is a separate issue, which I'm much less inclined to support. The example you've given, about server turn cycle timers, seems more like an option than a rule, and I wouldn't introduce the idea of editable rules just to support that.

Post Reply