= How to create a new gametype = I just want to share my experiences from creating Dynamicmatch as a c++ and orxonox newbie. Creating a new gametype is not very difficult - although you produce valuable content for Orxonox. == Where are the concerning source files? == __../src/orxonox/gametypes__[[BR]] All gametypes are stored in this folder. The most important source files are Gametype. All gametypes inherit the Gametype class. So most of your coding work is just to rewrite some functions. == Strategy == Don't reinvent the wheel - try to copy and modify as much code from other gametypes as possible.[[BR]] 1. Know what kind of gametype you want to create.[[BR]] 2. Play existing gametypes and check which parts you want to adopt.[[BR]] 3. Search in the concerning source files for code you can adopt.[[BR]] 4. Start with the basic concept and add features later. (A Todo-List for the features would be nice.)[[BR]] == Gametype-Level == * Level are stored in __../data/levels__. You need a level to test your gametype. * For testing purposes just copy an existing level and rename it. * Don't forget to set __gametype = YourGameType__ in the ____ tag. * Put "create a level for my new gametype" on your todo list :-) Later you should try to create a level that is optimized for your new gametype. == Change the AI-behaviour == * The concerning file is in __../src/orxonox/controllers__, called "ArtificialController.cc". * You can make the bots stop shooting at certain targets by adding some lines of code in the __bool ArtificialController::sameTeam__-function as displayed above. The function should return true, if a bot shouldn't attack a certain target. (Since the AI-player is in the same "team".) == Miscellaneous tips - Useful at the beginning == * Don't forget to add your gametype to the CMakeLists.txt or it won't compile. * Compiling with the terminal. Go to the folder of your orxonox branch. The command for compiling is __cmake -j3__. * Don't forget to backup your code via svn. Open a terminal, go to your orxonox branch-folder and type __ svn ci -m "reason for commitment or summary of latest changes__ . * Gamecommands: to add 2 new bots enter __addbots 2__, to remove one of them enter __killbots 1__. To display the scoreboard hit __F2__. * Have a look at [wiki:howto/STL enhanced datatypes provided by the std library] - especially the map. == Important functions inherited from Gametype == ||'''Function name'''||'''Effect'''|| ||allowPawnHit||Whenever a player would recieve a hit this function is called - if the function returns false a hit is not possible|| ||allowPawnDamage||Whenever a player would recieve damage this function is called - if the function returns false damage is not possible|| ||allowPawnDeath||Whenever a player would die this function is called - if the function returns false death is not possible|| ||playerEntered||what should happen, when a player entered the "battefield"?|| ||playerLeft||what should happen, when a player left the "battefield"?|| ||[wiki:howto/ConfigValue setConfigValues]||interface for menue - to set the config values; ConfigValues are stored in a [wiki:howto/ConfigFile config file]|| ||[wiki:howto/Tickable tick]||this function is called whenever a new frame is rendered; dt is the value how much time has passed since the last frame|| == [wiki:howto/Timer Timer] == * A timer is a object of the Timer class that call a function after a certain time. * You can find a short tutorial in __/src/libraries/tools/Timer.h__ or a more detailed one [wiki:howto/Timer in the wiki]. * If the second argument is true, you create a timer-loop: The function is called periodically. Else the timer is only called once.