User Tools

Site Tools


This is an old revision of the document!


Starting your own Game or Application

FIXME THIS TEXT IS WORK-IN-PROGRESS, I'll finish it soon! — Carsten 2012-10-31 12:03

After you took the first steps with the Cafu source code, you're ready to use Cafu to develop your own game or application project.

There are many good ways to work with Cafu. This section lists the most commonly used, and the required steps to give you a good start.

Overview

Cafu is designed to make the development of new games and applications easy. It separates the core engine (the technical framework that is the common basis for each game or app) from the program code and the resources for each game.

MODs, like plug-ins / ardchitectute multiple at the same time Games/ each mod can be game or application

not stop from modifyin the core engine

Working with DeathMatch

Working with the DeathMatch example game as-is may seem totally off-putting to you, but in some cases it might 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.

Copying DeathMatch

The “normal” and recommended way to start a new game is to create a copy of our example game DeathMatch. This is useful because it immediately provides you with the proper directory structure, working code, and example files.

Copy the directory

Change into the Games/ directory and to create a duplicate of the DeathMatch/ directory there. Name the duplicated directory by the name of your game, e.g. MyGame/.

$ cp -r Games/DeathMatch/ Games/MyGame/

Delete leftover build files

If you have built game DeathMatch before, it's a good idea to prevent leftover files from interfering with your new game by deleting directory build in Games/MyGame/Code.

$ rm -rf Games/MyGame/Code/build
  1. When you then re-run scons as documented at Getting Started with the Cafu Source Code, the code of your new game will automatically be picked up, compiled and linked.
  2. If you run the Cafu engine from the command prompt, make sure to add parameter
    -svGame MyGame
  3. 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.
  4. Also see Game Development Overview for details about the game directory.

You may wish to update all internal paths that still point into the “DeathMatch” directory from Games/DeathMatch/ to Games/MyNewGame/. Under Linux, you can do it automatically like this:

$ find Games/GameName -type f -exec sed -i 's/DeathMatch/GameName/g' {} \;

Things not to do

Here is a list of possible courses of action that we suggest not to use in order to start a new game:

Renaming DeathMatch

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.
  • Many 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

Creating a new, empty directory in Games/ in order to start from scratch, then fill it with contents as required, is certainly possible.

Doing this can be a very good choice if your main goal is to learn and understand the technical details from the ground up, or if you only want to have original content in your game right from the start.

In fact, we're considering complementing the DeathMatch example game with another “Minimal” example game that comes closer to these goals.

If you start with an empty directory,

  • your progress will be slower,
  • despite the support forums are always available, you should be technically versed enough to cope with most problems and errors,
  • be prepared to copy pieces of DeathMatch example code anyway.

Use VSWM

The VSWM MOD is old, obsolete, dysfunctional, and a candidate for removal. Not a basis for a new game.

cppdev/startnewgame.1351686453.txt.gz · Last modified: 2013-01-07 12:07 (external edit)