Skip to content

Observer

kimjieun02 edited this page Mar 31, 2017 · 8 revisions

Index

  1. Role of Observer
  2. Structure
    • html file
    • javascript files
  3. How to make new game

Role of Observer

The Observer receives information about Player and the game from the Server and indicates to Web Browser so the user can observe the process of the game with provided service.

Structure

The files and directories which take charge of Observer follows the box down this sentence.

battle.ai
|
+---static
|   |   main.js
|   |    
|   +---_base        
|   |       basicFunction.js
|   |       setting.js
|   |       lobby.js
|   |       gameBoard.js
|   |       gameResult.js
|   |  
|   +---_plugin
|   |       plugin files
|   |       ...
|   |
|   \---examples
|       |
|       +---game1
|       |   \---게임에 따라 추가로 필요한 files...
|       \---game2
|           \---...
|
\---templates
        index.html

html file

index.html is the only html file exist.

index.html : connects css and javascript files and binds the element and place which can be used on each page.

<html>
    <head> css files... </head>
    <body>
        <div id="id_lobby" class="class_page class_lobby" ...>
        <div id="id_gameBoard" class="class_page class_gameBoard" ...>
        <div id="id_gameResult" class="class_page class_gameResult" ...>
        
        <script ...
            JS plugin files
            JS files in base directory
            JS files in game example
                -lobby, gameBoard, gameResult
                -setting
            main JS file                        />
    </body>
</html>

Locate JS files as the box above this sentence for overriding and load procedure.

javascript files

basicFunction.js : 다른 JS file에서 공통적으로 사용될 수 있는 function 및 variable을 정의한다.

lobby.js : match 등의 lobby page에서 사용되는 function 및 variable을 정의한다.

gameBoard.js : 게임판을 그리는 등의 gameBoard page에서 사용되는 function 및 variable을 정의한다.

gameResult.js : 게임 결과를 집계하는 등의 gameResult page에서 사용되는 function 및 variable을 정의한다.

setting.js : title, match_cnt, protocol 등의 게임 단위로 달라질 수 있는 variable을 설정한다.

main.js : web socket 연결을 관리한다.

How to make new game

Clone this wiki locally