Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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)

Patch1417.patch (847 bytes ) - added by Matt Doerksen 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Kieran P, 12 years ago

Priority: Should HaveNice to Have

comment:2 by Matt Doerksen, 12 years ago

A couple of things regarding this patch:

1) Is there a constant defining the number of civilizations? Currently I'm using [code]

var civList = loadCivData(); var civCount = -1; start at -1 to offset the inclusion of "random" for each (var civName in civList) {

civCount++;

}

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?

Last edited 12 years ago by Matt Doerksen (previous) (diff)

comment:3 by historic_bruno, 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 Matt Doerksen, 12 years ago

Attachment: Patch1417.patch added

comment:4 by Matt Doerksen, 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 historic_bruno, 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 historic_bruno, 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? :)

Last edited 12 years ago by historic_bruno (previous) (diff)

comment:7 by O.Davoodi, 12 years ago

Keywords: patch removed
Resolution: fixed
Status: newclosed

Fixed in #12106.

comment:8 by historic_bruno, 12 years ago

Component: Core engineUI & Simulation
Note: See TracTickets for help on using tickets.