Anonymous Login
2018-12-15 13:57 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001501OpenClonkEngine - C4Scriptpublic2016-12-21 13:24
ReporterZapper 
Assigned ToMaikel 
PrioritylowSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target Version8.0Fixed in Versiongit master 
Summary0001501: Check for unused sounds automatically
DescriptionWe possibly have unused sounds. I don't really know, because how should I.

It would be good (as in: may either decrease the size of the release or increase the quality of the game) if we'd have a script that would check for every single sounds whether it is currently used ingame.

Problems:
* The sound "WoodHit1" might be used as "WoodHit*" or "WoodHit" or something like that.
* Sounds may be played as e.g. Sound(["Foo", "Bar"][Random(2)]).
* Sounds may be played from local variables.
* The engine also plays sounds.
* ActMap sounds: Sound = "FooBar"
* Schedule and ScheduleCall have an alternative syntax
Additional InformationI'll link the python script I used for moving the sounds into subfolders as per request of Maikel here. http://pastebin.com/Ubd0QJ61
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0004329

Maikel (developer)

Since my comments yesterday forced me into the sound work, I'll take this. It seems like a tedious though fun exercise.

~0004331

Sven2 (developer)

We can also just add hints to any scripts that use Sound() in a more complicated manner. E.g. write:
Sound(something_complicated); // "NameA" "NamesB*" "NamesC?"

Then the script can just look for all lines with Sound and mark any names in following quotation marks as used.

The script could also warn if there is a call to Sound with no string on the same line. And it could warn for missing sounds.

~0004332

Zapper (developer)

Maikel, stuff like the rope ladder or polished scenarios is around a bazillion times more important, though :)

~0004333

Maikel (developer)

I know, but learning python is on my todo list outside of OC. So some non-OC time will be allocated on this.

Progress is that these are still missing:
* Sounds may be played as e.g. Sound(["Foo", "Bar"][Random(2)]).
* Sounds may be played from local variables.
* Schedule and ScheduleCall have an alternative syntax

~0004334

Maikel (developer)

Last edited: 2015-12-16 17:01

View 3 revisions

Added a first attempt to the tools directory, it is not perfect yet, so it still finds some used Sounds.

Real unused sounds are:
../planet/Sound.ocg/Clonk.ocg/Verbal.ocg/Confirm3.wav (Clonk::Verbal::Confirm3) has not been found
../planet/Sound.ocg/Clonk.ocg/Verbal.ocg/Confirm1.wav (Clonk::Verbal::Confirm1) has not been found
../planet/Sound.ocg/Clonk.ocg/Verbal.ocg/Confirm2.wav (Clonk::Verbal::Confirm2) has not been found
../planet/Sound.ocg/Animals.ocg/Monster.ocg/Die.wav (Animals::Monster::Die) has not been found
../planet/Sound.ocg/Animals.ocg/Monster.ocg/Growl1.wav (Animals::Monster::Growl1) has not been found
../planet/Sound.ocg/Animals.ocg/Monster.ocg/Growl2.wav (Animals::Monster::Growl2) has not been found
../planet/Sound.ocg/Animals.ocg/Monster.ocg/Growl3.wav (Animals::Monster::Growl3) has not been found
../planet/Sound.ocg/Animals.ocg/Wipf.ocg/Snuff1.wav (Animals::Wipf::Snuff1) has not been found
../planet/Sound.ocg/Animals.ocg/Wipf.ocg/Snuff2.wav (Animals::Wipf::Snuff2) has not been found
../planet/Sound.ocg/Hits.ocg/Materials.ocg/Wood.ocg/WoodCreak2.ogg (Hits::Materials::Wood::WoodCreak2) has not been found
../planet/Sound.ocg/Hits.ocg/Materials.ocg/Wood.ocg/WoodCreak3.ogg (Hits::Materials::Wood::WoodCreak3) has not been found
../planet/Sound.ocg/Hits.ocg/Materials.ocg/Wood.ocg/WoodCreak1.ogg (Hits::Materials::Wood::WoodCreak1) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Shield.ocg/WoodHit3.ogg (Objects::Weapons::Shield::WoodHit3) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Shield.ocg/WoodHit1.ogg (Objects::Weapons::Shield::WoodHit1) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Shield.ocg/WoodHit2.ogg (Objects::Weapons::Shield::WoodHit2) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Shield.ocg/WeaponHitShield.ogg (Objects::Weapons::Shield::WeaponHitShield) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Bow.ocg/GetArrow2.ogg (Objects::Weapons::Bow::GetArrow2) has not been found
../planet/Sound.ocg/Objects.ocg/Weapons.ocg/Bow.ocg/GetArrow1.ogg (Objects::Weapons::Bow::GetArrow1) has not been found


These are the current problematic Sound calls:
Sound(string snd_name, chance)
Sound = this.Env_AddSound,
Sound(chance, string snd_name)
Sound = def.Env_AddSound,
Sound(\"Animals::Puka::Hurt*\")", RandomX(5, 20))
Sound(\"Animals::Puka::Gulp\")", 40)
Sound(prop_speed = prop_speed_target = new_speed)
Sound(prop_speed)
Sound(int speed)
SoundAt(Format("Fire::BlastLiquid%d",grade), x, y)
SoundAt(Format("Fire::Blast%d", grade), x, y)
Sound(["Hits::Materials::Wood::WoodCreak?","Structures::HingeCreak?"][Random(2)], false, nil, nil, nil, 75)
Sound(["Hits::Materials::Wood::WoodCreak?","Structures::HingeCreak?"][Random(2)], false, nil, nil, nil, 75)
Sound(Format("Fire::Blast%d", grade), false)

Following Sven's suggestion I would rather add:
// Sound("FooBar*")
as a comment behind a non-normal call, because the scripts do not need to be modified.

~0004335

Maikel (developer)

The current engine checks are GUISound, StartSoundEffectAt, StartSoundEffect. Are there any others? I still need to check for non-normal calls to those.

~0005559

Maikel (developer)

There is a tool, which can be a bit improved, and we can add comments in scripts for complicated calls to Sound involving concatenation and what not.
+Notes

-Issue History
Date Modified Username Field Change
2015-12-14 18:14 Zapper New Issue
2015-12-14 18:14 Zapper File Added: README
2015-12-14 18:15 Zapper File Deleted: README
2015-12-15 09:42 Maikel Note Added: 0004329
2015-12-15 09:42 Maikel Assigned To => Maikel
2015-12-15 09:42 Maikel Status new => assigned
2015-12-15 16:41 Maikel Description Updated View Revisions
2015-12-15 17:03 Maikel Description Updated View Revisions
2015-12-16 03:26 Sven2 Note Added: 0004331
2015-12-16 08:22 Zapper Note Added: 0004332
2015-12-16 09:31 Maikel Note Added: 0004333
2015-12-16 16:55 Maikel Note Added: 0004334
2015-12-16 16:55 Maikel Note Edited: 0004334 View Revisions
2015-12-16 16:59 Maikel Note Added: 0004335
2015-12-16 17:01 Maikel Note Edited: 0004334 View Revisions
2016-12-21 13:24 Maikel Status assigned => resolved
2016-12-21 13:24 Maikel Resolution open => fixed
2016-12-21 13:24 Maikel Fixed in Version => git master
2016-12-21 13:24 Maikel Note Added: 0005559
+Issue History