Adding a level to Fission Seed

Here is the process for adding a new mission to Fission Seed. 

  1. Create your new mission
    1. Create a new file in the missions folder. It is best usually to copy an existing mission
    2. For the rest of this list I’ll assume your have Mission1d in mission4.py
  2. Make the new mission distinct
    1. New classname
    2. New name attribute
    3. New description attribute
    4. New long_description attribute
  3. Make the new mission visible
    1. Edit the __init__.py file in the mission folder
    2. 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).
      1. import mission4
      2. from mission4 import *
    3. Add the module name to the list of missions in the getMissions function
  4. 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
    1. Open the .fission-seed-missions.txt in your home directory. If it doesn’t exist then create it
    2. 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
    3. So set the status of the mission before your new one to True. The file should look something like this:

{‘Night Sight’: True,}

  1. Initialise the conversation system for your new mission
    1. Open the conversations.txt file in the design folder
    2. 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

   }

}
 

  1. Compile your conversation
    1. Make sure you have pyparsing installed (easy_install pyparsing)
    2. Compile the conversation (running from the install folder)

“python serge/tools/conversationcompiler.py -s design/conversations.txt -d game/conversation.py”

  1. Run you game
    1. You will want to turn on logging
      1. Lots of logging: “python fission_seed.py -l 10”
      2. Less logging: “python fission_seed.py -l 20”
    2. To avoid having to go through the main level select
      1. “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())