Follow-up Comment #1, patch #5034 (project freeciv): Unless "rank a user that has played the most with a player" means consecutive play, we'd have to store an unbounded list of usernames and turns played in the savefile. I assume pepeto intended consecutive control of a player.
To implement pepeto's proposal we'd need to store: * Per-player last_username and longest_username (replacing ranked_username) * For each of those, the total number of turns we've counted towards them (so we can overwrite longest_username when last_username accrues more turns); replaces user_turns * The last turn number we saw last_username, so we don't count them twice on detach/attach. ** (Can also implement the "two turns consecutively" rule for incrementing the above counts; but do we need this, or is simply counting cumulative turns possibly interspersed with AI control sufficient?) * Per-player creation and death turns, or simply a counter that increments every turn a player is alive -- this would also allow implementation of a "Player" range for the new "Age" requirement. On attach or turn change with user connected to player: * if last_turn_number is not the current turn, increment last_username_count ** (if we want the two-consecutive-turn rule, only do this if last_turn_number is the *last* turn; but do we increment by 2 in this case?) * if last_username_count > longest_username_count, overwrite longest_username* with last_username* * set last_turn_number to current turn (unconditionally) For delegation, I think a turn where the delegate turns up should count towards the delegator's record, and the delegate gets no credit. Ranking on game end: * Only consider longest_username * Discard longest_username_count less than 10 or less than half player alive time (player has no ranked user in this case) * Otherwise, longest_username is the ranked user This has the following properties: * (good) Longturn-style users get rankings ** Without the two-consecutive-turn rule, a user who turned up only every other turn would get ranked. Is that good or bad? * (?) I don't think this has the property Davide wanted in patch #3526 -- I think he wanted the last user who controlled a player to get credit, maybe? (Can't find original discussion on civland.org.) * (ok) A player whose control is swapped between two users repeatedly gets no rank. (I'd argue that the users should probably have a delegation relationship in that case.) (This does still allow someone to just turn up occasionally and let the AI do all the work and get the credit, but if other full-time players score worse than that then they probably deserve to be ranked less :) The change of what's in the savefile means this is a 2.6 feature at the earliest. _______________________________________________________ Reply to this item at: <http://gna.org/patch/?5034> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freecivemail@example.com https://mail.gna.org/listinfo/freeciv-dev