100 Days of VR: Day 7 Creating a VERY Simple First Person Shooter

posted in From Zero To VR
Published September 14, 2017
Advertisement

Welcome back to day 7, after the behemoth that was “yesterday’s” Survival Shooter tutorial, I’m itching to get back to coding something.

At this point, we have gained enough experience to start making some very simple gameplays on our own. And that’s exactly what I’m going to do!

Note how I say gameplay and not a full game.

In the future I’d like to be able to create a full game, but for now, I’d like to just focus on just being able to put what I learned to use.

Now the question is: what shall we make?

The answer: A first person shooter!

Why an FPS? Well, that’s because:

  • There are a lot of tutorials showing us how to make an FPS that I can reference.
  • I hope I can use this project as a base to start porting over the VR game logic.
  • How different could it be from Survival Shooter?

So let’s get started!

What I’m envisioning is a First Person version of the Survival Shooter that we just finished:

  • The players spawn in a simple environment.
  • Different types of enemies will spawn that chase the player.
  • We shoot them until they finally bring us down.

Also from this point on, these posts will probably finally be a lot shorter as each day I’ll be trying to figure out new code while writing my experiences.

Creating the environment

Getting assets for the environment

If there’s anything I learned from the past 3 tutorials is that we have to first setup the environment.

In the past 3 tutorials, everything has been provided for us, this time around, we have to somehow create them ourselves.

How hard could that be…. right?

Luckily thanks to the Unity Asset Store, I was able to find a couple of generous free 3D environment development kits.

The specific one that I’m interested is the Mega Fantasy Props Pack

 
0*9KM58056Y04RFWG4.png

I clicked download and then click Open in Unity. From there that launches the Asset Store in Unity.

Prior to this point, I already created a new project called First Person Shooter.

I downloaded the pack inside Unity and then imported it to my game.

You’ll see this folder in your Assets folder in the Project pane

 
0*CedDF4K26QI_5NOX.png

(Note, I also already created a Main scene)

From what we learned in the Survival Shooter from the previous tutorial, we’ll create parent environment object for everything.

After looking at the assets, I noticed something: there aren’t any assets for the floor.

After digging around, I found that Unity has their own terrain editing tools.

Using the Terrain Editing Tool

To start working with the Terrain editor, right click in the hierarchy and choose 3D Object > Terrain to create a terrain game object:

 
0*ED9U9j4FF-N2vEwi.png

Our terrain is just a white plane, however playing around with the tools provided, I learned a bit about how to make a floor.

The first thing to do is to change the size of the terrain.

Clicking on the terrain object, click the cog setting option and then under resolution, change the Terrain Width and Terrain Length to 200 to make it smaller

 
0*3o-pa4DEhaah4BSo.png

Next we want to change the material of the ground.

Under the Terrain component, we can select the 4th option to paint with a texture.

Under Texture, we want to add a texture, in this case, I’m going to pick the grass material that was provided by the Asset kit, specifically grass_1_fixed_d

Also after experimenting around a bit I found that being setting the size of the terrain to all be 1 makes everything looks better.

 
0*0jBsnYG87Ib0fv5H.png

And when you apply these settings you’ll have grass at its finest:

 
0*g-PVl27X-rcO-vUj.png

Ah grass!

I found out that you can add multiple textures to our “artist canvas”.

Once we have multiple textures, we can select our “color palate” and pick one of the multiple Brushes available to paint in the terrain.

Let’s add another texture to our terrain: Dirt_1_fixed_d and add the same settings.

 
0*kPUe1Yj7nKuCAtE2.png

Now we can paint around on top of our terrain.

I’m going to paint the center of the Terrain with dirt. This will be where we’ll add all the houses and other structures.

We’ll have something like this. Masterful, I know!

 
0*AqU6uBua6AQGYS1g.png

We might come back to this later (or spend an even longer time looking into how to make better terrains), but I think this is good enough for an example stage.

Before I move on, I do want to point out that there are other nifty features that you can use with the terrain system such as:

  • creating hills
  • adding water
  • adding trees and other simple foliage

However with all of that being said, I’m not going to play around too much with those features.

Adding the building

Now that I have created the floor, I’m going to go back to the prefab of the Mega Fantasy Props Pack and start laying them around our dirt patches.

Maybe add a couple of houses in:

 
0*2OxDHODnQGgn_akz.png

Maybe create a backyard by using the fences prefab, manually duplicating (ctrl + D) them, and manually move the new pieces to form a fence.

I created an empty object, Backyard to hold all of my fence pieces:

 
0*q7-KVC3Jo2KUK4d-.png

Make sure to include some space for the players to run into the backyard!

We also want to be able to run on the houses. Let’s add a stair to the roof of one of the houses, like so:

 
0*twrvRPpWFuRRK34J.png

This will be good enough for now.

There’s a lot left to be desired in the map, but for creating a simple environment for us to walk around, I think this is good enough.

Feel free to explore around and add some beds, shelves, and other miscellaneous things in and around the house, however, I’m going to call this a day and move on to the actual gameplay starting tomorrow.

But before I leave, I organized the environment together with an Environment parent object:

 
0*nc7_zbrPo9l1XYbv.png

Conclusion

See? Isn’t that much shorter than the past 6 days?

This might seem relatively shorter than the previous days, but that’s because I’m investigating while also doing some write-ups on the problems encountered, so please bear with me.

Today, we learned more about using assets from Unity’s game store and how to use the terrain system.

We also setup the assets that we downloaded.

Tomorrow, I’m going to start looking into how to create a character that we can control around and move.

Original Day 7

Visit the 100 Days of VR Main Page

0 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