Transport menu

Discuss coding questions, pull requests, and implementation details.
User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

Jay_H wrote:I used the long pool in front of Daggerfall Castle as my testing track. One full length of the pool took:

Cart: 6 seconds
Horse: 4.3 seconds
Foot at 100 speed: 5 seconds

Cart is actually slower than a person at max speed :|

Height values are identical for horse and cart.

Cart and horse merely rely on fixed values, independent of running state or PC speed.

A missing mechanic is stamina loss while riding. In classic, stamina loss on foot is derived from the Running skill.
Great info, I've estimated the horse / cart height in DF as around 2.4m which is a massive horse. Google reseach tells me horses are 1.4-1.8m so I've gone with 2m as a compromise since Tamrielic horses are big I guess. The perspective looks much better at this height than in orginal game.

Quick query, foot at 100 speed time - was that walking or running? Assuming walking for now since you didn't specify the running skill level used. (which changes runspeed)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

Progress report:

Menu enables options based on having horse or cart in inventory. Incidentally, anyone know of a scenario where foot would be disabled? There's a texture for it but I can't think of when it may have been used.

Horse and cart riding are both working from transport menu with sounds but only using placeholder image. Have made speeds the same since distinguishing speeds would not make the lightest integration into PlayerMotor. (very happy to do distinguish if you want though.. just say the word)

Transport state is saved & loaded. Not imported from classic saves, but that seems pretty unimportant since you can immediately jump back on ya orsie using menu. If someone cares enough, then tell me where the riding status is stored in the classic savefiles and I'll add it into SaveVars. (not wanting to get too deep into DF file formats yet, just focussing on learning codebase/c#/unity for now)

Next I need to replace the images with animations from CFA files, then I'll create a pull request.

So far the sounds was the hardest part by a mile. Spent several hours doing that part, going down a few dead ends. Mostly I've never done any sound work before, so am consoling myself with having learned a *lot* so those hours are not 'wasted'. :D
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma »

Sound like solid progress, look forward to seeing the PR. :)

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Transport menu

Post by Jay_H »

Hazelnut wrote:
Jay_H wrote:Quick query, foot at 100 speed time - was that walking or running? Assuming walking for now since you didn't specify the running skill level used. (which changes runspeed)
It was while running. I didn't factor Running as an element of movement speed, since I had previously done testing that made me believe the Running skill doesn't affect it. Here are the results:

With 100 speed and 100 running, running from one corner of the first room in Castle Wayrest to the other takes about 3 seconds.

100 Speed, 50 Running takes 3 seconds.

100 Speed, 1 Running takes about 3.

50 speed, 100 running takes 4 seconds.

50 Speed, 50 Running takes about 4.5.

My conclusion was that Running reduces fatigue loss but doesn't improve speed. (The numbers vary because my computer's junky and an interior like Wayrest is intensive. Testing it outdoors would be more precise. I'm always willing to test more if it helps.)

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

@interkarma:
Well I have just spent the past 2 hours trying to get a CFA file to display with the correct colours. Blimey a bit of a learning cliff! I tracked it down I think, but I would like you to give me your opinion on the fix below.

Basically CfaFile is creating a new DFBitmap and allocating the data in GetDFBitmap, but not allocating the palette like the other image file classes. It's a bit of a tangled system for a newcomer but I figure it out in the end.

Code: Select all

--- a/Assets/Scripts/API/CfaFile.cs
+++ b/Assets/Scripts/API/CfaFile.cs
@@ -185,6 +185,7 @@ namespace DaggerfallConnect.Arena2
             // Create bitmap
             DFBitmap bitmap = new DFBitmap(header.WidthUncompressed, header.Height);
             bitmap.Data = new byte[bitmap.Width * bitmap.Height];
+            bitmap.Palette = Palette;

             // Copy rows of image data
             int offset = bitmap.Width * bitmap.Height * frame;
 
Now just need to code the animations to run at a sensible speed and only when moving. Have to go out for a bit but hopefully it will all be done by end of today. That was my target for this bank holiday weekend, although has taken more hours than anticipated... so much to learn. :-)
Last edited by Hazelnut on Mon Aug 28, 2017 1:11 pm, edited 1 time in total.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

@ Jay_H

Thanks for the testing.

Hmm, I asked because recently code was added to DFU that takes running skill level into account when calculating runspeed. I assumed this was duplicating classic functionality but maybe not. It was committed by Allofich 6 days ago with comment "Approximate classic player movement speeds". (5d4a886521593d18e0b87d8f33659edbdc02b212)

Code: Select all

float runSpeed = baseSpeed * (1.25f + (player.Skills.Running / 200f)); 
Maybe you should chat to him and see why you have come to different conclusions?

It might simply be an enhancement he decided to add, but the commit comment doesn't mention that. FWIW I think it's a nice change.

Are intentional enhancement changes from classic getting tracked somewhere so we all know what has been changed? I can foresee some unintended consequence being really puzzling without knowledge of what 'enhancements' have been made. Maybe it's unrealistic, as I've no idea how many enhancements to original logic already exist. One that I've added is allowing jumpting while riding since I think you should be able to jump over fences on a horse. Think it should be restricted to horse only once cart effects are differentiated. (which I've not done to keep integration into PlayerMotor as light as possible for now)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

All done. :D

Pull request #409 submitted targetted at transportation branch. Hope I did it right, my first time using a PR.

Hope you like my work.

(now I really need to mow the lawn before sun sets else wife will be all "Halt! Halt! Halt!" on my ass! lol)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma »

Cool! Looking forward to review, will let you know any feedback I can.

I'm just getting ready for work in my part of the world. I will get to this as soon I can. :)

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut »

Posted this on the PR but not sure if you will see it because it's closed:

Cheers, glad you like what I've done. Hopefully closer scrutiny wont change your mind.

I thought it was a bit high still but it's still lower than classic (which is ridiculous unless it's some stilt-horse), I've lowered it to 2.8m which is the highest that will fit through the arch. This is 1.8m (large horse) + 1m (sitting rider) so is realistic. However it looks a lot lower than classic. I think the difference is probably that classic doesnt change the collision box height and DFU does. Going through the arch in classic your eyes are almost scraping the ceiling.

I found another issue, have you opened console while on a horse? :-)

Anyway I will submit a PR with fixes after work. Have to go pay bills now.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Transport menu

Post by R.D. »

Hi, I hadn't noticed the discussion here.

The running formula is in the Daggerfall Chronicles and I also found it in FALL.exe, so it should be correct.

For the cart and horse speeds, the formula is just (walkingSpeed + 225) for the horse and (walkingSpeed + 100) for the cart. These are with the native Daggerfall speed values. I don't know exactly how those translate to DF Unity speed but I estimated a ratio of 39.5 classic units to 1 DF Unity unit from comparing video walking the same stretch with the same character, so just divide by the ratio and you should get almost the same speed.

This means the horse and cart speeds are dependent on the player's speed value, since it's part of the walking speed calculation. I tested just to make sure and there's a clear difference in speed between the cart when I had a speed of 0 and when I had a speed of 100 or 200. Maybe doesn't seem realistic, but you could also think of it like the horse leveling together with you as you level up and gain speed points.

Also running does have an effect on on-foot speed as far as I can tell, like the formula would suggest. Try hacking your character to have a running speed of 0, then start running while holding down the cheat key to raise your skills. You'll start getting faster and hear your footsteps speed up.

Running skill doesn't affect fatigue drop when running, at least not the amount. It's always a drop of 88. Maybe there's some effect on the frequency of it but I don't know of any.

As for why you got different results Jay_H, I don't know. My tests were outside, not in an interior, so maybe that's something? I don't think there's different behavior there, though. Maybe try testing over a longer distance. How are you measuring times? I used video recording software when I tested times for estimating the ratio of speed units, and the distance traveled was from walking straight until I hit a wall, so no turning or anything involved.

Post Reply