Skip to content

Commit

Permalink
Improve documentation surrounding game creation - add javascript show…
Browse files Browse the repository at this point in the history
…hide for game creation
  • Loading branch information
christoshrousis committed Apr 22, 2017
1 parent 3fe0521 commit f8ae147
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,33 @@ The fastest way to get started with Elovation is to click the deploy to [Heroku]
If you would like to add a level of authentication security to your app on Heroku, on the setup screen set the "BASIC_AUTH" to "true", and set a username and password in their respective fields. When you try to access your app in future, you will be prompted for your credentials.

The click to deploy button will automatically migrate your database.

Game Options
------------
There are two types of "Games" that Elovation allows for: [Trueskill](https://en.wikipedia.org/wiki/TrueSkill) & [Elo](https://en.wikipedia.org/wiki/Elo_rating_system)

#### Trueskill
Trueskill allows for teams of multiple players, to play other teams - yet still calculate each individual player's ranking.

When creating a new game you may set the maximum numbers of teams in a result, and the maximum number of players per team in a result. You can record a result in any combination up to the maximum.

The default is set to 2 players per team, and 2 teams per result (like playing a game of doubles Table Tennis / Foosball). The minimum allowed players per team is 1, and the minimum allowed teams per result is 2.

If you increase the allowed number of teams per result, this will allow scenarios where a team can defeat multiple other teams in a single match at the same time. A possible example of this is a Paint Ball / Nerf War with multiple teams that is "last team standing" - All other teams are the losers and the remaining team is the winner.

Suitable for:
- Table Tennis
- Foosball
- Paint Ball / Nerf Wars

#### Elo
Elo is a simpler method devised for Player versus player games only and does not support teams. It also increments and decrements by a set value which makes a win/loss amount more predictable.

Suitable for:
- Chess
- Table Tennis
- Foosball

Caution
-------
If you intend to use this software commercially, you must remove the Trueskill implementation as it is patented by Microsoft.
13 changes: 13 additions & 0 deletions app/assets/javascripts/game-new.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
toggleFields = () ->
$('#game_rating_type').change ->
if $(this).find('option:selected').attr('value') == 'elo'
$('#max_players_control_group').hide()
$('#max_teams_control_group').hide()
$('#game_max_number_of_players_per_team')[0].value = 1
else
$('#max_players_control_group').show()
$('#max_teams_control_group').show()
$('#game_max_number_of_players_per_team')[0].value = 2

$ ->
toggleFields() if $('#new_game').length != 0
12 changes: 6 additions & 6 deletions app/views/games/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
</div>
</div>

<div class="control-group">
<div class="control-group" id='max_players_control_group'>
<%= f.label :max_number_of_players_per_team, 'Maximum number of players per team', class: "control-label" %>
<div class="controls">
<%= f.number_field :max_number_of_players_per_team, class: "input-mini" %>
<span class="help-inline">Leave blank for no restriction</span>
<%= f.number_field :max_number_of_players_per_team, value: 2, class: "input-mini" %>
<span class="help-inline">Set to blank for no restriction</span>
</div>
</div>

<div class="control-group">
<div class="control-group" id='max_teams_control_group'>
<%= f.label :max_number_of_teams, 'Maximum number of teams', class: "control-label" %>
<div class="controls">
<%= f.number_field :max_number_of_teams, class: "input-mini" %>
<span class="help-inline">Leave blank for no restriction</span>
<%= f.number_field :max_number_of_teams, value: 2, class: "input-mini" %>
<span class="help-inline">Set to blank for no restriction</span>
</div>
</div>

Expand Down

0 comments on commit f8ae147

Please sign in to comment.