[Freeciv-Dev] (PR#12770) RFC: multiple pregame states
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12770 >
enum server_states {
PRE_GAME_STATE,
SELECT_RACES_STATE,
RUN_GAME_STATE,
GAME_OVER_STATE
};
PRE_GAME means before /start. select-races means after /start but
before nations are chosen. Map generation is done between select-races
and run-game (but a map may exist earlier if /load is done). Rulesets
are loaded at the beginning of select-races (I think).
This problem is this means there is no time during pregame when you can
edit things that relate to the map or ruleset. There are at least two
cases where I want to be able to do this:
- Civworld TNG should be able to edit the map in pregame. But this is
impossible since (unless you /load) the map isn't generated until the
instant before the game starts.
- Players should be able to edit their nations or rulesets in pregame.
In particular I'm talking about a Moo2-like system where "effects" for
the nation may be selected before the game starts. In every other RTS
game the nation/race/whatever is chosen asynchronously before the game
starts. Only in freeciv must it happen synchronously at start time.
Fixing this basically requires a redesign of some of the game states.
However there are several ways to do it and I'm not sure what's best.
Basically we have 3 different boolean values:
1 Rulesets loaded, or not.
2 Nations chosen, or not.
3 Map loaded, or not.
2 and 3 depend on 1. 3 depends *very* loosely on 2 (since start
positions may depend on nation selection). There are surely some more
booleans we could add (teams chosen comes to mind).
So the first possible way is with additional states. This enforces the
ordering in a linear way, since the movement from state to state is very
simple.
enum server_states {
PRE_GAME_STATE,
RULESETS_LOADED_STATE,
NATIONS_CHOSEN_STATE,
MAP_CREATED_STATE,
RUN_GAME_STATE,
GAME_OVER_STATE
};
When you start the game you move immediately into pregame. When
rulesets are loaded you move directly into the rulesets-loaded state.
When all nations are chosen you move into nations-chosen state. When
the map is created you move into map-created state. Then when the game
starts you move into run-game state.
Doing /start begins a chain reaction that runs you through all these
states without stopping. However you may also move through them at your
own pace with /choosenations, /generate, etc. The problem is if you do
/generate you pretty much have to wait for nations to be chosen before
the map is actually generated. It's like it sets a target state of
MAP_CREATED, but getting to this state may take some time.
The second way is by simplifying the states and tracking the boolean
values individually in pregame.
enum server_states {
PRE_GAME_STATE,
RUN_GAME_STATE,
GAME_OVER_STATE
};
bool rulesets_loaded, map_created, nations_chosen;
So when the server boots up it goes into pregame with all values set to
false. Then /choosenations tells players to choose their nations (or
maybe this value is set automatically when all players have chosen,
allowing players to switch, etc.). /generate creates a map (this can
happen before the nations are chosen, but is best left until after).
/start does both of course.
The problem with this is you have to worry more about dependencies in
the order of which things are done. For instance either /load or /start
or /choosenations or /generate would require rulesets to be loaded (if
they haven't yet).
Of course there are other variations as well; this just shows both ends
of the spectrum I think. All in all I lean toward the second idea.
-jason
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12770) RFC: multiple pregame states,
Jason Short <=
|
|