# Creating CS:GOs air acceleration/ air strafing

I have been trying to figure out how to recreate the surfing system you will find on CS:GO accept it’s not really a system it’s a command that allows you to change the Acceleration you undertake whilst in the air. But there is more to it. When. Jumping in a place or a straight line you go no where. But when. You begin. To jump in a zig zag formation aka strafing you begin to pick up speed. Also to stay on ramps you are required to hold the key facing the opposite direction of the side of the ramp your surfing on (e.g. Right = A Key, Left = D Key)

Anyone who can give me any insight as to how to create this would be super helpful

4 Likes

To do this, you’d need to replicate how the Source engine’s movement works. Maybe this article on bunnyhopping could assist you.

3 Likes

Bit difficult for me to understand C++ although It looks familiar. It appears there are hard coded parts of Quakes engine that makes strafing possible that would be difficult to replicate on Roblox is there a way you can explain this using lua that may help me grasp the idea?

2 Likes

I’m planning on open sourcing my bhop/surf game in the future. Although I’m not able to explain it in full detail right now, you should try to reading through the Quake III Arena source code. Explaining it through a devforum post won’t be much help.

1 Like

While some parts are hard coded into the game, creating a version that works with Roblox Humanoids shouldn’t be over the top. Your character is constantly accelerating when they’re moving based upon inputs you’re providing the controller.

Lets set some quick ground rules;

• v3 = Vector3
• X axis, -1 is left, 1 is right, 0 is stationary
• Y axis is our jump input, 1 is jump, 0 stationary
• Z axis is our forward/backward input, 1 is backward, -1 is forward, 0 is stationary.

So, lets say we want to move forward, we let our input be v3(0,0,-1). Our humanoid has a walkspeed of 16, so this is fairly simple to translate to say we want our humanoid to move at 16 units.

## Our movement = v3(0, 0, -1) * Humanoid.WalkSpeed = v3(0, 0, -16)

Great! We’re now moving at 16 units! Lets do the same with going right!

## Our movement = v3(1, 0, 0) * Humanoid.WalkSpeed = v3(16, 0, 0)

Again, awesome, still goign 16 units. But something funky happens when we combine the two.

## Our movement = v3(1, 0, -1) * Humanoid.WalkSpeed = v3(16, 0, -16)

Whoa there, we aren’t going at 16 units anymore! We’re going juuuuust slightly too fast.

This, while not directly what you’re after, is an incredibly easy way of looking at this problem. You can simply tell your humanoid to increase WalkSpeed from your base walkspeed while your inputs result in this and your Humanoid is in the Jumping/FreeFalling State. And when we’re not, we simply iterate back down to our regular walking speed.

Is this a substitute for bunnyhopping? No, you’ll feel the difference in a big way, it will take some time to get used to. But it is a good introductory exercise when talking about this kind of thing.

Once you’ve got this down, start looking at the accelerate function and how it’s being called. Deconstruct it into lua, and then pair it with what you’ve got.

Edit: Apolgies, the end here is a bit naff, but I’ve got to leave for work. Might return later tonight to clean it up.

8 Likes