The bug plug is a great feature is CS, you can easily debug your 3d world. You can use it in your own the same way, like any other plugin, you need it load and register.

+

The '''''bug plug''''' is a great feature in CS, to easily debug and tweak your 3d world. You can use it, like any other plugin. Just load and register it.

-

So start walktest, the castle map will be perfecto our lessons. When walktest loads everything

+

First start '''walktest''' for this example, because the castle map will be perfect for this lesson. When walktest has loaded completly, type into the walktest console:

-

,type it into the walktest console:

+

Line 15:

Line 14:

This will load the bug plugin.

This will load the bug plugin.

-

+

-

When bug plug is loaded, we’re ready to use it.

+

If you want to use '''''bug plug''''' in your own applications you can use -plugin=bugplug on the commandline.

Line 22:

Line 21:

-

The bug plug is in action, when you see the current fps down on the screen:

+

The bug plug is in action, when you can see the current fps (frames per second) on the lower left side of screen:

[[Image:bugplug.jpg]]

[[Image:bugplug.jpg]]

-

But bug plug can do more.

+

But, bug plug can do more than just displaying the actual framerate.

-

First, you have to press the ''ctrl+D'' keys, and you will see this message:

+

Press the ''ctrl+D'' keys, to see this message:

[[Image:pressbugplugkey.jpg]]

[[Image:pressbugplugkey.jpg]]

-

Now push ‘e’ key, and you will see something like this:

+

Now push ‘e’ key on your keyboard, to switch to the wireframe mode:

[[Image:wireframe.jpg]]

[[Image:wireframe.jpg]]

Line 38:

Line 37:

So the bug plug shows you the wireframe of the rendered meshes. Nice.

So the bug plug shows you the wireframe of the rendered meshes. Nice.

-

You can always take a screenshot when press ''ctrl+D'', and ''F11''. The bug plug saves the screenshot in png format into your ''CS'' directory (by default, this can be changed) . The first image will be named ''crystalspace000.png'', then ''crystalspace001.png'' etc. The plugin handles the correct numbering automatically, so be not afraid, you never rewrite your previously saved screenshots. When you need a really high resolution screenshot (an “überscreenshot”), press ''ctrl+D'' then ''shift+F11''. It will make a 2048*1536 screenshot, I hope, this satisfy your needs.

+

At any time, you can take a screenshot with the key combinations: ''ctrl+D'', and ''F11''. The bug plug saves the screenshot in png format into your ''CS'' directory (by default, this can be changed) . The first image will be named ''crystalspace000.png'', then ''crystalspace001.png'' and so on. The plugin handles the correct numbering automatically, so be not afraid, you never overwrite your previously saved screenshots. When you need a really high resolution screenshot (an “überscreenshot”), press ''ctrl+D'' then ''shift+F11''. It will make a 2048*1536 screenshot, I hope, this will satisfy your needs.

== Working with meshes ==

== Working with meshes ==

-

When you press ''ctrl+s'', you can select meshes with mouse click. Just try it, press ''ctrls+s'', and click on a simphatic mesh. The result will be something like this:

+

When you press ''ctrl+s'', you can select meshes with mouse click. Just try it now. Press ''ctrls+s'', and click on a simphatic mesh. The result will be something like this:

[[Image:meshselect.jpg]]

[[Image:meshselect.jpg]]

Line 55:

Line 54:

[[Image:table1.jpg]]

[[Image:table1.jpg]]

-

Now press ''ctrl+s'', and click on the table. The result will be something, like this:

+

Now press ''ctrl+s'', and click on the table. The result should look like this:

[[Image:table2.jpg]]

[[Image:table2.jpg]]

-

Now we can move this mesh with some bug plug key. Press ''ctrl+D'', then ''shift+Page up'' keys. The mesh will move 1 unit in Z direction (Z coordinate will be greater by one).

+

Now we can '''move''' this mesh with some bug plug key. Press ''ctrl+D'', then ''shift+Page up'' keys. The mesh will move 1 unit in Z direction (Z coordinate will be increased by one unit).

[[Image:table3.jpg]]

[[Image:table3.jpg]]

Line 87:

Line 86:

To undo hide, press ''shift+h'' after ''ctrl+D''.

To undo hide, press ''shift+h'' after ''ctrl+D''.

-

Now go right to the flaming torches:

+

Now go right to the burning torches:

[[Image:table6.jpg]]

[[Image:table6.jpg]]

-

Press ''ctrl+S'', then click on the torch. The result will be something, like this:

+

Press ''ctrl+S'', then click on the torch on the wall.

[[Image:torch1.jpg]]

[[Image:torch1.jpg]]

-

See around, you will see, you selected a great box, that includes four torches. Now when you press ''ctrl+D'', then ''ctrl+alt+C'', you will see the colliding triangles:

+

Look around, and you will see, you selected a great box, that includes four torches. Now when you press ''ctrl+D'', then ''ctrl+alt+C'', you will see the colliding triangles:

[[Image:torch2.jpg]]

[[Image:torch2.jpg]]

Line 104:

Line 103:

Bug plug can you show any sector with another colour.

Bug plug can you show any sector with another colour.

-

Press ''ctrl+D'', then ''ctrl+shift+C'', and you will see something, like this (the shot was taken form a point, where three sector is visible):

+

Press ''ctrl+D'', then ''ctrl+shift+C'', to get a result like this. (the shot was taken form a point, where three sectors are visible):

-

+

[[Image:colouredsectors.jpg]]

[[Image:colouredsectors.jpg]]

-

You can edit the camera field of view value. Press f key, then type a new value.

+

You can edit the camera field of view value. Press the ''f'' key, then type in a new value.

[[Image:fov.jpg]]

[[Image:fov.jpg]]

Line 117:

Line 115:

== Configuring bug plug ==

== Configuring bug plug ==

-

Bug plug has two configuration file in the CS/data/config directory. The ''bugplug.cfg'' contents the following lines:

+

Bug plug has two configuration files in the CS/data/config directory. The ''bugplug.cfg'' has the following contents:

-

+

<pre>

-

; file, where the key bindings are stored

+

; file, where the key bindings are stored

Bugplug.Keybindings = /config/bugplug.key

Bugplug.Keybindings = /config/bugplug.key

-

+

; format of the screenshot filename

-

; format of the screenshot filename

+

; the rightmost string of digits is automatically replaced with a number

-

+

-

; the rightmost string of digits is automatically replaced with a number

+

-

+

Bugplug.Capture.FilenameFormat = /this/crystal000.png

Bugplug.Capture.FilenameFormat = /this/crystal000.png

-

+

; MIME type of the screenshot image to save

-

; MIME type of the screenshot image to save

+

-

+

Bugplug.Capture.Image.MIME = image/png

Bugplug.Capture.Image.MIME = image/png

-

+

; image saver options for the screenshot file

-

; image saver options for the screenshot file

+

Bugplug.Capture.Image.Options = progressive

Bugplug.Capture.Image.Options = progressive

-

+

</pre>

-

The ''Bugplug.Capture.FilenameFormat'' key gives the format of the screenshot picture names. When you add the scrshot000.png format, the bug plug will saves your screenshots with this naming form (scrshot000,png, scrshot001.png) . The Bugplug.Capture.Image.MIME = image/png key stores the format of the screenshots. You can change it az any image format, that Crystal Space can handle (jpg, tga, bmp, etc).

+

The ''Bugplug.Capture.FilenameFormat'' key gives the format of the screenshot picture names. When you add the scrshot000.png format, the bug plug will save your screenshots with this naming form (scrshot000,png, scrshot001.png) . The Bugplug.Capture.Image.MIME = image/png key stores the format of the screenshots. You can change it to any image format, that Crystal Space can handle (jpg, tga, bmp, etc).

-

+

-

The second config file has the name bugplug.key. There is a simple text file, here is the content:

+

+

The second config file has the name bugplug.key. It is a simple text file, which has this (default) content:

+

+

<pre>

ctrl-d=debugenter

ctrl-d=debugenter

-

ctrl-s=mouseenter

ctrl-s=mouseenter

-

d=dumpeng

d=dumpeng

-

shift-d=dumpsec

shift-d=dumpsec

-

e=edges

e=edges

-

c=clear

c=clear

ctrl-shift-c=colorsectors

ctrl-shift-c=colorsectors

-

alt-c=cacheclear

alt-c=cacheclear

-

alt-d=cachedump

alt-d=cachedump

t=texture

t=texture

-

l=lighting

l=lighting

-

shift-g=gouraud

shift-g=gouraud

-

shift-m=mmx

shift-m=mmx

-

shift-t=transp

shift-t=transp

-

ctrl-b=bilinear

ctrl-b=bilinear

-

ctrl-t=trilinear

ctrl-t=trilinear

-

ctrl-l=ilace

ctrl-l=ilace

-

m=mipmap

m=mipmap

-

shift-i=inter

shift-i=inter

-

g=gamma

g=gamma

-

alt-b=dblbuff

alt-b=dblbuff

-

shift-c=dumpcam

shift-c=dumpcam

-

f=fov

f=fov

-

shift-f=fovangle

shift-f=fovangle

-

alt-t=terrvis

alt-t=terrvis

-

b=meshbbox

b=meshbbox

-

r=meshrad

r=meshrad

-

ctrl-alt-c=meshcd

ctrl-alt-c=meshcd

-

ctrl-alt-v=meshvis

ctrl-alt-v=meshvis

-

ctrl-alt-s=meshshad

ctrl-alt-s=meshshad

-

ctrl-alt-b=meshbase

ctrl-alt-b=meshbase

-

ctrl-g=debuggraph

ctrl-g=debuggraph

-

ctrl-c=enginecmd toggle_cullstat

ctrl-c=enginecmd toggle_cullstat

-

shift-e=enginestate

shift-e=enginestate

-

v=visculview

v=visculview

-

shift-v=visculcmd cycle_view

shift-v=visculcmd cycle_view

-

ctrl-v=visculcmd clear_stats

ctrl-v=visculcmd clear_stats

-

alt-v=visculcmd dump_state

alt-v=visculcmd dump_state

-

alt-a=visculcmd analyze_vis

alt-a=visculcmd analyze_vis

-

1=visculcmd toggle_frustum

1=visculcmd toggle_frustum

-

2=visculcmd toggle_coverage

2=visculcmd toggle_coverage

-

3=visculcmd toggle_history

3=visculcmd toggle_history

-

4=visculcmd toggle_queue

4=visculcmd toggle_queue

-

5=visculcmd toggle_vpt

5=visculcmd toggle_vpt

-

6=visculcmd toggle_ignoresmall

6=visculcmd toggle_ignoresmall

-

7=visculcmd toggle_clampoccluder

7=visculcmd toggle_clampoccluder

-

8=visculcmd toggle_splatting

8=visculcmd toggle_splatting

-

9=visculcmd toggle_invertedclipper

9=visculcmd toggle_invertedclipper

-

0=visculcmd toggle_ignorebadoccluder

0=visculcmd toggle_ignorebadoccluder

-

shift-1=visculcmd origin_z --

shift-1=visculcmd origin_z --

-

shift-2=visculcmd origin_z ++

shift-2=visculcmd origin_z ++

-

shift-3=visculcmd setup_debugsector

shift-3=visculcmd setup_debugsector

-

shift-4=visculcmd navigate_child1

shift-4=visculcmd navigate_child1

-

shift-5=visculcmd navigate_child2

shift-5=visculcmd navigate_child2

-

shift-6=visculcmd navigate_parent

shift-6=visculcmd navigate_parent

-

shift-s=debugsector

shift-s=debugsector

-

shift-up=mesh_yplus

shift-up=mesh_yplus

-

shift-down=mesh_ymin

shift-down=mesh_ymin

-

shift-left=mesh_xmin

shift-left=mesh_xmin

-

shift-right=mesh_xplus

shift-right=mesh_xplus

-

shift-pgup=mesh_zplus

shift-pgup=mesh_zplus

-

shift-pgdn=mesh_zmin

shift-pgdn=mesh_zmin

-

up=ds_forward

up=ds_forward

-

down=ds_backward

down=ds_backward

-

left=ds_turnleft

left=ds_turnleft

-

right=ds_turnright

right=ds_turnright

-

alt-up=ds_up

alt-up=ds_up

-

alt-down=ds_down

alt-down=ds_down

-

alt-left=ds_left

alt-left=ds_left

-

alt-right=ds_right

alt-right=ds_right

-

alt-s=debugview

alt-s=debugview

-

s=visculcmd setup_debugview

s=visculcmd setup_debugview

-

alt-f=visculcmd toggle_freeze

alt-f=visculcmd toggle_freeze

-

ctrl-f=visculcmd exact_freeze

ctrl-f=visculcmd exact_freeze

-

f10=savemap

f10=savemap

-

ctrl-f10=savemap

ctrl-f10=savemap

-

f11=scrshot

f11=scrshot

-

ctrl-f11=scrshot

ctrl-f11=scrshot

-

shift-f11=uberscreenshot

shift-f11=uberscreenshot

-

f12=scrshot

f12=scrshot

-

ctrl-f12=scrshot

ctrl-f12=scrshot

-

ctrl-alt-p=fps

ctrl-alt-p=fps

-

h=hideselected

h=hideselected

-

shift-h=undohide

shift-h=undohide

-

ctrl-p=counterreset

ctrl-p=counterreset

-

alt-p=counterremove

alt-p=counterremove

-

shift-p=counterfreeze

shift-p=counterfreeze

-

w=shadowdebug

w=shadowdebug

-

alt-u=unprepare

alt-u=unprepare

-

ctrl-m=memorydump

ctrl-m=memorydump

-

p=profdump

p=profdump

-

ctrl-shift-p=profreset

ctrl-shift-p=profreset

-

ctrl-shift-s=debugcmd iGraphics3D dump_slms

ctrl-shift-s=debugcmd iGraphics3D dump_slms

-

ctrl-shift-v=debugcmd iGraphics3D dump_vbostat

ctrl-shift-v=debugcmd iGraphics3D dump_vbostat

-

ctrl-shift-f=debugcmd iGraphics2D dump_fontcache

ctrl-shift-f=debugcmd iGraphics2D dump_fontcache

-

ctrl-shift-z=debugcmd iGraphics3D dump_zbuf

ctrl-shift-z=debugcmd iGraphics3D dump_zbuf

-

ctrl-shift-1=switchculler crystalspace.culling.frustvis

ctrl-shift-1=switchculler crystalspace.culling.frustvis

-

ctrl-shift-2=switchculler crystalspace.culling.dynavis

ctrl-shift-2=switchculler crystalspace.culling.dynavis

-

ctrl-alt-m=selectmesh

ctrl-alt-m=selectmesh

-

ctrl-alt-o=onesector

ctrl-alt-o=onesector

-

ctrl-alt-l=listplugins

ctrl-alt-l=listplugins

+

</pre>

So you can change the key bindings of the debug commands here.

So you can change the key bindings of the debug commands here.

-

I hope, this short introduction help you to understand the basics of the usage of bug plug. Just press ''ctrl+D'', and enjoy it.

+

I hope, this short introduction will help you to understand the basics of the usage of bug plug. Just press ''ctrl+D'', and enjoy...

Current revision

Contents

Using bug plug

The bug plug is a great feature in CS, to easily debug and tweak your 3d world. You can use it, like any other plugin. Just load and register it.

First start walktest for this example, because the castle map will be perfect for this lesson. When walktest has loaded completly, type into the walktest console:

bugplug

This will load the bug plugin.

If you want to use bug plug in your own applications you can use -plugin=bugplug on the commandline.

How it works

The bug plug is in action, when you can see the current fps (frames per second) on the lower left side of screen:

But, bug plug can do more than just displaying the actual framerate.
Press the ctrl+D keys, to see this message:

Now push ‘e’ key on your keyboard, to switch to the wireframe mode:

So the bug plug shows you the wireframe of the rendered meshes. Nice.

At any time, you can take a screenshot with the key combinations: ctrl+D, and F11. The bug plug saves the screenshot in png format into your CS directory (by default, this can be changed) . The first image will be named crystalspace000.png, then crystalspace001.png and so on. The plugin handles the correct numbering automatically, so be not afraid, you never overwrite your previously saved screenshots. When you need a really high resolution screenshot (an “überscreenshot”), press ctrl+D then shift+F11. It will make a 2048*1536 screenshot, I hope, this will satisfy your needs.

Working with meshes

When you press ctrl+s, you can select meshes with mouse click. Just try it now. Press ctrls+s, and click on a simphatic mesh. The result will be something like this:

You can select any mesh in the loaded map file.
The following example uses the castle map. Run walktest, then do the following:

Go to the table in the castle level:

Now press ctrl+s, and click on the table. The result should look like this:

Now we can move this mesh with some bug plug key. Press ctrl+D, then shift+Page up keys. The mesh will move 1 unit in Z direction (Z coordinate will be increased by one unit).

The Bugplug.Capture.FilenameFormat key gives the format of the screenshot picture names. When you add the scrshot000.png format, the bug plug will save your screenshots with this naming form (scrshot000,png, scrshot001.png) . The Bugplug.Capture.Image.MIME = image/png key stores the format of the screenshots. You can change it to any image format, that Crystal Space can handle (jpg, tga, bmp, etc).

The second config file has the name bugplug.key. It is a simple text file, which has this (default) content: