Outdoor swimming

Discuss coding questions, pull requests, and implementation details.
User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

@interkarma I'm trying to get the player's controller height below crouching height so the rest of my script will lower the camera accordingly. Is there something preventing the controller from being shorter than 0.45f? I tried setting controller.radius to 0.04f just before lowering the height to 0.10f, but it didn't seem to work. The next step is for me to make separate conditions for lowering just the camera in another if/else branch. :(

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

Re: Outdoor swimming

Post by Interkarma »

As far as I'm aware the player's capsule height is now controlled by your PlayerHeightChanger. I would need to step through to see why the height isn't changing as expected. You shouldn't need to change the radius though. I'm not sure why that's required?

I you get stuck, chuck into a PR and I'll merge to a branch for us both to have a look at. :)

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

Interkarma wrote: Sun Jul 01, 2018 5:48 am As far as I'm aware the player's capsule height is now controlled by your PlayerHeightChanger. I would need to step through to see why the height isn't changing as expected. You shouldn't need to change the radius though. I'm not sure why that's required?

I you get stuck, chuck into a PR and I'll merge to a branch for us both to have a look at. :)
I never expected to figure it out. It turns out that I added an if/else branch that handled sink/unsink actions in front of the code that handles the crouch/stand, mount/dismount action if/else structure. I was thinking it was one whole if/else structure, but it was running both structures. Every time it called sink, The final else on second if/else structure would always evaluate to true, and then it would run the dismount action and screw up the camera position

Code: Select all

            if (heightAction == HeightChangeAction.DoNothing || GameManager.IsGamePaused)
                return;
                
            if (heightAction == HeightChangeAction.DoSinking)
                DoSinking();
            else if (heightAction == HeightChangeAction.DoUnsinking)
                DoUnsinking();
            /* need an else here */ if (heightAction == HeightChangeAction.DoCrouching)
                DoCrouch();
            else if (heightAction == HeightChangeAction.DoStanding && CanStand())
                DoStand();
            else if (heightAction == HeightChangeAction.DoMounting)
                DoMount();
            else
                DoDismount();

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

I've got the height change portion working. I've tested all the possible combinations I know of.
  • Stand - crouch
  • crouch - stand
  • stand - ride
  • ride - stand
  • crouch - ride
  • crouch - swim
  • stand - swim
  • ride - swim
  • swim - stand
  • swim - ride
Right now you can go on horseback while on a water tile, but it messes up the height. I could fix it, but I don't think you should be able to mount/dismount a horse once you're on a water tile. The question is how do we inform the player of that restriction when they try to do it on water?
  • Grey out the options might be confusing: "Wait, I thought I bought a horse, where did it go?"
  • Showing a message at top of the screen after selecting the option seems to make more sense to me.
the stuff that remains is:
  • Make the player use swimming skill, if not riding
  • Make player move at swimming speed, if not riding
  • Allow Immersed in water benefits if not riding
  • Make horse speed much slower while in water. How much slower?
  • Disable Jump and crouch while in water

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

Re: Outdoor swimming

Post by Interkarma »

Great work, it sounds like you're making good progress! :D
MeteoricDragon wrote: Sun Jul 01, 2018 5:40 pm Right now you can go on horseback while on a water tile, but it messes up the height. I could fix it, but I don't think you should be able to mount/dismount a horse once you're on a water tile. The question is how do we inform the player of that restriction when they try to do it on water?
It's possible to change riding state while swimming in classic, which unfortunately means we need to work past this issue and find a way for it to work like classic. Anything else would need to be a temporary limitation, as sooner or later someone is just going to flag this as a bug. But I'm happy for it to be a temporary limitation to start with until you have time to work on this more.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

Interkarma wrote: Sun Jul 01, 2018 11:01 pm Great work, it sounds like you're making good progress! :D
MeteoricDragon wrote: Sun Jul 01, 2018 5:40 pm Right now you can go on horseback while on a water tile, but it messes up the height. I could fix it, but I don't think you should be able to mount/dismount a horse once you're on a water tile. The question is how do we inform the player of that restriction when they try to do it on water?
It's possible to change riding state while swimming in classic, which unfortunately means we need to work past this issue and find a way for it to work like classic. Anything else would need to be a temporary limitation, as sooner or later someone is just going to flag this as a bug. But I'm happy for it to be a temporary limitation to start with until you have time to work on this more.
All possible height transitions now work. Now I got to fix loading save game handling.

The code is over 400 lines long now.

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

Re: Outdoor swimming

Post by Interkarma »

Good job! When you post the PR, I'll take a look and offer any feedback I can. Between all of us, we can likely find a way to trim things down. :)

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

Interkarma wrote: Mon Jul 02, 2018 8:44 pm Good job! When you post the PR, I'll take a look and offer any feedback I can. Between all of us, we can likely find a way to trim things down. :)
Thanks, first PR is up. Comment details finished stuff, bugs, and unfinished stuff

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

Re: Outdoor swimming

Post by Interkarma »

Thank you! Will get that merged to a branch soon so we can all test.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Outdoor swimming

Post by MeteoricDragon »

I have the sounds complete, and I'd like to test the swimming outdoor feature with a fast character. What console command can I use to raise my character's swimming skill?

Post Reply