How to make a First Person Shooter game in 20 min
So you love playing Call of Duty, Far Cry or BioShock. You love nothing more than shooting people left and right and chanting war cries at the screen. You think it’d be cool to make your own version of a First Person Shooter game, but you don’t know where to start (or think it would be so much work, you’d rather leave it aside) . But Confucius say a journey of a thousand miles begin with one step. And Confucius say that step begins with you downloading UDK.
Unreal Development Kit (UDK) is a free edition of Unreal Engine 3, that gives you all the tools you need to create game levels and make awesome FPSy stuff. In this tutorial we’ll explore some of the built in features of UDK that you can use to create a mini FPS game all by yourself (and using no code at all!).
This is how your UDK interface will look when you first download it. Although the interface looks messy, it gives alot of control. There are builder brushes (check out left panel) to help you make different objects in your game. You can use CSG (Constructive Solid Geometry operations) like add, subtract, intersect to create objects, remove objects from inside them, and carve out a whole level.
For this tutorial we will be downloading a UDK file that has a pre-made structure inside it. Download it from here.
Open the file from UDK, and save it in the following folder:
- For example: C:\UDK\UDK‐2013‐07\UDKGame\Content\Maps\Map1
This is the official place where Unreal likes to look for maps, so get into the habit of saving everything there.
First things first — You should go to View > ViewPort Configuration > 1 x 2 . This will give you the current view that I have posted below — a look inside the game level itself, and top and side views. This makes things easier to move around or edit.
The next step to test the level is to Go to Play (on the top menu) and then to “Play in Editor”. Ignore the warning messages or errors,they will not interfere with our level. This is the view you should get:
This is similar to “Building and Running” as we would do in Visual Studio. Pretty cool right? Move the player around, shoot from the gun, check out enemies in the vicinity. All these things come in inbuilt when you prefix the file name with “DM”. DM stands for Deathmatch, which is the simplest kind of game to make in UDK. Other types of games include:
- Capture the Flag (CTF)
- Vehicle Capture the Flag (VCTF)
- Warfare (WAR)
So, if you want to make a Capture the Flag map called FirePits, you’d name it CTF‐FirePits.udk. That will give you all the built in featured of a CTF game (which is pretty cool on its own — there are two different teams , you have to capture your flag from the enemy’s base and bring it back to your base).
Adding Gameplay elements
We can get weapon pickups and a lot of other good stuff (like health, ammo) through the Actor Class browser. Go to View > Browser Windows > Actor classes window to access it.
Go to Pickups and choose whatever you like from the wonderful world of UDK.
Once you have it selected, (let’s say UTPickupFactory_HealthVial), go back to your world, and right click on the floor wherever you like, and select “Add UTPickupFactory here”.
You will see the health vial on the screen, something like this:
The arrows depicts the translation mode (You can change the position of the object by moving it in the x, y or z axis.) If you’d to like change other things, you can double click on the object to reveal the properties, or you can use this bar at the top to go into other modes like rotation, and scaling (to make the object bigger or smaller).
Now if you play the game, you’ll see the health vial floating, you can pick it up and it automatically improves your health. In the exact same way you can place weapon pickups within your level. When you double click on the UTWeaponPickupFactory and go to properties, you can choose the type of weapon too (Shock Rifle? Link Gun?). When you play the game, the player can pick the weapon he likes.
Adding jump pads
You can get jumpPads from Actor Classes > Navigation.
The jumppad will allow the player to jump from that pad to a specified destination. The way to do that is to first decide where your player should land — right click on that place, and click on Add Actor > Add Pathnode.
An apple shaped thingy will appear- that’s your pathnode. Now select your jumppad, double click it to open up the properties.
First click on the little lock sign on the top- this will ensure that your jumpPad properties will remain open. Then, Click on your pathnode, and come back to the properties window. In the jumpPad target, click on the green arrow, the pathnode will automatically appear on the target.
Whenever you add pathnodes, its always best to build the game again, so the engine can build the paths you are specifying. You can do it from Build > Build All.
Play the game and jump away.
Teleporters take you from one place to another. Go to Actor Classes >Navigation> UTTeleporter. All you have to do is to place two teleporters (maybe in different rooms). Get to the Properties > Object >Tag and type a name for each of them. In the the Teleporter >URL section, type the tag name of your destination teleporter. You can move smoothly between each teleporter this way!
The final part. An FPS game would not be an FPS game without something to blast into smithereens.
Around the game level, wherever you want to spawn enemy bots (UDK has these cool robots that run around and try to kill you) you have to add PlayerStarts.
UDK Deathmatch allows you to add about 16 actors, so you can place as many as you want around the game making sure they are atleast 128 units apart, so you don’t get an error of “Bad Size”.
Now, these are the places where the enemy bots will spawn. But where will the bots run around? They’re pretty much directionless — if you want them to follow the specific path, you can add pathnodes. In the level I’ve given you, there are already pathnodes in every room — which means the bots will run around from room to room. Make sure to Build all, so that the engine registers the paths.
Then, while the game is running (On Editor or Viewport) press the Tab key. This will open up the console window. Type in addBots 1 (or more till 16) depending on how many bots you want to kill off.
War mode: On!
Check out my next post on adding more fun stuff to your FPS game.
Originally published at techiepolitan.wordpress.com on February 2, 2015.