Changes between Version 20 and Version 21 of pps/tutorial
- Timestamp:
- Mar 9, 2011, 11:15:07 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pps/tutorial
v20 v21 38 38 Before you start coding there's one [wiki:howto/XMLPort page] which is extremely useful for the following tasks. You might want to have a look at it. 39 39 40 == The task == 41 Our goal is to create a drone in Orxonox that, that does some kind of autonomous flying. 42 In Orxonox we try our best to separate different kinds of functionality. You will see, that this is also the case here. 43 In the case of the drone we want to create we separate the drone itself (called AutonomousDrone) from the entity that controls the drone (called the AutonomousDroneController) and the thing that gives shape and texture to our drone (basically that is the model). Or put more crudely, the AutonomousDrone is the physical entity, the AutonomousDroneController is its intelligence and the model is it's visual representation. This is done for several reasons, the most important being, that with this kind of separation we can have multiple controllers for just one drone, we could also have one controller for multiple types of flying objects. That makes your code more generic and leads to cleaner code, less dependencies and also less code. 44 40 45 == The AutonomousDrone == 46 At first we need to create the drone itself. The drone provides the functionality of physically having a place in the game world (because it's a WorldEntity) and being able to move in it. 47 41 48 {{{ 42 49 #!html … … 68 75 69 76 == The AutonomousDroneController == 70 Now you will finish the AutonomousDroneController which gets called each tick and steers the drone. 77 Now you will finish the AutonomousDroneController which gets called each tick and steers the drone using the functionality of movement in the game world that the drone provides. 78 71 79 1. Open the file ''AutonomousDroneController.cc'' and look at it (''src/orxonox/controllers/''). 72 80 2. Have a look at the constructor and make sure nothing is missing (think of the core). … … 80 88 81 89 == The XML Part == 90 As a last step we will include the drone in our level and add the visual part of the drone, the model. (and some other stuff, too) 91 82 92 Now that you finished the classes you can recompile the project. Afterwards open the level file: 83 93 1. Open ''tutorial/data/levels/tutorial.oxw''.