Shooter template

Top  Previous  Next

This month I have started to work at the shooter template. One of the most important things that can make or break a shooter is player's movement code, which has to be very fluid, so I had to be extra careful with this part. I have tested many of the existing shooter movement snippets and I have learned quite a few things from one of  Damocles' old C-script demos. The final version of the code I'm using for the template is very different (and I'd dare to say a bit better) but Damocles deserves the credit - thank you!

 

So what do we have in store? First of all, a full city level that will serve as our playground. The actual city is surrounded by four terrains that use tiny skins, in order to save some space on the disk. I have added quite a few buildings (and some of them can be explored) but I'll probably remove some stuff in the following versions of the template. Right now, this complicated looking level will (hopefully) demonstrate the good quality of the movement code, with fluid motion, stair climbing / descending, good jumping, and so on.

 

aum91_templates2

 

I didn't limit player's movement at all so if you know where to go, you can jump from one roof to the other, etc. Copy the \shootertemplate folder from this month's Aum resources to your Gamestudio installation folder, and then open and run main.c; you will find yourself inside a training area that looks just like the picture below.

 

aum91_templates1

 

Use the WSAD keys to move close to the fence, and then press the "space" key to jump over it. Press and hold the left shift key to double the movement speed. The code is very flexible and well commented; open the t_shooter_player.c file in Sed and you'll see lots of variables that allow you to customize the movement. Feel free to play with them until you get that dreamy movement code experience :)

 

var tshooter_player_speed = 25; // player's movement speed

var tshooter_fwdbk_accel = 7; // player's forward / backward acceleration

var tshooter_side_accel = 3; // player's sideway (strafe) acceleration

var tshooter_friction = 1.5; // player's friction - this value should always be greater than 1

var tshooter_fallspeed = 1; // player's fall down speed

var tshooter_jump = 20; // player's jumping force

var tshooter_resilience = 4; // pushes the player upwards a bit if it sinks too much in the floor

var tshooter_disttoground = 64; // distance between the origin of player's model and the ground (used by the camera as well)

var tshooter_camera_h = 12; // horizontal camera acceleration

var tshooter_camera_h_frict = 0.95; // always use a value below 1 here

var tshooter_camera_v = 8; // vertical camera acceleration

var tshooter_camera_v_frict = 0.8; // always use a value below 1 here

 

I'll see you all next month, when we will get to play with some weapons, baby! Yeah! (Did this have enough testosterone in it? I surely hope so...)