User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cppdev:startnewgame [2012-10-31 23:00]
Carsten completed the text
cppdev:startnewgame [2013-01-07 12:07] (current)
Line 1: Line 1:
-====== Starting your own Game or Application ​======+====== Starting your own Game ======
  
 After you took [[cppdev:​gettingstarted|the first steps with the Cafu source code]], you're ready to use it to develop your own game or application. After you took [[cppdev:​gettingstarted|the first steps with the Cafu source code]], you're ready to use it to develop your own game or application.
Line 6: Line 6:
  
  
-===== Working directly with DeathMatch =====+===== Cloning ​DeathMatch =====
  
-Modifying the DeathMatch game "in situ" may seem like a totally silly /​*off-putting,​ ridiculous*/​ idea, but in some cases it can be a worthwhile consideration nevertheless:​ +The "​normal"​ and recommended way to start a new game is to create a copy of the example game DeathMatch under a different name. This is useful because it immediately provides you with the proper directory structure, working code, and example files.
- +
-If you want to quickly try something out (e.g. a new entity class), or if you work on something that is not directly or entirely a completely new game (for example, any changes to the core engine), the game DeathMatch might be a welcome testbed. +
- +
-Also, if you wish to communicate and collaborate with people who are not directly involved with your game code, the DeathMatch code can be a good common ground. +
- +
- +
-===== Using DeathMatch as a basis ===== +
- +
-The "​normal"​ and recommended way to start a new game is to create a copy or clone of the example game DeathMatch under a different name. This is useful because it immediately provides you with the proper directory structure, working code, and example files.+
  
 ==== Creating the clone ==== ==== Creating the clone ====
Line 23: Line 14:
 Creating the copy is straightforward:​ Creating the copy is straightforward:​
  
-  - In ''​Games'',​ duplicate the directory ''​DeathMatch''​ and rename ​the resulting copy as desired, e.g. ''​MyGame''​.+  - In ''​Games'',​ duplicate the directory ''​DeathMatch''​ and name the resulting copy as desired, e.g. ''​MyGame''​.
   - Delete the directory ''​build''​ in ''​Games/​MyGame/​Code''​.   - Delete the directory ''​build''​ in ''​Games/​MyGame/​Code''​.
  
Line 38: Line 29:
 Technically,​ the above steps are all that is required to create the basis for your new game: Technically,​ the above steps are all that is required to create the basis for your new game:
  
-  * When you re-run ​''​scons'' ​as documented at [[cppdev:​gettingstarted]],​ the code of your new game will automatically be picked up, compiled and linked.+  * When you re-run ​SCons as documented at [[cppdev:​gettingstarted]],​ the code of your new game will automatically be picked up, compiled and linked.
   * When you start CaWE, it will automatically recognize the new game and show it in the "​Configure",​ "New Map", "New GUI", ... etc. dialogs. If "Start Engine"​ is checked in the "​Compile"​ menu, it will also start the Cafu Engine with the new game.   * When you start CaWE, it will automatically recognize the new game and show it in the "​Configure",​ "New Map", "New GUI", ... etc. dialogs. If "Start Engine"​ is checked in the "​Compile"​ menu, it will also start the Cafu Engine with the new game.
-  * If you run the Cafu Engine from the command prompt, make sure to add parameter <​code>​-svGame MyGame</​code>​to the command-line, and see below how to get rid of it again.+  * If you run the Cafu Engine from the command prompt, make sure to add parameter <​code>​-svGame MyGame</​code>​to the command-line ​(see below how to get rid of it again).
  
 ==== Tips and Tricks ==== ==== Tips and Tricks ====
  
-  * If you want to run ''​MyGame'' ​by default (without ''​-svGame''​),​ see the section about the variable ''​GameLibs''​ in file ''​CompilerSetup.py'':<​code python>+  * If you want to run your game by default (without ''​-svGame''​),​ see the section about the variable ''​GameLibs''​ in file ''​CompilerSetup.py'':<​code python>
 # When you're developing your own game, you might want to keep game DeathMatch # When you're developing your own game, you might want to keep game DeathMatch
 # for reference. Cafu should run your game by default (first in list), whereas # for reference. Cafu should run your game by default (first in list), whereas
 # DeathMatch would be readily available via the -svGame command-line option: # DeathMatch would be readily available via the -svGame command-line option:
 GameLibs = ["​MyGame",​ "​DeathMatch"​] GameLibs = ["​MyGame",​ "​DeathMatch"​]
-</​code>​ Note that you have to re-run ​''​scons'' ​in order to changes take effect.+</​code>​ Note that you have to re-run ​SCons in order for changes ​to take effect.
   * In ''​MyGame'',​ some paths in the code and scripts still point to ''​Games/​DeathMatch/​...''​. For the beginning, that's ok -- your game will find some of its resources in game DeathMatch, and you can update these occurrences step by step at any later time (or even intentionally keep things like this).   * In ''​MyGame'',​ some paths in the code and scripts still point to ''​Games/​DeathMatch/​...''​. For the beginning, that's ok -- your game will find some of its resources in game DeathMatch, and you can update these occurrences step by step at any later time (or even intentionally keep things like this).
-  * Last but not least, check out [[cppdev:​gamecodeoverview]] for details about the files and subdirectories in the game directory.+  * Check out [[cppdev:​gamecodeoverview]] for details about the files and subdirectories in the new game directory.
  
  
-===== Things not to do =====+===== Alternatives ​=====
  
-Here is a list of possible ​courses of action that we suggest //​not// ​to use in order to start a new game:+Here is a list of alternative ​courses of action that you may want to consider ​in order to start a new game: 
 + 
 +==== Modifying DeathMatch ==== 
 + 
 +Working directly with the DeathMatch game "in situ" may seem like a totally silly /​*off-putting,​ ridiculous*/​ idea to you, but in some cases it can be a worthwhile consideration nevertheless:​ 
 + 
 +If you want to quickly try something out (e.g. a new entity class), or if you work on something that is not directly or entirely a completely new game (for example, any changes to the core engine), the game DeathMatch might be a welcome testbed. 
 + 
 +Also, if you wish to communicate and collaborate with people who are not directly involved with your game code, the DeathMatch code can be a good common ground.
  
 ==== Renaming DeathMatch ==== ==== Renaming DeathMatch ====
  
 Renaming DeathMatch, instead of properly copying it, would principally work, if it was not for these factors: Renaming DeathMatch, instead of properly copying it, would principally work, if it was not for these factors:
-  ​* It does not agree well with version control systems (Git or Subversion). If you follow our recommendation to checkout the Cafu source code from our Git or Subversion ​repositories, so that you can keep track of our latest developments while developing your own game in parallel, then renaming the DeathMatch directory is (indeed not impossible, but) somewhat incompatible with the way how these repositories work.+ 
 +  ​* It does not agree well with version control systems (Git or Subversion). If you follow our recommendation to checkout the Cafu source code from our Git or Subversion ​repository, so that you can keep track of our latest developments while developing your own game in parallel, then renaming the DeathMatch directory is (indeed not impossible, but) somewhat incompatible with the way how these repositories work.
   * Some file paths in code and scripts still point to ''​Games/​DeathMatch/​...''​. If you rename DeathMatch, all these paths are broken, and your game will not work without fixing them first. If you instead copy DeathMatch, your game will find some of its resources in game DeathMatch, and you can update these occurrences step by step at any later time (or even intentionally keep things like this).   * Some file paths in code and scripts still point to ''​Games/​DeathMatch/​...''​. If you rename DeathMatch, all these paths are broken, and your game will not work without fixing them first. If you instead copy DeathMatch, your game will find some of its resources in game DeathMatch, and you can update these occurrences step by step at any later time (or even intentionally keep things like this).
  
-==== Start from scratch ====+Overall, we recommend //not// to rename DeathMatch. Better clone it as explained above. 
 + 
 +==== Starting ​from scratch ====
  
 Creating a new, empty directory in ''​Games/''​ in order to start from scratch, then fill it with contents as required, is certainly possible. Creating a new, empty directory in ''​Games/''​ in order to start from scratch, then fill it with contents as required, is certainly possible.
Line 77: Line 79:
   * be prepared to copy pieces of DeathMatch example code anyway.   * be prepared to copy pieces of DeathMatch example code anyway.
  
-==== Use VSWM ====+==== Using VSWM ====
  
 The VSWM MOD is old, obsolete, dysfunctional,​ and a candidate for removal. The VSWM MOD is old, obsolete, dysfunctional,​ and a candidate for removal.
-Not a basis for a new game.+Not a good basis for a new game. Don't use it.
  
cppdev/startnewgame.1351720807.txt.gz · Last modified: 2013-01-07 12:07 (external edit)