0 SHARES Tweet Subscribe to our weekly newsletter for the latest updates!

First Name Email address: Leave this field empty if you're human: We promise not to spam you and not to give away your mail address. Read our privacy policy.

CodeProject

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!

Like what you see? Subscribe to our Newsletter! Do you like what you're reading about Unity game development? Sign up to our email list to be the first to be of new tutorials and content! SUBSCRIBE

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

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

(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:

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

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.

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

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.

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!

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:

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:

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:

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:

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.

Day 6 | 100 Days of VR | Day 8