31. Game operation part 1: Announcements

iFun Engine provides a function to manage announcements sent to clients. This function is provided as a Python Django program called iFun Announcer separate from the game server.

When a game administrator adds an announcement to the Django manager message board, iFun Engine’s client plugin receives the announcement list in iFun Announcer.

31.1. Installing iFun Announcer

You need the iFun Announcer package to use the announcement service. You can request this package by emailing iFun Engine support.

31.1.1. Required programs

31.1.1.1. Python 2

iFun Announcer requires Python 2 version 2.7 or higher. You can check your version with the following command.

$ python --version

31.1.1.2. Python Django

The announcement service requires Django version 1.7 or higher. You can check your version with the following command.

$ django-admin --version

31.2. Configuring iFun Announcer

Once you have received the iFun Announcer package, unzip it into the folder you want for the server. Perform the following steps to configure the DB.

31.2.1. DB configuration

31.2.1.1. For Announcer for Django 1.7

$ python ./manage.py makemigrations board
$ python ./manage.py migrate

31.2.1.2. For Announcer for Django 1.10

$ python ./manage.py makemigrations
$ python ./manage.py migrate

To perform this task, create a DB file named db.sqlite3.

31.2.2. Creating an administrator account

Now you’ll make an administrator account to manage the message board.

$ python ./manage.py createsuperuser

Username (leave blank to use 'master'):
Email address:
Password:
Password (again):

31.2.3. Changing your administrator account password

If you want to change your password, use the changepassword command.

$ python ./manage.py changepassword [username]

31.3. Running iFun Announcer

You can run the server with the manage.py runserver command.

$ python ./manage.py runserver 0.0.0.0:8080

When a message appears saying the server has started with no error messages, this means the announcement server has started successfully. Now, go to http://127.0.0.1:8080/admin/ in your web browser. You will see a login screen. 외부에서 접속 시에는 announcer/settings.py 파일의 ALLOWED_HOSTS 에 서버 아이피 주소를 추가해줍니다.

$ vi announcer/settings.py

ALLOWED_HOSTS = ['{서버 아이피 주소}']

그리고 http://{서버 아이피 주소}:8080/admin/ 으로 접속하시면 됩니다. When you log in with the administrator account you created above, you can access the administrator page.

Note

If the following log is output while running, you need to run python ./manage.py migrate first.

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

31.4. Adding/deleting announcements

Log into the administrator page to see a message board called Announcements. This is the message board for announcements. Click to enter. You can add announcements using the ADD ANNOUNCEMENT + button at the upper right. To delete an announcement, go to the details page for that announcement and click the Delete button.

You can add images or URLs when writing announcements. There are no strict rules about what can be included in an announcement. You can define and use whatever items you need.

31.5. 공지사항 분류 등록/삭제

관리자 페이지에는 또한 Announcement kinds 라는 메뉴가 있습니다. 진입하면 공지사항 분류를 관리하실 수 있습니다. 오른쪽 상단의 ADD ANNOUNCEMENT KIND + 버튼으로 공지사항 분류를 등록할 수 있고, 상세 페이지에서는 삭제도 가능합니다.

분류 등록 시 namedescription 를 입력합니다.

  • name (필수) : 실제로 사용할 분류 이름으로 191 자 이하의 문자열로 작성하실 수 있습니다. 실제로 플러그인 등에서 사용할 문자열이니 주의깊게 설정해 주셔야 합니다.

  • description (생략 가능) : 해당 분류에 대한 설명 및 코멘트 등을 입력하는 란이며, 입력 길이에 제한은 없습니다. 관리자 UI 에서만 사용하는 참고용 속성입니다.

분류를 등록한 이후에는 공지사항을 작성/수정 하실 때 해당 분류(kind)로 설정하실 수 있습니다. 공지 등록시 분류(kind)를 --------- 로 설정하시면 미분류 공지사항으로 취급합니다.

31.6. (Advanced) Extending iFun Announcer

You can add text, images, or URLs to your message board using iFun Announcer. If you need to add something else, you can add the necessary field to iFun Announcer’s board/models.py file.

After adding and modifying the field, you need to reflect the changes in your DB structure as follows.

$ python manage.py migrate

Tip

If a field changes, you may experience difficulties using previous DB files, so it is better not to change fields after creating a DB.

Important

Fields provided by default are also used in client plugins, so you cannot modify or delete them.

31.6.1. Client code

Please refer to the distributed client plugin tester code for a client example. For more details, see Plugin announcements.