Cel Reference

From Blender2crystal

Jump to: navigation, search

Language : EnglishEspañolFrançais


Contents

[edit] Introduction

It is possible to generate worlds ready to be used with cel, and setting some properties related to entities and quests, as well as behaviours.

For exporting maps prepared for cel the celexport button in the export tab (Image:Icons-export.png) must be activated, then the exporter will also create a level.xml file, a entities file, and a world file. The export process is tailored for loading through a zonemanager entity, but the different files can be loaded independently (only world must be loaded prior to entities).

The most important property to take into account is the entity property. Setting this to true will export an entity to the "entities" file in addition to meshobjects and meshfactories that are normally output to the "world" file.

Next more important thing now is you need a player, usually you can set the player by setting the player property to true on some object, this will set pccommandinput and pcdefaultcamera on the entity, and will set it's name to camera (you should have no other entity with the name camera, and there should be no more than one player set).

Some property classes are automatically assigned to entities depending on assigned properties.

-pcmesh will be assigned to all objects that carry a mesh.

-pcmeshselect will be assigned to all objects that carry a mesh.

-pclight will be assigned to lights with entity property set.

-pclinmove can be assigned by using the pclinmove property.

-pctimer will be added with wakeup, wakeupnr and wakeupframe properties.

-pctrigger will be added with trigger_sphere, trigger_above and anchor properties.

-pcquest will be added when linking quests to entities using quest tab.

-pcmechsystem will be added to the sector depending on pcmechanics property in sectorsettings object.

-pcmechobject will be added to entities when dynamics property is set for the object.

-pcproperties will be added to entities when any pc properties are set.

Also some more property classes can be explicitly assigned to objects in the property class tab (Image:Icons-propclass.png)

(for adding other property classes use pcclass* properties.)

[edit] CEL types

there are some special types for cel, you can check them in the Object Type Reference

[edit] Scripting Support

Scripting is integrated in the exporting process.

Both the xml and python behaviour layers are supported (for the moment must choose one or the other in the world settings).

Both scripts and templates can be packed into the blend file for edition from blender or distribution, or unpacked into a directory for external edition.

Also scripts used in the world will be packed inside .zip file for distribution and running through standard celstart application.

Hitting RUN from blender2crystal will pack the necessary scripts and run your map in the correct way using celstart cel application and one of the provided main scripts (celstrap.py for blpython and celstrap.xml for blxml).

[edit] Manually running generated worlds

[edit] blpython apps

An python app is loaded as follows:

($CEL)/celstart /tmp/world.zip

this calls celstart app, which calls our main behaviour (must be in the path). Then the map is loaded and all other behaviours will be initialized.

Note that all behaviours, ie, python scripts must be located in the PYTHONPATH, this can be accomplished in several ways:

  • Putting all python files inside the .zip and setting PYTHONPATH to the full path of the zip file. Python will find the scripts, as it uses something akind to crystal space VFS.
  • Putting python files in a directory scripts/ right below the directory from where we launch the app, this is usually already in the PYTHONPATH and works.

[edit] blxml apps

An xml app is loaded as follows:

($CEL)/celstart /tmp/world.zip

this also calls the celstart app, which calls the cel blxml hardcoded behaviour bootstrap, which loads our world file using the specified xml file as main entrance.

[edit] Entity Mechanics

If the sector has a mechsys then a pcmechsystem entity will be created for the sector. also if the sector has a dynamicsystem (dynsys property set) it will be used for the mechanic system (so the mechanic system will control the dynamic system).

Gravity for a sector can be set through the gravity property also in sector settings.

The properties for bodies are the same as general physics properties in the exporter (mass, density, elasticity, friction, softness). The general rule is a pcmechobject propclass will be exported for entities with dynamics set to true. A pcmechsystem will also be created automatically if it has not been specified in sectorsettings.

also gravity and dynsys are used for entity physics.

[edit] Quests

Can be set in the quest (Image:Icons-quest2.png) tab.

This properties result in certain parameters being sent to entity quests

You can set several quests, and define variables for them.

[edit] Examples of use

Different effects can be attained by using the cel export mode. Some examples follow.

[edit] The player

There is two main ways to set the player:

1 - Set the player property on the object you want to be the player to true. Additionally you can give it the actor behaviour if you want to control it, and pclinmove if you don't want it to float in the air. This is the preferred way of setting the player.

2 - The player can be set by assigning the name camera and making sure it also has a pcdefaultcamera, this can be done using the pcdefaultcamera property or assigning the 'player.xml template. Also the notes about behaviour and pclinmove in method 1 apply to this method.

[edit] A moving platform

Moving objects exported can be exported directly from blender animations. Cycle can be used to make the animation cycle in extrapolation mode, this means first and last key of the ipo must be equal if the object is wanted to translate between several key points. entity and anchor must be set to true so that the platform will carry the player around.

[edit] Pickable objects

By applying the pickable.xml quest from the quest browser any object can be made pickable.

[edit] Non player characters

The template npc.xml is specially designed for non player characters and should be used. Also pclinmove must be set to true or the entity will float in the air. Usually also some behaviour will be defined so the entity will react to the environment.

[edit] Setting the globalselection entity

The globalselection.xml template is designed so by applying it to an empty object in blender it will make all objets draggable by clicking.

[edit] Slightly Outdated

[edit] Available Entity templates

[edit] globalselection.xml

an entity template that should be set to an empty object in blender. it will allow moving entities around with the mouse.

[edit] Available Quest templates

Undocumented quest templates are still experimental.

[edit] pickable.xml

a quest for objects that can be picked from the ground. it works just by setting it.

[edit] ProximityPickable.xml

a quest for objects that will be picked on approaching. it works just by setting it.

[edit] MovingPlatformAnchor.xml

a quest for objects that can carry the camera around. it is automatically assigned by using the anchor property as explained above

[edit] SlideDoor*

a quest for doors that open when the player comes near. this quest should be used in conjunction with trigger_sphere to the define the radius for opening the door. activate_move will also affect this quest.

[edit] SlideDoorLocked*

like the before quests for doors that open on approaching, but this variant only opens when the player is carrying the key entity specified with key property.

[edit] ButtonLight

A quest for a light that can be switched on and off. It is automatically assigned to lights with entity set to true.

[edit] ButtonSeq*

a quest for buttons that can activate sequences in quests from other objects. there are several flavours for this quest, to set direction for the button. activate_move, target, op_on, op_off are valid properties for this quest that can be set in blender (see above). The defaults are set so it will automatically switch lights when setting target to a light, but different effects can be attained by using the properties.

Don't forget target entities must also be entities (i.e. they must have the entity property set to True).

[edit] Available python behaviours

[edit] actor.py

A behaviour for a normal cel player. With support for camera change and standard keybindings.

[edit] actorball.py

A behaviour for the typical physics ball player that can be controlled by applying forces (this kind of player has been known to drive cars).

[edit] lookat.py

A simple behaviour for for an object that is constantly looking at the player entity. Not very useful but a simple example to grow upon.

[edit] Available python app entities

[edit] celstrap.py

Celstrap is at the moment the only application provided. It loads the map, gets the player and sets the camera. Also allows restarting the map and recording your session on video.

[edit] Available xml behaviours

[edit] actor.xml

A behaviour for a normal cel player. With support for camera change and standard keybindings.

[edit] Available xml app entities

[edit] celstrap.xml

Celstrap is at the moment the only application provided. It loads the map, gets the player and sets the camera.

Personal tools
Documentation