29. 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.

29.1. Installing iFun Announcer

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

29.1.1. Required programs

29.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

29.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

29.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.

29.2.1. DB configuration

29.2.1.1. For Announcer for Django 1.7

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

29.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.

29.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):

29.2.3. Changing your administrator account password

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

$ python ./manage.py changepassword [username]

29.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. 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.

29.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.

29.5. (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.

29.5.1. Client code

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