Here is the process for adding a new mission to Fission Seed.
- Create your new mission
- Create a new file in the missions folder. It is best usually to copy an existing mission
- For the rest of this list I’ll assume your have Mission1d in mission4.py
- Make the new mission distinct
- New classname
- New name attribute
- New description attribute
- New long_description attribute
- Make the new mission visible
- Edit the __init__.py file in the mission folder
- Import your new mission module (the second import makes debugging easier because it allows you to skip straight to your mission in step 7 below).
- import mission4
- from mission4 import *
- Add the module name to the list of missions in the getMissions function
- Make the new mission active. This is a bit ugly right now as you need to make sure the mission immediately preceding it is complete
- Open the .fission-seed-missions.txt in your home directory. If it doesn’t exist then create it
- This is a python dictionary with the names of missions (.name attribute of a mission) and a status (True/False). When a mission is completed the status is True and the next mission is then accessible
- So set the status of the mission before your new one to True. The file should look something like this:
{‘Night Sight’: True,}
- Initialise the conversation system for your new mission
- Open the conversations.txt file in the design folder
- Copy an existing conversation mission and set the name to be your new mission class name. See the example below, assuming your mission class name is Mission1d.
Mission:Mission1d {
Keltor, Keltor.initial-conversation {
Keltor> Welcome to the new level
> Ok thanks
Keltor> Enjoy the story
> I will do
%!Keltor.initial-conversation
}
}
- Compile your conversation
- Make sure you have pyparsing installed (easy_install pyparsing)
- Compile the conversation (running from the install folder)
“python serge/tools/conversationcompiler.py -s design/conversations.txt -d game/conversation.py”
- Run you game
- You will want to turn on logging
- Lots of logging: “python fission_seed.py -l 10”
- Less logging: “python fission_seed.py -l 20”
- To avoid having to go through the main level select
- “python fission_seed.py -l 10 -S -t "initial-mission='Mission1d'"
Here is my example mission file.
"""The missions"""
import serge.engine
import serge.blocks.actors
import game.common
import mission
import mission1
ALL_WORLDS = mission1.ALL_WORLDS
class Mission1d(mission.SimpleMission):
"""The fourth mission"""
starting_world = 'meeting-room'
mission_worlds = ['world-6', 'meeting-room', 'training-ground', 'training-office',
'training-building', 'training-chapel', 'cathedral']
all_worlds = ALL_WORLDS
chapter_number = 1
mission_number = 4
name = 'Test mission'
description = 'An example to show how it works'
long_description = '''
Creating a new mission
Can be daunting!
But it isn't too
hard.
'''
music = 'city-theme-1'
time_of_day = ''
def __init__(self, **kw):
"""Initialise the mission"""
super(Mission1d, self).__init__(**kw)
self.worlds = {}
def addedToWorld(self, world):
"""We were added"""
super(Mission1d, self).addedToWorld(world)
self.world.linkEvent(game.common.E_PERSON_DIED, self.playerDied, world)
self.conversation = serge.blocks.singletons.Store.getItem('conversation').people
self.player = world.findActorByName('player')
self.player.setBombs(10)
def playerDied(self, obj, world):
"""A player died"""
self.log.info('A player (%s) in the level died' % obj.getNiceName())