Page 1 of 1

longstanding combat music problems

Posted: Fri May 13, 2011 7:21 pm
by _Olarin
I finally got around to downloading the Exult source and getting set up to be able to compile it so I could start poking around. I haven't had much time to spend on it yet, but I'd like to start discussion on a well-worn topic again - the fact that the danger music never plays, ever.

First, a recap of the issue, by describing Exult's current functionality vs. the original. In the original:

- when hostiles are near the party and the movement cursor becomes shortened, "danger" music plays.
- while in this "danger" state, if you manage to avoid the hostiles without confrontation (as in, you run the hell away), when the cursor lengthens again, a "danger passed" music plays - a short, sinister track related to the danger music that seems to suggest "well, i guess you're safe... for now..."
- while in the "danger" state, if the player enters combat mode, or if a hostile actually gets in range and begins attacking a party member, combat has officially begun and the "combat" music plays.

In Exult:

- as soon as hostiles are near and the cursor shortens, "combat" music plays. "danger" music is never heard, and as far as i know "danger passed" music is never heard.

What I don't remember is if it's possible to run away after "combat" music is started and still get the "danger passed" music in the original - I think it is, but I'd have to go back and test. I also think there might have been specific conditions for which victory fanfare was played in the original (maybe a different one for if you let some of the bad guys run away?), but it could have just been random - I do seem to recall one being more common than the other though.

I examined the Exult code and saw that the "combat" music is called from only one place in Exult - a function in combat.cc called Combat_schedule::start_battle, whose only purpose is to start the combat music. I verified this by commenting out the line in that function that actually plays the music and compiling and running Exult, and sure enough I never heard the "combat" music before, during, or after combat. It looks like Exult never keeps track of the "danger" state that the original does. I'm going to look into this a bit more when I get a chance and see if I can figure out an elegant solution.

Re: longstanding combat music problems

Posted: Fri May 13, 2011 8:53 pm
by Dominus
If you can figure out a godd solution, I'd happyly accept a patch.
Thanks for taking a look

Re: longstanding combat music problems

Posted: Sat May 14, 2011 3:13 pm
by _Olarin
some more notes:

- I did a few minutes testing just now and the original can be a bit glitchy itself, but as far as I can tell its intended behaviour was for the "danger passed" music to always be played when you escaped combat by running away, even if you'd entered combat and then fled. (This short tunes serves the helpful purpose of interrupting whatever music was playing previously; in Exult since there's no music trigger in this situation, the "combat" or "fleeing" music keeps playing long after combat has been escaped, until the tune finishes.) In one of my tests the original played the "victory" fanfare instead of "danger passed" when I ran away from combat, I'm not sure why - maybe there was a small chance or certain conditions for this, or maybe it was sort of a glitch.

- in the original, I think the two "combat" musics were not chosen randomly, but were based on what sort of enemies you were fighting - for instance, the wolves south of Trinsic always trigger the one that starts with tubular-bell sounds, whereas engaging the Passion Play members in combat (hey, I needed something close to Trinsic) always triggers the other one, that starts off more frenzied sounding. (This theory is also based on the fact that Ultima IX also had different music for different types of enemies - note that on the soundtrack CD the combat tunes are given names like "rats and spiders", "humanoids", "gargoyles", "good vs evil".) I'd have to do more extensive testing to have a better idea of who triggers which.

- in the original, transition from "danger" to "combat" could be initiated by an attack that does not involve the party - for instance, wolves attacking a deer, or guards attacking bandits.

- in Exult, it seems nearby enemies aren't detected and/or marked as hostile early enough. In the original, I believe the cursor almost always shortens before the enemies are on screen, but in Exult, you can sometimes walk right up to an enemy before it finally remembers to be hostile and the cursor shortens, and/or the cursor sometimes might not shorten until the enemy actually attacks you. (Although I can't guarantee there aren't times in the original where maybe a wild animal doesn't attack you right away then decides to attack you, but this still happens too often in Exult, and sometimes with enemies I'm fairly certain should never be anything but hostile.)

Re: longstanding combat music problems

Posted: Sat May 14, 2011 3:26 pm
by _Olarin
can anybody clue me in on which source code file(s) and/or function name(s) would deal with the cursor lengthening / shortening?

Re: longstanding combat music problems

Posted: Sat May 14, 2011 3:44 pm
by _Olarin
nevermind, I found it, mouse.cc, not sure how I missed that one earlier.

yet another note - in the original, a beginning-stats Avatar can easily outrun a wolf, but slowly gets overtaken by a guard. i haven't tested, but i wouldn't be surprised if dexterity affected the Avatar's speed, too. in Exult, Avatar speed is hard-coded, and a chasing wolf is able to keep up with the Avatar evenly when running in combat mode (neither overtaking nor losing you). I couldn't test guard speed in Exult, because when I attack a civilian then turn off combat and run away, I keep getting the long cursor even though the guards are on screen chasing and attacking, and even if I take a swing at a guard and then try it.

sorry for spamming the forum with my investigations, just figured it couldn't hurt to dump my notes here in case someone has some additional insights.

Re: longstanding combat music problems

Posted: Sat May 14, 2011 6:26 pm
by Dominus
Keep on dumping here, this is not spam but ham ;)

Re: longstanding combat music problems

Posted: Sun May 15, 2011 2:32 pm
by agentorangeguy
I believe the longer victory fanfare happened when a party member leveled up. I hope you all find a good fix for the combat music! It added to the sense of danger for sure.

Re: longstanding combat music problems

Posted: Tue May 17, 2011 6:50 pm
by _Olarin
I just looked up how to start the original with cheat mode (I'd never bothered to do that before) and verified that dexterity most definitely affects movespeed in combat! an Avatar of dex=30 can outrun guards with ease, the guards have time to take a swing or two every step against an Avatar of dex=10, and with dex=1 the Avatar plods around like a snail. (Movement in peaceful mode with no hostiles nearby (long-cursor mode) is still normal though.) A little bit off-topic from where I started this thread, but interesting.

Combat could be somewhat glitchy in the original too - at one point I managed to toggle combat just at the right time to make the game think I'd escaped danger and let me have the long movement cursor again when all the residents of the Fellowship Shelter were still on screen running up to attack me.

Re: longstanding combat music problems

Posted: Tue May 17, 2011 8:36 pm
by _Olarin
oh back on topic - I definitely managed to get the secondary victory fanfare without leveling a party member up. it doesn't seem to be related to killing vs. letting opponents escape either. (Although neither is a bad idea for Exult if we don't want to just go with random...)

Re: longstanding combat music problems

Posted: Tue May 17, 2011 8:38 pm
by _Olarin
Actually, now that I think about it, I think I saw in the Exult code that it currently picks the fanfare based on how long the battle was (a really long (presumably arduous) battle gets the secondary fanfare), which might or might not be the original's method, but is a nice one regardless.

Re: longstanding combat music problems

Posted: Wed May 18, 2011 12:55 am
by paulo
Damage made on the avatar side would probably be better. Liches and such have short battles.

Re: longstanding combat music problems

Posted: Wed May 25, 2011 3:21 pm
by Earthquake Damage
Don't forget the "fleeing" track in the original. IIRC it plays when you exit combat mode after the "combat" music has started but before the battle is over.

Re: longstanding combat music problems

Posted: Wed May 25, 2011 5:33 pm
by andar_b
I seem to have had it get stuck in combat music even when there aren't any more enemies around, and I got the fleeing music for no reason! lol

Re: longstanding combat music problems

Posted: Thu May 26, 2011 6:25 pm
by _Olarin
Exult already triggers the "fleeing" music correctly (not counting andar's report there which sounds like a function of the game not recognizing victory conditions (but it could be there was inaccessible enemies in a nearby dungeon or something though, especially if you were playing at a high resolution)).

Re: longstanding combat music problems

Posted: Sun Feb 24, 2013 3:47 pm
by _Olarin
If you'll excuse the thread necromancy - hooray! Progress has been made! Somebody (Marzo, apparently, since he's the one who's been commenting on the bug tracker?) has properly reintroduced the "danger" music.

There's still some missing functionality though:

- currently in Exult, it seems the actual combat music is now never triggered until the player enters combat mode. in the original, transition from danger to combat can also be triggered by an enemy getting a chance to take a swing at a party member (not sure if they have to actually cause damage or not).

- the "danger passed" music still never gets triggered - it's supposed to play when you successfully run away from enemies (transition from short-green-cursor mode to long-green-cursor mode by getting far enough away - I don't know if maybe this is the point on the back end at which the enemies get unloaded from memory?) Of course, it's hard to trigger this in Exult anyway due to the lack of dexterity-based speed noted above - it seems that in Exult almost every person and monster in the game runs at the same speed even in combat mode. (When I have some more time I think I'm going to do some cheat-testing in the original and try to document the dexterity-speed of every monster.)

Re: longstanding combat music problems

Posted: Sun Feb 24, 2013 3:57 pm
by Dominus
Can you file a new bug report about the combat/danger music transition/trigger?
Thanks for taking the time (even though no guarantee how fast it gets corrected ;))

Re: longstanding combat music problems

Posted: Sun Mar 03, 2013 9:51 pm
by Olarin_
(Hooray, I remembered one of my passwords.)

Yeah, I'll post a new bug report now.

Meanwhile, I experimented with running away from monsters in the original, using cheat mode to modify my dexterity in order to figure out the monster's dexterity from its movement speed. Here's what I have so far:

WOLF 13
ALLIGATOR 8
BEE 23
GUARD 18
SCORPION 13
GREMLIN 16
SPIDER 19
BIRD 15
PIRATE 22
HARPY 17
HEADLESS 14

In a rudimentary Google search I encountered this page which suggests we could deduce the rest of this from the original data files: http://wiki.ultimacodex.com/wiki/Ultima_VII_Monsters

I'll create a bug report for dexterity not affecting movespeed too, if there isn't one already.

I also noticed that in Exult, when I'm running straight south away from a monster, for instance, the monster can't stand to just run straight south after me - it feels the need to constantly be twitching east and west as it chases me. Struck me as kind of odd compared to the relatively smooth movement of monsters in the original.

Re: longstanding combat music problems

Posted: Sun Mar 03, 2013 10:49 pm
by Olarin_
I should note - it seemed like for a given mob type, dexterity could vary a little (for instance, of a group of gremlins, one gremlin kept apace with me perfectly at a certain movespeed while the other two fell behind).

Re: longstanding combat music problems

Posted: Mon Mar 04, 2013 8:56 am
by paulo
I wish there was a way to turn off combat music completely (and danger one too). I'm not a fan of music transitions, and 'exciting' music.

Re: longstanding combat music problems

Posted: Mon Mar 04, 2013 11:01 am
by Dominus
@Paulo: didn't you look into that some time ago in irc? It might actually be a welcome patch at some point...

@Olarin: thanks for the bug reports. No idea when or if ever someone actually has time to implement that properly but at least this way it won't get forgotten :)

Re: longstanding combat music problems

Posted: Mon Mar 04, 2013 1:29 pm
by paulo
I _didn't_ look at it, due to laziness.

Re: longstanding combat music problems

Posted: Mon Mar 04, 2013 4:42 pm
by Jaesun
Couldn't you just remove the "combat" .ogg songs in the Data/Music directory?

Granted when the engine cannot find the files, I don't know if that could start to have serious problems?

Re: longstanding combat music problems

Posted: Fri Mar 08, 2013 4:59 pm
by Dominus
From Colourless on #exult:
exult is supposed to fallback to midi if it cant find the ogg for the selected track

Re: longstanding combat music problems

Posted: Sun Mar 10, 2013 8:34 am
by paulo
There's a patch now

Re: longstanding combat music problems

Posted: Tue Mar 12, 2013 10:52 am
by agentorangeguy
Where is the patch?

Re: longstanding combat music problems

Posted: Tue Mar 12, 2013 11:29 am
by Dominus