Pt 2: 'Efficiency'

2 0 0
                                    

04/02/2024 - 'Efficiency'

So for Frogcket Launch, I have opted to not create my own character controller. For those that aren't familiar with game dev, a character controller is essentially exactly what it says on the box: A script and game object that is controlled by the player. You won't use a character controller to manage NPCs specifically either, they would have their own scripts to manage them.

Now what Unity has and I am taking advantage of is the Asset Store. Essentially to save myself time, I can simply find a free 3rd person character controller and put it into my game. This also comes with a moving and animated dummy character. Not one I will need, but it functions well enough. 

Because of this, I don't have to waste time implementing jump functionality, crouching functionality, hell the one I am using even came with a Zipline functionality and object script, so maybe I will throw that in somewhere. Fundamentally jumping and walking aren't hard, but in testing, this character controller works pretty well with ramps. 

Ramps are notoriously difficult for game dev for various reasons. You want the player to follow the ramp's angle, while not clipping or floating or anything. A standard character controller would just have a constant gravity applied to it and if you move left or right, it will strictly try to move left and right without regard for vertical distance. 

I suppose the easy way to explain this would be to imagine a box on a hardwood floor. Assume you push it with enough strength to have it go 20 feet in a minute (just over 6 meters for people who live with a measurement system that isn't insane). 

Now imagine a box on a ramp, but instead of it being flat against the angle, instead it is parallel to the ground and only it's edge is technically touching the ramp, everything else is just floating. Gravity is applying to it, but only until it 'touches' the ground, which it is with the corner on the ramp. Now push it 20 feet/minute horizontally in the direction that goes down the ramp. The object will kinda just fly off and then be brought to the ground - moving a lot faster than when it was flat on the ground due to the lack of friction, sort of like pushing a toy car off of a table. Now try to push it up the ramp that same 20 feet/minute, it ends up moving a lot slower. 

This is to basically say a lot of tedious adjustments need to be made to the system, especially even just recognizing that the player is on the ramp. This is usually done using systems of raycasts (basically just points going in a direction to detect something) to determine this and is a major pain in the butt. 

My previous game Z.O.H.A. almost had a multi-level area but I simply could not be bothered to implement this to prevent scope creep. I imagine that 9 times out of 10, if a fully 3D game takes place in just flat areas, someone didn't won't to have to bother with programming ramp logic.

So by using this premade free character controller, I've essentially saved myself several hours of annoying balancing. Now I've just gotta strap a skin and animate that onto the original skeleton of the player, hide the original body that was there (or remove it, whatever doesn't break the game) and voila. Fully functional 3D character with solid movement - ergo, being efficient with my time. 

Also I am doing the same with cars, I can't 3D model well so free car models is just the biggest life saver.

Frogcket Launch - Dev LogsWhere stories live. Discover now