#1417 closed enhancement (fixed)
[PATCH] Random maps should have random civilization by default
Reported by: | fabio | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 11 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description
To make it truly random :)
Attachments (1)
Change History (9)
comment:1 by , 12 years ago
Priority: | Should Have → Nice to Have |
---|
comment:3 by , 12 years ago
The UI shouldn't be random, I'm pretty sure what we want is just that "Random" civ be selected by default in random map setup but also changeable before the game starts.
by , 12 years ago
Attachment: | Patch1417.patch added |
---|
comment:4 by , 12 years ago
Updated patch to insert "Random" as the first civ for each player in a random game. It can be changed by the leader to whatever civilizations they want (if they choose).
comment:5 by , 12 years ago
Keywords: | patch review added |
---|---|
Summary: | Random maps should have random civilization by default → [PATCH] Random maps should have random civilization by default |
comment:6 by , 12 years ago
Keywords: | review removed |
---|
Thanks for the patch. I tested it, but it only chooses a random civ for player 1, even though it displays "Random" for all players in setup, the others stay in alphabetical order. Presumably the onSelectionChange
event handler isn't being called as you expected (to avoid recursion) and the map settings aren't updated. It's probably a bad idea to try doing that in the GUI update (onGameAttributesChange
is really just a GUI update).
A different solution would be to special case usage of g_DefaultPlayerData
(loaded from player_defaults.json
) or copy it specially for random maps, changing the default civ to "random". We don't have to worry about saving the player's choices if they change between scenario/random map types, eventually the game setup options will need persistent storage. Of course player settings should be preserved when switching between different random maps, the solution shouldn't break that.
Any other ideas? :)
comment:7 by , 12 years ago
Keywords: | patch removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in #12106.
comment:8 by , 12 years ago
Component: | Core engine → UI & Simulation |
---|
A couple of things regarding this patch:
1) Is there a constant defining the number of civilizations? Currently I'm using [code]
code but if there's a constant that would be better.
2) For random civilization selection I have this code:
[code] random civilization pre-selected, changeable before game civCount will be replaced if there is a constant for the # of civilizations pCiv.selected = Math.floor(Math.random()*civCount) + 1; randomized at game start, unchangeable before game pCiv.selected = 0; code
Like I've commented, the first option will randomly select a starting civilization, but it can be changed by the user. The second option forces the civilization to random and will only be generated once the game starts; the user will not be able to change it. Which option do people think is better?