XaiJu
tgednathan
tgednathan

patreon


Devlog #10: the Door/Movement Problem

Puts on a tropical crown

I like to move it move it

I like to move it move it

We like to?

MOVE IT!

There we go. Perfect song intro that fits.

Reader: Hey Alice, why is it so short? I thought you liked making lengthy parodies and getting paid for it.

Because people only know that part. Also, don't say the quiet part out loud. Now sit your ass down. IT IS TIME FOR A NEW DEVLOG!

YEAH THAT'S RIGHT. This time we will be walking through something known as the door problem. Any questions

Reader: What is the door problem?

Well if you could be patient for just one moment CLYDE than I would explain it.

The door problem derives its name from a door. Doors in video games seem simple in real life. Pull the handle. Open the door. Walk through.

Well, in reality, it is a lot more complicated than that. For if you think about it there are actually a lot of steps in between.

  1. Visually locate the door handle

  2. Move your hand to the door handle

  3. Wrap your fingers around the door handle

  4. Rotate the door handle down

  5. Pull your arm back. Keep your hand on the handle.

  6. Release the door handle

  7. Walk through

All these steps need separate operations and calculations. Now why am i telling you this? Any guesses? Clyde

Clyde: Because it leads into the main point

Clyde shut the fuck up. If I wanted an answer, I would have asked

Clyde: Wtf...

Anyways! I am telling you this because it leads into our main point. That being that simple things are often more complicated than they may appear.

Like, for example. MOVEMENT. That's right! This devlog is all about how you move that booty and body.

Agai,n it may seem simple. Simply move the player given on input. W is forward, S is back etc. Again, my dear reader, it is not that simple.

If you give these to the character controller, it will move the player in global space, which means that no matter your orientation, you will move in the same directions.

So first, we need to translate the movement into the player's local space. Only then can we apply the movement. Still we can't apply it directly! because that would be easy and easy is not a word we use in this business.

We apply the movement input to the character's velocity. Then, using that velocity, we calculate the final movement.

All that for just simple X Y movement. Best of all. THIS HAS NO LIMIT. Nor will it slow down on its own. Meaning you are basically frictionless.

So we still need to add a velocity cap, automatic deceleration, and translate the current velocity when the player turns!

When we are finally done with that. We genuinely have basic XY movement

Can anyone tell me what's wrong with this, though? Clyde?

Clyde: Uhm.. me?

Yeah, you, Clyde. I asked a question. Come on, answer.

Clyde: This is only...

CLYDE SHUT UP! I was talking! detention! See you after class.

Anyways. This is only a two-dimensional movement. As you might have guessed. This game is 3d. So we still need to add jumping! Rather simple. Add a bunch of vertical velocity. When in the air, accelerate down by the given velocity. When we get to the ground, reset to 0.

There we go, a simple 3d movement system that works perfectly.

Nathan: Hey Alice. I want inclines the player can move up like stairs.

You what?... Righto. I will get right on that. Slams head through wall

I kid you not. I spent literal weeks. WEEKS (I mean I only work one to two days a week but still). working on this. Like... Research. How the heck do we integrate it with the cutscene system? How do you smoothly move a character up stairs and ramps? How do you make it so you don't teleport to the top of a wall?

This my dear readers. This was where I eventually gave up. I saw the writing on the wall. It was not feasible for me to do this. I told Nathan about it and gasp recommended we purchase a third-party piece of code that handles it all.

Fricking sue me. It was either 10 hours of work trying to get it working. Or $40. We all know which was cheaper and more effective.

So. After we purchased that. Learning it a bit over like 1 hour and integrating it into our game. I can rightly say we made the correct choice. It was way easier to integrate into the cutscene system as well. It was easier, more efficient and cleaner.

So. What is the moral of this story?

When you find a door. Bash your head into it for a few weeks then pay someone 40$ to install a new one that opens automatically.

With that i will leave you! Now excuse me as i use the force to open this door.

ALICE THE SITH CODE GOBLIN AWAY!

PS: If everything goes alright Nathan and I should be on the plane to NYC when this gets posted. If you read this devlog and plan to attend the event.

Come up to me and tell us a good pun. You might get smtn in return. I'll be wearing the same stuff as in the drawing of mine. Same hair as well. Hope to see y'all there!

Devlog #10: the Door/Movement Problem Devlog #10: the Door/Movement Problem Devlog #10: the Door/Movement Problem

More Creators