Browse Source

game server readme

Maxim Sokhatsky 11 years ago
parent
commit
60cca27484

+ 55 - 6
apps/server/src/README.md

@@ -1,12 +1,61 @@
 Kakaranet Game Server
 =====================
 
-* auth    -- token server
-* modules -- instant, regular and tournament gaming
-* lib     -- aux modules
-* sup     -- services under supervision
-* okey    -- OKEY game
-* tavla   -- backgammon game
+Token server
+------------
+
+    ├── auth 
+    │   ├── anonymous.erl           Anonymous Names Generation
+    │   └── auth_server.erl         gen_server
+
+Aux libraries
+-------------
+
+    ├── lib
+    │   ├── deck.erl                shuffle machine
+    │   ├── gas.erl                 logging switcher
+    │   ├── known_records.erl       strict allowed protocol records
+    │   └── midict.erl              multi-indexed dictionary
+
+Tournament modes
+----------------
+
+    ├── modules
+    │   ├── elimination.erl         tournaments
+    │   ├── matrix.erl              tournament matrix
+    │   ├── lucky.erl               free play mode, infinite tournament, lobby mode
+    │   ├── relay.erl               relay between tournaments and tables
+    │   └── standalone.erl          standalone games
+
+Node services under supervision
+-------------------------------
+
+    ├── sup
+    │   ├── game_log.erl            persist game protocol statistics
+    │   ├── id_generator.erl        unique ids
+    │   ├── lucky_sup.erl           lucky games supervisor
+    │   ├── okey_sup.erl            okey pre-created games
+    │   └── tavla_sup.erl           tavla pre-created games
+
+Common structure for all games
+------------------------------
+
+    ├── okey/tavla
+    │   ├── game_bot.erl                game bot
+    │   ├── game_desk.erl               desk rules, game rules
+    │   ├── game_scoring.erl            scoring
+    │   ├── game_table.erl              table messaging between players
+    │   └── game_test.erl               game testing
+
+Game Server API
+---------------
+
+    ├── README.md
+    ├── game.erl                        API for crating game rooms, tournaments, etc.
+    ├── game_app.erl
+    ├── game_session.erl                front API for Game Protocol
+    ├── game_sup.erl
+    └── server.app.src
 
 Credits
 -------

+ 6 - 1
apps/server/src/okey/okey_scoring.erl

@@ -256,14 +256,19 @@ players_achivements(Mode, Seats, Hands, WhoHasGosterge, Has8Tashes, FinishInfo)
              end || SeatNum <- Seats]
     end.
 
+%% TODO: make Finish Info more Universal
+        % FinishInfo :: {Reason, Revealer, RevealerWon, WrongRejects, RevealInfo}
+        % RevealInfo :: {ColorReveal, OkeyReveal, PairsReveal}
 
-%% finish_info(GameMode, FinishReason, Gosterge) ->
+%% finish_info(GameMode, FinishReason, Gosterge) -> 
 %%      tashes_out |
 %%      timeout |
 %%      set_timeout |
 %%      {win_reveal, Revealer, WrongRejects, RevealWithColor, RevealWithOkey, RevealWithPairs} |
 %%      {fail_reveal, Revealer} |
 %%      {gosterge_finish, Winner}
+
+
 finish_info(GameMode, FinishReason, Gosterge) ->
     case FinishReason of
         tashes_out -> tashes_out;

+ 8 - 26
apps/server/src/okey/okey_table.erl

@@ -330,32 +330,14 @@ handle_parent_message(show_round_result, StateName,
                              game_id = GameId, table_id = TableId} = StateData) ->
     {FinishInfo, RoundScore, AchsPoints, TotalScore} = ?SCORING:last_round_result(ScoringState),
     gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> RoundScore: ~p Total score: ~p.", [GameId, TableId, RoundScore, TotalScore]),
-    Msg = case FinishInfo of
-              {win_reveal, Revealer, WrongRejects, _RevealWithColor, _RevealWithOkey, _RevealWithPairs} ->
-                    round_results(win_reveal,Revealer,true,WrongRejects,RoundScore,TotalScore,AchsPoints,StateData);
-%                  create_okey_round_ended_reveal(
-%                    Revealer, true, WrongRejects, RoundScore, TotalScore, AchsPoints, StateData);
-              {fail_reveal, Revealer} ->
-                    round_results(fail_reveal,Revealer,false,[],RoundScore,TotalScore,AchsPoints,StateData);
-%                  create_okey_round_ended_reveal(
-%                    Revealer, false, [], RoundScore, TotalScore, AchsPoints, StateData);
-              tashes_out ->
-                    round_results(tashes_out,none,false,[],RoundScore,TotalScore,AchsPoints,StateData);
-%                  create_okey_round_ended_tashes_out(
-%                    RoundScore, TotalScore, AchsPoints, StateData);
-              timeout ->
-                    round_results(timeout,none,false,[],RoundScore,TotalScore,AchsPoints,StateData);
-%                  create_okey_round_ended_tashes_out(
-%                    RoundScore, TotalScore, AchsPoints, StateData);
-              set_timeout ->
-                    round_results(timeout,none,false,[],RoundScore,TotalScore,AchsPoints,StateData);
-%                  create_okey_round_ended_tashes_out(
-%                    RoundScore, TotalScore, AchsPoints, StateData);
-              {gosterge_finish, Winner} ->
-                    round_results(gosterge_finish,Winner,true,[],RoundScore,TotalScore,AchsPoints,StateData)
-%                  create_okey_round_ended_gosterge_finish(
-%                    Winner, RoundScore, TotalScore, AchsPoints, StateData)
-          end,
+    {Reason,Revealer,RevealerWon,WrongRejects} = case FinishInfo of
+        {win_reveal, R, Wrong, _Color, _Okey, _Pairs} -> {win_reveal,R,true,Wrong};
+        {fail_reveal, R} -> {fail_reveal,R,false,[]};
+        tashes_out -> {tashes_out,none,false,[]};
+        timeout -> {timeout,none,false,[]};
+        set_timeout -> {timeout,none,false,[]};
+        {gosterge_finish, Winner} -> {gosterge_finish,Winner,true,[]} end,
+    Msg = round_results(Reason,Revealer,RevealerWon,WrongRejects,RoundScore,TotalScore,AchsPoints,StateData),
     relay_publish_ge(Relay, Msg, StateData),
     {next_state, StateName, StateData#okey_state{}};