navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 4 (modified by scheusso, 12 years ago) (diff)

Basic PPS Tutorial

This is a basic tutorial for new PPS students to get familiar with our framework and build environment. The process is described for tardis here. If you use another system first go to the [download] page and make sure you have all dependencies installed.


We check out the source and media repository and build for the first time

  1. Create your orxonox directory (if not already existing):
    mkdir ~/orxonox
    cd ~/orxonox
  2. Now check out the latest revision of the media repository (you will probably be asked for a username and password once):
    svn co
  3. Now get the latest revision of the trunk:
    svn co
  4. Prepare to build:
    mkdir trunk/build
    cd trunk/build
    cmake ..
  5. Now build for the first time (may take some time, further builds will be faster):
    make -j4  #-j4 means to create 4 parallel compile processes
  6. Additionally you can use KDevelop3? as IDE to develop (if you don't want to use the console ;))

Start the game for the first time

  1. Enter to the appropriate folder and start the game. You will see a menu popping up, just press the Standalone button.
    cd ~/orxonox/trunk

Now we extend the Ship As you might have recognized some features of the Ship were missing:

  • No special effects
  • You can't fire in continuous mode

TutorialShip Class

We have derived a new type of SpaceShip for you: TutorialShip. The back end doesn't have to bother you (you will notice that some functions don't seem to be doing anything at all).
At the moment, you are using the SpaceShip class. We would like to change this. Fortunately this can be done in an XML file where we load the level.

  1. Go to your media repository (orxonox/Media) and open tutorial.oxw in the level folder with a text editor like vim, nano, etc.
  2. Find the second paragraph (about 5th line) and change SpaceShip to TutorialShip
  3. Save the file. You can keep it open, we need it again later.

Next thing will be to change the code accordingly, since the game will probably crash now when started.
We organise our source files via CMake as you have already found out. You now have to tell CMake to also compile the TutorialShip:

  1. Open orxonox/trunk/src/orxonox/CMakeLists.txt
  2. You will see a large list of source files (*.cc). You can add "oxonox/" anywhere you like, but it is preferred to organise the file a little bit. So look for and add things there.
  3. Save and close.

The interesting part: Modifying the C++ code. Open orxonox/trunk/src/orxonox/objects/ As you have already heard from Fabian, the Core Framework is like a language extension to C++. But it cannot be 100% automatic. That means you have to add a few lines accordingly:

  1. Find the constructor (TutorialShip::TutorialShip()) and add RegisterObject(TutorialShip) as the first statement. This is used for the class hierarchy and for the ObjectLists.
  2. do more stuff
  3. (???)

Now start the game again and do some fancy in-game-stuff

  1. (???)