Transport menu

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

Transport menu

Post by Hazelnut » Sat Aug 26, 2017 3:39 pm

Hi all, new to DFU development - see my forum intro post: viewtopic.php?f=8&t=646

As stated there I want see if I can contribute to DF Unity. Don't expect any great graphics, I'm a programmer who knows very litlle about 3d gfx programming and not an artist, modeller or animator. So for my first project I've decided to work on the transport menu since it's a couple of releases away on the roadmap and no one else appears to have started it. Got the basics working, T now brings up the UI image with all options unavailable (red) with just the exit button working.

I've seen the discussions about the horse graphics CFA file being found and DFU being able to read the format. I have concerns that using the original scheme of plonking an animated horse head at the bottom on the screen will look daft with mouselook, as it did with classic when mouselook was enabled. Since it's the default in DFU (and its not 1996) it's a bigger issue now. I think possibly restricting looking up and down when riding may be a simple solution. Anyone have any other thoughts on this?

Questions if anyone here knows the answers or can point me in the right direction:

1. How are the original game effects figured out? i.e. how movement speed is increased? Guestimates, or debug using DosBox? (is there a good guide to this anywhere I've missed)
2. Are all horses in DF identical statswise?
3. Does cart have any differences other than sound & graphics?
4. Any already existing uses of CFA animations in the codebase I could use as a reference?

Cheers,
H

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

Re: Transport menu

Post by Interkarma » Sat Aug 26, 2017 9:52 pm

Hey Hazelnut, welcome to the forums :).

Think of the transport UI menu and horse riding as two separate things. I'm happy to accept a PR for UI, but riding is a while off.

For horse riding to work properly, I need to build some additional states into player motor first. This also ties into swimming, levitation, crush detection, climbing, etc. This is something I need to handle as it crosses over multiple other systems.

Don't worry too much about the horse CFAs. DFTFU handles these like any other image format. It's very easy to slap the animated horse over display (see weapons for examples) but the business end of riding movement happens in the player motor, which I have extended plans for.

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

Re: Transport menu

Post by Hazelnut » Sat Aug 26, 2017 10:17 pm

Interkarma wrote:Hey Hazelnut, welcome to the forums :).

Think of the transport UI menu and horse riding as two separate things. I'm happy to accept a PR for UI, but riding is a while off.

For horse riding to work properly, I need to build some additional states into player motor first. This also ties into swimming, levitation, crush detection, climbing, etc. This is something I need to handle as it crosses over multiple other systems.

Don't worry too much about the horse CFAs. DFTFU handles these like any other image format. It's very easy to slap the animated horse over display (see weapons for examples) but the business end of riding movement happens in the player motor, which I have extended plans for.
Thanks for the reply.

I've already been looking at PlayerMotor class thinking about how to integrate riding. If you already have plans in mind that's fine, but I was starting to think of the different states required and was planning to add them myself. Obviously I don't want to make things harder for you - I know what it's like dis-entangling code just so you can do it properly. Maybe we can talk later about that once you've seen my code. For the time being I'll do something that works as a placeholder and make it as lightweight and obvious as possible, just altering speed & height but leave all of the complex logic checks alone! Is that ok?

Are you adding CFA support to ImageReader already, or should I add that myself? Currently the CfaFile class isn't used anywhere yet that I can see. Should be failry straighforward, you've already done the hard part.

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

Re: Transport menu

Post by Interkarma » Sat Aug 26, 2017 11:02 pm

Hazelnut wrote: I've already been looking at PlayerMotor class thinking about how to integrate riding. If you already have plans in mind that's fine, but I was starting to think of the different states required and was planning to add them myself. Obviously I don't want to make things harder for you - I know what it's like dis-entangling code just so you can do it properly. Maybe we can talk later about that once you've seen my code. For the time being I'll do something that works as a placeholder and make it as lightweight and obvious as possible, just altering speed & height but leave all of the complex logic checks alone! Is that ok?
Yep, lightweight and obvious is fine for now. We can talk about other states afterwards. I've made a branch for you called 'horse-riding'. Please send your PRs to that for now and we'll see if we can get this happening.
Hazelnut wrote: Are you adding CFA support to ImageReader already, or should I add that myself? Currently the CfaFile class isn't used anywhere yet that I can see. Should be failry straighforward, you've already done the hard part.
Happy for you to add to ImageReader. I haven't looked deeply into integration yet - horse animations are the only notable CFA files we need to worry about. I'd even be happy for the component which renders the horse to use CfaFile directly, as it's likely to be the only consumer.

Please just let me know if any help needed. You seem confident and have already drilled into the code, and I'll answer what I can to help you out.

Cheers! :)

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

Re: Transport menu

Post by Interkarma » Sat Aug 26, 2017 11:20 pm

I'll try to cover your additional questions best I can.
Hazelnut wrote: 1. How are the original game effects figured out? i.e. how movement speed is increased? Guestimates, or debug using DosBox? (is there a good guide to this anywhere I've missed)
There are multiple sources overall:
  • Daggerfall Chronicles has a lot of information about Daggerfall's inner workings. It's not always 100% accurate to the game, but still an excellent resource for many formulas, relationships, and other data.
  • Debug using DosBox and disassembly of FALL.EXE yield some great information. Allofich is particularly adept at this. He's extracted several formulas and hard-coded tables from the executable.
  • A hex editor is essential for drilling into data files in detail.
  • When full solution needs extensive work, or isn't obvious, observe from classic and try to build the best approximate possible in the shortest amount of time. Gameplay comes first, the full solution can be built out later.
Hazelnut wrote: 2. Are all horses in DF identical statswise?
3. Does cart have any differences other than sound & graphics?
I believe all horses are identical in speed in height, just the sounds and graphics are different between horse and horse with cart. I'm happy to be corrected here if someone has more information.

Hazelnut wrote: 4. Any already existing uses of CFA animations in the codebase I could use as a reference?
The horse graphics are about it for CFAs. My CfaFile class can return a DFBitmap intermediary format or Color32[] array. Just need to load the palette, grab the bits, and create a Texture2D array with the animation formats. The FPSWeapon class is the closest equivalent to the horse I can think of. Besides the PlayerMotor stuff, the actual horse rendering can just be a simpler version of the weapon setup.

Let me know if that helps. :)

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

Re: Transport menu

Post by Hazelnut » Sat Aug 26, 2017 11:30 pm

Great, thanks. One trivial but annoying thing I've run into is with MonoDevelop which is saving tabs instead of spaces for indentation. That is my personal preference (oh the debates I've had over my career on this matter!), but consistency is more important and existing code uses spaces. I can't find this setting yet, do you know where this is set? I'm also wondering if there's a keymapping that matches Eclipse because my muscle memory keeps pressing the wrong hotkeys after 15 years of using Eclipse... funny the first dozen times. :lol: Will google it tomorrow, need bed now.

Why have you made a branch horse-riding? I've not used github before (use plain git at work and no PRs) but I thought the standard process was fork the repo, create feature branch, do work & commit, merge into local master and send PR to origin repo for accept/reject into master. You will have to give me some pointers for how to send a PR to that branch and why so I don't mess it up. Do I need a local branch the same name? Mine is just called transportation.

Thanks for the offer of help. So far I'm figuring things out just fine, although kinda derped on checking inventory for horse/cart which took a couple of hours to work though the item system and then added a new overloaded Contains method to ItemCollection. Job done. No doubt would have taken you 10 mins. :) Still this is mainly to get me familiar with the codebase, on which I think I have made a good start.

H

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

Re: Transport menu

Post by Interkarma » Sat Aug 26, 2017 11:37 pm

Hazelnut wrote:Great, thanks. One trivial but annoying thing I've run into is with MonoDevelop which is saving tabs instead of spaces for indentation. That is my personal preference (oh the debates I've had over my career on this matter!), but consistency is more important and existing code uses spaces. I can't find this setting yet, do you know where this is set? I'm also wondering if there's a keymapping that matches Eclipse because my muscle memory keeps pressing the wrong hotkeys after 15 years of using Eclipse... funny the first dozen times. :lol: Will google it tomorrow, need bed now.
Use Visual Studio (Community if you don't own the full version), it's a superior tool than MonoDevelop for Unity development.

Hazelnut wrote: Why have you made a branch horse-riding? I've not used github before (use plain git at work and no PRs) but I thought the standard process was fork the repo, create feature branch, do work & commit, merge into local master and send PR to origin repo for accept/reject into master. You will have to give me some pointers for how to send a PR to that branch and why so I don't mess it up. Do I need a local branch the same name? Mine is just called transportation.
You create the fork on your side. When sending me the PR, please send it to "horse-riding" branch for me to review and test. If I'm happy, then I'll merge with master. Otherwise, I'll give you feedback and we'll go from there. :)

Hazelnut wrote: Thanks for the offer of help. So far I'm figuring things out just fine, although kinda derped on checking inventory for horse/cart which took a couple of hours to work though the item system and then added a new overloaded Contains method to ItemCollection. Job done. No doubt would have taken you 10 mins. :) Still this is mainly to get me familiar with the codebase, on which I think I have made a good start.
Horse riding shouldn't require any interaction with inventory or ItemCollection. From an inventory point of view, the cart is already working fine.

Please try to change the minimum possible to implement horse riding and we'll go from there.

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

Re: Transport menu

Post by Jay_H » Sat Aug 26, 2017 11:50 pm

Interkarma wrote:I believe all horses are identical in speed in height, just the sounds and graphics are different between horse and horse with cart. I'm happy to be corrected here if someone has more information.
Give me some time to test this, because I've convinced myself that a horse is faster than a cart. I'll try to bring back an answer ASAP.
**INDEFINITE HIATUS** Check out the Daggerfall Unity mod page on ModDB.

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

Re: Transport menu

Post by Interkarma » Sat Aug 26, 2017 11:53 pm

Interkarma wrote: Horse riding shouldn't require any interaction with inventory or ItemCollection. From an inventory point of view, the cart is already working fine.

Please try to change the minimum possible to implement horse riding and we'll go from there.
Quick edit for above - I just realised you're likely referencing the check to see if player owns a horse and/or cart or not. My misunderstanding - yeah no problems with that. :)

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

Re: Transport menu

Post by Hazelnut » Sat Aug 26, 2017 11:54 pm

Interkarma wrote:Use Visual Studio (Community if you don't own the full version), it's a superior tool than MonoDevelop for Unity development.
Okay will do that. Can it debug code run in Unity like Mono can?
Interkarma wrote: You create the fork on your side. When sending me the PR, please send it to "horse-riding" branch for me to review and test. If I'm happy, then I'll merge with master. Otherwise, I'll give you feedback and we'll go from there. :)
Ok sounds simple enough. I'm sure I'll get used to github & PRs pretty fast.
Interkarma wrote:
Hazelnut wrote: Thanks for the offer of help. So far I'm figuring things out just fine, although kinda derped on checking inventory for horse/cart which took a couple of hours to work though the item system and then added a new overloaded Contains method to ItemCollection. Job done. No doubt would have taken you 10 mins. :) Still this is mainly to get me familiar with the codebase, on which I think I have made a good start.
Horse riding shouldn't require any interaction with inventory or ItemCollection. From an inventory point of view, the cart is already working fine.

Please try to change the minimum possible to implement horse riding and we'll go from there.
The menu has to disable the different options depending on whether the player has a horse / cart or not. As far as I know DF implements this using an inventory item. Same for cart, and I assume same for ship but I don't have a test save with one of those yet. I know that the cart is working fine in the inventory, don't worry I'm not messing with the inventory. I just added a method so the inventory could be checked to see if it contains an item of a certain type, since the horse / cart could have any ID. Did I miss something obviously easier? I can redo it if needed, but it's working quite nicely.

EDIT: Right, thanks for the follow up.. glad I didn't miss something like a dummy. :)

Post Reply