# Various new features - unused data analysis, more ways to set sound priority, comfortable TCastleComponentFactory, control quality of spheres/cones etc., "Copy URL" in editor, more

**URL:** https://forum.castle-engine.io/t/various-new-features-unused-data-analysis-more-ways-to-set-sound-priority-comfortable-tcastlecomponentfactory-control-quality-of-spheres-cones-etc-copy-url-in-editor-more/1377
**Category:** News
**Created:** [October 4, 2024, 10:57am UTC](https://forum.castle-engine.io/t/various-new-features-unused-data-analysis-more-ways-to-set-sound-priority-comfortable-tcastlecomponentfactory-control-quality-of-spheres-cones-etc-copy-url-in-editor-more/1377 "2024-10-04T10:57:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [October 4, 2024, 10:57am UTC](https://forum.castle-engine.io/t/various-new-features-unused-data-analysis-more-ways-to-set-sound-priority-comfortable-tcastlecomponentfactory-control-quality-of-spheres-cones-etc-copy-url-in-editor-more/1377/1 "2024-10-04T10:57:37Z")

</div>

| [![Cthulhu Free 3D Printable Miniature - from https://sketchfab.com/3d-models/cthulhu-free-3d-printable-miniature-f91243fac5ac48578844dd3b588bd434 , by TheSurrealFactory](https://forum.castle-engine.io/uploads/default/original/2X/4/43469484b8f3709b77150dcf363dcbfdab1cd5fa.png)](https://castle-engine.io/wp/wp-content/uploads/2024/10/cthulhu_miniature.png "Cthulhu Free 3D Printable Miniature - from https://sketchfab.com/3d-models/cthulhu-free-3d-printable-miniature-f91243fac5ac48578844dd3b588bd434 , by TheSurrealFactory") |
| [![Posted from &quot;Unholy Society&quot; by Paweł Wojciechowicz from Cat-astrophe Games](https://forum.castle-engine.io/uploads/default/original/2X/b/b61ef760c030a345c986d494bb1882105a98aebe.jpeg)](https://castle-engine.io/wp/wp-content/uploads/2018/05/large_poster2_cthulu2.jpg "Posted from &quot;Unholy Society&quot; by Paweł Wojciechowicz from Cat-astrophe Games") |
| [![Flying Cthulhu from Sketchfab https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons](https://forum.castle-engine.io/uploads/default/original/2X/0/0ad3be5a44c023275919d5ac539176094c335e25.png)](https://castle-engine.io/wp/wp-content/uploads/2024/08/cthulhu.png "Flying Cthulhu from Sketchfab https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons") |
| [![Cthulhu model from https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons](https://forum.castle-engine.io/uploads/default/original/2X/d/d0fc2e53ffbed08ab377ebf133b375f346965ff1.png)](https://castle-engine.io/wp/wp-content/uploads/2023/05/cthulhu_view3dscene.png "Cthulhu model from https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons") |
| [![Water surrounded by Cthulhu statuettes, from Lynch gamejam game](https://forum.castle-engine.io/uploads/default/original/2X/5/5ddef16fb094d722015f1f18e2c48f105428d63a.png)](https://castle-engine.io/wp/wp-content/uploads/2024/09/water_fix.png "Water surrounded by Cthulhu statuettes, from Lynch gamejam game") |

_Cthulhu fhtagn!_ This news post contains a collection of Cthulhu renderings I posted in recent years — it turns out I post quite a lot of Cthulhu stuff. Usually, when I don’t have a perfect screenshot to illustrate a news post, I just pick something pretty rendered using our engine — it turns out that often this _“something pretty”_ is Cthulhu for me 🙂

Completely unrelated to the screenshots, here are a few new features we’ve added to the engine lately. And if you like what we do [please support us on Patreon](https://www.patreon.com/castleengine)!

1. Our command-line [build tool](https://castle-engine.io/build_tool) has a new option [unused-data](https://castle-engine.io/build_tool#_unused_data) to perform a _crude_ analysis of what data in your project is _possibly_ unused.

This means that some files inside the [data subdirectory of the project](https://castle-engine.io/data) have been detected as unused, so they don’t seem to be loaded by code or required by other data files. This means that keeping them inside the `data` subdirectory is possibly needless. Files inside the `data` subdirectory (that are not excluded by the [CastleEngineManifest.xml](https://castle-engine.io/project_manifest) rules) are automatically packaged with your application (for example, if you create an Android APK, or a package to ZIP for desktop platforms). If you have some unnecessary files there, then possibly you distribute more than you need, and you could have a smaller application.

To test this use command-line to enter your project and just execute `castle-engine unused-data`.

I emphasize that this is _crude_ analysis. It uses some assumptions that may be wrong, definitely are sometimes wrong, and they may result in errors in both ways (some unnecessary files may be undetected; some detected files may actually be used). Don’t trust this analysis without your own judgement. But it may be useful in some clear cases, when there are easy and obvious ways to optimized your applications size. If some files are indeed unused, consider moving them outside of `data` (e.g. to subdirectory like `data-source`) or excluding packaging them by [CastleEngineManifest.xml](https://castle-engine.io/project_manifest) rules, or even removing them (you have them in version control anyway, right?).

This mechanism allowed to make CGE download size smaller by 30 MB recently 🙂 So yes, it is practically useful (albeit not magic, savings are not that big).

2. The `Priority` of a sound can be now configured on `TCastleSoundSource` and `TCastlePlayingSound` (in addition to being configurable on `TCastleSound`, as before). See the `TCastleSoundSource.Priority`, `TCastlePlayingSound.Priority`, `TCastleSound.Priority` properties. They are all multiplied, just like `Volume` and `Pitch` — see [manual about sound](https://castle-engine.io/sound) for usage description. Thanks go to [Dennis Spreen](https://github.com/Dennis1000) for implementing this!

3. We have extended `TCastleComponentFactory.ComponentLoad` with a powerful optional mechanism: if you pass an additional instance of any class descending from `TPersistent`, we will set the published fields of that instance to refer to the new components created by `TCastleComponentFactory.ComponentLoad`.

4. We have added `ApplicationProperties.FreeDelayed` utility. As the name implies, it schedules removing a component soon. It’s a bit similar to `TCastleTransform.RemoveDelayed` with `FreeItem=true` (that also got [important fix](https://github.com/castle-engine/castle-engine/commit/2c2bbbb7d35a0692c744e1ecaaa1318b5293fdb0) by the way), but using `ApplicationProperties.FreeDelayed` is more straightforward in some cases: you don’t need another `TCastleTransform` to schedule freeing.

5. We expose a few properties to determine the quality of generated spheres, cylinders, cones:

6. _“Copy URL”_ command is now available in the [editor](https://castle-engine.io/editor) context menu when you right-click on a file in the bottom panel.

7. Slowly but surely we modernize our joysticks (gamepad) API. We have now separate `TJoystick.LeftAxis` and `TJoystick.RightAxis`. Test how they work in [examples/deprecated\_to\_upgrade/joystick](https://github.com/castle-engine/castle-engine/tree/master/examples/deprecated_to_upgrade/joystick) demo. See [our roadmap](https://castle-engine.io/roadmap#_in_progress_better_gamepads_joysticks_api) for joystick API plans.
