Getting Started With the Crystal Space SDK

At this stage becoming familiar with the Crystal Space engine, the IDE and Compiler, and the C++ language are the first priorities. Setting things in stone, so to speak making a program too unchangeable, is a big mistake if done too early on before one is familiar with the program.

Generally an IDE,an integrated development environment, should be used in any project with a large workload. In most IDEs the first step is to make a project and add the main source files, often just one .cpp file and one .h file. Next the compiler needs to know where any additional files are stored. Following Crystal Space's documentation one can see that the include paths usually need to be set (CS/include) and also a library include path. Libraries must be included in the "linker flags" and they must be in the right order, possibly having the directive to preserve their order.

Then it can be good to do a genera test of any or all features that you plan on using from Crystal Space, or any engine. Go through the API reference and the manual and see the examples and find out what is needed.

Graphics : Halos, Factories, Meshes

Crystal Space's graphics functions are pretty complete. The particle emitters and halos can make a lot of effects really easily (from the map file for example). The most notable feature may be the lightmap lighting. This feature draws shadows and shades the faces based on the lights using the "relight" command. The downside is that moving lights and animated meshes won't fit into this scheme.

Crystal Space Images Gallery

Faded Earth's main moving animations will be based on the 2D halo, or billboard, feature of Crystal Space The point of having a separate 2d graphical function for this is to allow the plane holding the image to sit in 3D space, getting smaller and larger depending on distance and so on, and at the same time always face the camera. In fact this may not even be needed, the camera may always point at it in any game you set up, but there are a few cases where it might cause problems if not implemented in this way.

Now that we've learned a little about Crystal Space and done some preliminary planning we can start sketching out how the game will be organized.

 

Bloobshed Dev C++ Crystal Space tutorial :
  - Originally posed on crystal space help message board

Here's a tutorial I typed up rather quickly, feel free to point out better ways to do things or errors.

Crystal Space applications using Bloodshed Dev C++

This is a quick tutorial on using Dev C++ to compile a crystal space application, in this case simple1, a tutorial that comes with crystal space. The crystal space source code should already be compiled before you try this. Use this at your own risk, I have very little experience with CS and don't know if this method works with anything except what I describe.


Setup Dev C++ for WINDOWS

Open Dev C++ and check the compiler options, make sure it has MinGW selected, and all the proper MinGW paths. Everything in settings can be set in NO.



Make a new project. Save it in a directory where you want executables to be created.

Find Simple 1 in \CS\apps\tutorial.

Add simple1.h and simple1.cpp to your project.

These files "#include" other files from the CS/include directory, do not add them.

Go to project options in DEV CPP, top right icon.

First select win32 GUI in project options General.

Go to directories, include directories, browse to the CS/include directory, make sure you click add.


Next is the tough question of the libraries, I don't know if there is a standard way to do it, but I went to :

C:\work\CS\out\msysx86\optimize\libs

went into the folders and copied these files into one directory:
libcsutil.a
libcsgeom.a
libcsgfx.a
libcstool.a
libcsws.a

I made that directory an include path in Project Options - Library Directories

You should now have one path for Library Directories and one for Include Directories.

Go to project options, Parameters, and find the Linker text Box, enter
-lcstool
-lcsutil
-lcsgeom
-lcsgfx
-lcsws

Note the order is different than described in the documentation, I cannot explain why, but this order works for this tutorial, others may not.
If you have trouble this is also a possible working combination, the last command is supposed to keep the libs in the order they are entered...

-lcstool
-lcsws
-lcsutil
-lcsgfx
-lcsgeom

--preserve-dup-deps


Once that is entered you may be ready to compile the project. Set any other options you like like version information.

If you compile and there are no errors you should be able to run the exe and see a brick wall. If the path to the wall pattern is wrong however it may not show it...

There is a crystal space environmental variable that I have set, I do not know if
it is required.