? Weapon Mechanics - Indie Game Devlog #3 ?

posted in N.E.S.T for project N.E.S.T
Published September 16, 2019
Advertisement

▲ Watch the devlog on YouTube ▲

Hi everyone, and welcome back to my devlog!

If you’re new here, I post weekly devlogs logging the progress of the new 3rd-person looter-shooter mobile game I am developing, so consider subscribing to my YouTube channel to follow along!

 

On Monday,

I carried on from where I left off with the shooting mechanics. To recap, the idea is to use two joysticks. One will be for aiming, and the other for shooting and controlling recoil. Aiming was simple to implement, as all I had to do was rotate the spine of the player by the fraction of the joystick moved. Next up however was adding recoil, which was a little trickier. The initial plan was to rotate the player’s spine upwards whenever the player shot, and then use the right joystick to pull down and “control” the recoil.

0.png.e5af4ec4e21a1c864c19d9f52c2e7209.png

Once I figured this out, and my player stopped wanting to be elastic girl… I moved onto adding vibrations whenever the player shot.


On Tuesday,

after play-testing a bit, I felt that having to manually control your recoil was a little too complicated for a mobile game. So instead, I decided on a system that used automatic recoil control, which meant I could then use the shooting joystick for micro adjustments when aiming.

Next I moved onto adding the different trigger types for weapons. By this, I mean that different weapons should fire at different times when using the joystick. Automatic rifles for example, fire when holding the joystick down, while single fire rifles fire when the joystick is released. Throwables on the other hand are entirely different, as when you press the joystick, it should prepare the throwable, and then when you release it, it should be thrown.

I added three events to my custom joystick. OnPress, OnHold and OnRelease, which allowed me to individually set this based on the selected weapon.

Finally, to end the day off, I began creating the system for adding crosshairs.


On Wednesday,

I finished the crosshair system off, and here are some of the crosshairs I was quick and easily able to put together with this system!

1.png.0dde93cf929882b7bb9ef3e4a9b117ee.png

I then moved onto adding a spreading mechanic to the crosshairs.

Once I was happy with that, I got to work on the trajectory system for throwables. Like in PUBG, when you throw a grenade, it shows the path the grenade will travel along when thrown. I used the following formula to achieve this effect:

forumla.png.54115436770895323444bd0e3ab200bb.png

This allowed me to generate a line renderer that connected a pre-defined number of line segments together to form a trajectory that would show the path the throwable would travel along when thrown.


On Thursday,

I carried on with this trajectory system to dynamically update and match the player’s rotation.

I also had to account for an offset so that the trajectory always ended up on the ground and not in the air. I achieved this by calculating the distance the parabola was away from the player at the height of the ground, and then recalculated this each time when rendering the trajectory.

2.png.154e682fb8ee5f96c57f98fee907fb8e.png

I spent the rest of the day getting this trajectory to show when preparing and then actually throwing a throwable, and this ended up looking great!

 

On Friday,

I spent the entire day tidying up and optimising all of my code, and once I was happy with that, I implemented the automatic recoil control system, which just gave it that effect I was looking for!

3.png.6865c3b423d08300ead14ecefec06658.png

All in all, it was a productive week, and I was happy with the progress made.

Thanks so much for reading, and I’ll see you in the next one… take care!

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement