Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 1 (modified by jo, 14 years ago) (diff)

test

=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
All gametypes are stored in this folder. The most important source files are Gametype.<cc/h> 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. #Know what kind of gametype you want to create. #Play existing gametypes and check which parts you want to adopt. #Search in the concerning source files for code you can adopt. #Start with the basic concept and add features later. (A Todo-List for the features would be nice.)

==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 <level> 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== *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".

== 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"?||
||setConfigValues||interface for menue - to set the config values; ConfigValues are stored in a log file||
||tick||this function is called whenever a new frame is rendered; dt is the value how much time has passed since the last frame||
}}}