making my first FPS


So, this project was a first for me in a lot of ways.

not only is this my first FPS game, but its one that uses largely sprites instead of 3D models for enemies and weapons and some npc's and so i wanted to share these things that i've done for this game since i think its worth talking about, along with other things like the dialogue / active cutscenes in the game


HOW DID: EDS

so firstly, i wanted to share the EDS spritework i've done for this game. a lot of people are probably wondering if i did a bunch of spaghetti code for it, but truth be told it was a lot easier to do then what a lot of dev's might think, the only problem i had when it came to doing EDS for this game was making sure that i had actual sprites to work off of IE assets. But enough about that lets talk about how i did it

so firstly i made a sprite facing script that faces the player constantly on the Y axis, with the speed of the facing function being affected by a float that changes the speed of the facing functionality (IE whether the object looks at the player slowly or not). 

Then what i did was create a script that detects where the player is in relation to the sprite in question via Vector3.Dot, which calculates the DOT product of any given object in relation to each other in a 3D space, with the script calculating 2 separate dot products, one that calculates the Forward and Backwards direction of the sprite and the other that detects Left and Right, with those 2 dot products being stored in private float variables, which then feeds into  any available Animator and sets the Animator's Front2Back and Left2Right floats.

after all that, it mostly comes down to using the Animator for any visible result. Now for the Animator i made sure to, instead of creating a bunch of transitions into separate animation files, i decided to go head first into using BlendTree's, which not only helped make things much more cleaner in retrospect but also makes things easier to implement, since you can drag and drop animations into the blend tree and blend the differing animations between each other on the fly. Now, one of the most important things to do is to make sure the blend mode is set to 2D directional instead of 1D because 2D is what is needed for properly blending between animations based on the Dot products, once i've done this everything was basic math, with the forward and left animations being set to the positive axis in the display screen and the right and backward animations being set to the negative axis, etc

and yeah once that's done, just make sure you have an EDS sprites available to use and to make sure you separate each version of the sprite in question, in my case i had to separate the sprites from idle anims, attack anims and walking anims. And yeah, i know my telling of this process might come off as a bit wordy or what not but hopefully to anybody reading this, this will help them out at least in some form or manner


HOW DID: Interactive Cutscenes / Dialogue bits (CONT)

This one was something i had to figure out by myself, but it was pretty easy to understand, basically what i did for the dialogue bits was create a bunch of playable directors that play when the player enters into a triggerbox with a script that activates said playable director via a UnityEvents system. 

but before you make a bunch of playable directors, make sure you create the needed Timeline assets in your project, once you've done that and drag and dropped them into the playable director, you can then fill up the timeline with a bunch of things you need for the playable director, which is how i got the subtitles to line up with the voice lines, etc


and yeah that's all i have to talk about for my first dev log on HFP

Files

HotFreshPizza.zip 120 MB
Oct 31, 2021

Get Hot Fresh Pizza

Leave a comment

Log in with itch.io to leave a comment.