|
|
#16 | |
|
Obscurity, the Art
|
Quote:
JASS:if GetLocalPlayer() == MyPlayer then call RunSound(MySound) endif Furthermore, though, when does it ever make sense for only one player viewing an action to hear the sound? If I shoot a missile at a point, all players should hear the explosion, stuff like that. Last edited by Rising_Dusk : 08-31-2009 at 01:14 PM. |
|
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#17 |
|
default string
|
When a player was hit by an explosive and they've got that weird screeching noise you hear in movies? :p
|
|
|
|
|
|
#19 |
|
default string
|
Not if you've got Divine Shield, or it's team V team and your explosives don't TK.
But yeah, enough silly buggers. The local block should be fine for people who ever want to locally play a sound, don't really think the system needs to support that but it couldn't hurt to. Last edited by Fledermaus : 08-31-2009 at 01:53 PM. |
|
|
|
|
|
#21 |
|
Dread Lord of the Cookies
Content Director
|
Useful library (god I hate WC3 sounds' implementation sometimes, it's so annoying). Anyway, correct me if I'm wrong, but won't the H2I - min handle implementation bug out if the handles on the map (rather than just the sounds on the map) exceeds 8191?
__________________As to for local blocks, putting it in local blocks would be fine for running, but in combination with releasing when done, you'll run into issues, won't you? Since you may later on get new sound being created on some systems but not others, due to different numbers of sounds release / in the stack. |
|
|
|
|
|
#22 | ||
|
Obscurity, the Art
|
Quote:
Quote:
Last edited by Rising_Dusk : 08-31-2009 at 02:19 PM. |
||
|
|
|
|
|
#23 | ||
|
Dread Lord of the Cookies
Content Director
|
Quote:
I'd say that's excessive when you could, for a far smaller performance hit, make it use a hash to between 1 and 8191. Quote:
Yea, but you might want to make a RecycleSoundWhenDoneForPlayer. |
||
|
|
|
|
|
#24 | ||
|
Obscurity, the Art
|
Quote:
Quote:
|
||
|
|
|
|
|
#25 |
|
Lackadaisically Absent.
Respected User
|
Anyone else find it ironic that the guy who develops a Sound library is the one who is constantly reminding everyone that his computer doesn't have sound enabled?
__________________:P Noice library. |
|
|
|
|
|
#26 |
|
User
Join Date: Apr 2008
Posts: 287
|
Quote:
Originally Posted by Captain Griffen I'd say that's excessive when you could, for a far smaller performance hit, make it use a hash to between 1 and 8191. Hrm, that's probably true. What hash would you recommend? Quote: Thats a nice idea, since the hash is just used internally, you'd not even have index conflicts. |
|
|
|
|
|
#27 |
|
extends net.wc3c.Jasser
|
Actually I had plans to make exactly the same thing. (even interfaces are 98% similar, but whatever.) I threw it away due to hassles making the library neat. One of such hassle is locally played sounds when it comes to recycling.
The most correct way of recycling should be making sure whether the sound is still in use. The problem here is that you are not going to know whether a sound is idle if it is played in local fashion, unless you apply some dirty synchronization tricks. Once the stack becomes to have different number of sounds, trying to get the sound will desync when the stack is empty for some players but not to the others. This is because creating sounds desync whatsoever. In your code, I see you utilizing timers to circumvent this fuss. It might be an alternative, but it has weaknesses. First, timers don't work quite well with sounds. For instance, the sound will continue playing when the game is paused, while the timer won't. Also, the sound durations are real-time, while timer depends on the game speed. This means the sound will cut off prematurely. To fix the problem, you should try getting the approximate factor that each game speed poses to the game time. OTOH, game being paused can be a non-issue, since it would only make the sound unusuable for some extra time. |
|
|
|
|
|
#28 | ||
|
Dread Lord of the Cookies
Content Director
|
Quote:
H2I - H2I / 8191 * 8191 (+1 to avoid 0 and maybe 8190?), then loop to see if it's already being used. Quote:
So when does it recycle? If it's dependant upon when the sound finishes, and it's only played in local block, then you'll have a problem. |
||
|
|
|
|
|
#29 | |||
|
Obscurity, the Art
|
Quote:
Quote:
Quote:
|
|||
|
|
|
|
|
#30 | ||
|
extends net.wc3c.Jasser
|
Quote:
That is O(n) only if hashing function returns a constant value, making hash collisions 100% of the time. The technique Griffen suggested is one of the hashtable techniques to deal with hash collisions. Basically you save a copy of the key object reference itself, and compare it with the stored value after lookup with the hash of the key. If the key doesn't match, then try checking the next object pointed by the entry. This is generally done with linked lists, but arrays will do fine if every object has assigned unique indices. This technique generally works like supposed O(1) on average. Having poor hash will make the performance closer to theoretical O(n) worse case though. Quote:
Just get an approximate factor and add the extra gap (like 15 percentage point). While added gap would make recycling a bit inefficient, but at least it would be bulletproof from unwanted bugs. Last edited by ToukoAozaki : 08-31-2009 at 10:35 PM. |
||
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |