First Game Design (Part 6)

So, we’ve got a world which has been roughly designed and some things to look at, but what can we do inside the world? Currently? Not really much besides collect coins and kill a giant rat…not too exciting. How about we add some more to do? Like a quest? Good idea!

This time around, we are going to add in a text box, an NPC as well as show a bit more bout some box colliders and lighting. First thing, the box colliders and lighting just to get them out of the way. As you may remember when the bridge was constructed, as well as the starting buildings, the box collider was added in order to not walk through the objects.
Not sure if I mentioned it before, but there are two methods I know of to go about making the box colliders work properly and look nice. The first, which I do not use is to make a game object (cube) with box collider on. From here, you size it to the area you need and then un-click the render mesh box to hide it from view of the players. This is the easier and better method to use for beginners as it gives them more control over placement and sizing of the collider.

Box Colliders on Object.PNGThe second is my preferred method, adding in box colliders to the object and sizing and moving them based on dimensional values. Just to warn you, this is very tedious and consumes a lot of time to make the dimensions correct, but I feel that it helps keep things cleaner with less game objects in the long run. The choice is yours, but that’s just my preference.  This is just a sample of what the dimensions look like for my walk-in building’s box colliders.Box Colliders

Next up, lighting. This can be done in several methods; from putting in a directional light such as the world light which we did at the start of the design process. The intensity of which controls what time of day it is, or you can put in spot lights and point lights. When adding in a light, I used another model provided by Jimmy Vegas for a lantern. Once I placed the lanterns in their respective places, I added in spotlights in the four directions of the glass on the lantern in order to give it a more realistic feel. One issue I did notice with the lights was that it would not render or show on all surfaces fully as a section would just be cut off from the light shining on it. I was not able to figure out this issue, but play around and see what you come up with if you too encounter this!Making Lanturns.PNG

Now time for some new stuff! So, if you’re familiar with games, you know that the text boxes are vital in order to communicate with the NPC’s (Non-player characters) of the world.Create Canvas.PNG The first thing we need to do is bring in a canvas in which to display the text; go to the Game Objects menu and scroll down to UI option and down to Panel. I included an image to show where to go if you’re not sure what I mean.

What this will do is create a giant box in the sky which will have a canvas, panel, text, and Event System popping up in your game objects window. For now, ignore the Event Systems item and focus on Panel, Canvas and Text.

To start, we are going to need to display the panel, as this is the background on which the text will display. To do this, click on the Panel object to open it’s options. On the right side, you should now be able to position, size and color your text background. The color can be set to anything you want, just make sure you also adjust the black/white bar to give it transparency or opacity to your liking as well. Next, we can select the Box with a circle in the center just below the option menus:Tool Bar.PNG

Starting Text Box.PNGThis will  allow you to drag and adjust the panel to the location you choose. I decided on a bottom location with a transparent purple color. This is up to you, design it to your liking or your game design. The same can be done with the text, and if you want to center it in the panel, drag the object onto the panel and zero out its location to make it in the center. From here, I used the location dragging tools to make it down and center as well as expanded the text box to fit the panel not quite fully, but more evenly. From here, I duplicated this work and drug a second box up to the top right to make a Quest Tracker Log which can be seen in the Featured Image of this article.

Also, one more note, since we don’t, or at least I don’t, want the text box visible constantly, I just un-clicked the box at the top to make it invisible during play. Next time, I’ll add in a pre-made NPC and give them some dialogue to direct the player on a simple quest! I know I said I’d add some of this now, but the post has been long enough in my option and you should play with these options before moving on. Thanks!

Advertisements

First Game Design (Part 5)

Alright, like I’ve promised…enemies are now in the game! But here’s the thing…its a first attempt at this sort of thing, so it’s starting out simple.

Getting started, as you can see in the featured image above, the enemy is represented by a standard capsule game item. This is just to get the mechanics down prior to implementing a more complex, moving and textured/modeled enemy. Upon creating that enemy, two scripts are needed:

  1. Enemy Health
  2. Damage per Attack

So, first we will start with the Damage per Attack script. This is, as all the other scripts have been, JavaScript and added into the FirstPersonCamera object. Instead of placing the script directly on the camera however, a new empty object should be placed under the Camera which then inherits the script. As far as the script goes, here is what a sample script could look like:Attacking Script.PNG

 

So this script does a few things: First, it sets up an attack damage value. This is set up by the hitpoints variable, which is currently set for 10 damage per hit. You can name this whatever you want, just make sure you remember what its called to reference later. Secondly, it gives a range of attack. If you are standing outside of that range, the damage will not be applied to the enemy or target. This is of course represented by the variable range. Down later in the code a variable DeductPoints is reference which will appear later in the next script.

So, speaking of the next script, this second one will go into the capsule that was created to allow for health points, deduction of those points and ultimatley the ability to destory the enemy once it’s killed or health reaches zero. Here is what that code should look similar to:Enemy Health.PNG

With this, we’ve given the enemy 50 health, which if you remember earlier, we declared our weapon to do 10 damage. This means when the simulation is running, we should be able to hit the object 5 times and it will be ‘destroyed’. The other thing I want to point out is the DeductPoints which I mentioned in the last code. Here, its saying to deduct our attack damage (which is named hitpoints) and take it away from the enemeyhealth (set to 50) each time we are in range and attack with our weapon.

Now we have a stationary target which can be whacked to your hearts desire…until it dies of course. The values presented in this can be altered to your own specifications, but are valid for test purposes.

First Game Design (Part 4)

A lot has happened since I’ve last posted, so I’ll try to catch up to myself. I do apologize as I’m trying to keep a regular blog post schedule, but with other events and spring rapidly approaching, I’ve been side-tracked here and there.

If I remember correctly, in my last post I had just finished placing the spinning coins around the map as well as adding textures to the terrain to give a more life like appearance. Well, since then I have:

  1. Added scripts to allow collection of the coins.
  2. Added a teleport system to move the player character to another location within the map.
  3. Continued changing and shaping the terrain.
  4. Given a swing-able weapon to the player.

Capture3.PNGStarting with the addition of collection script, this was achieved through some manipulation of a previous script as well as the addition of a counter placed in the user interface area, allowing you to see the coin count as you collect them. Within this code, you can see the script calling upon “coinscollect” which is linked to the coins placed around the map and as each one is destroyed, the counter is increased.

Next up, what I found to be a very arduous addition to the game was the teleporter or transporter for you Star Trek fans. The premise of this is to step into a location and have the player character be transported to a pre-designated secondary location in another location on the map.
Sounds difficult to start, as getting the player to randomly spawn in another location just sounds like a nightmare. In reality, the code was simple enough, but the design of the transporter was what gave me the most trouble.Capture9.PNG

After getting the code settled, it was a matter of getting both transported sized correctly, getting the script in the correct place (which the guy doing the tutorial mixed up a few times as well), and then animating the transporter. Now, the animation is a new thing for me, and some of you may not know what that is. Unlike the coins, where the script instructed the object to rotate at a constant rate, an animation where different positions are mapped out and combined over a time frame to give the object motion. This was also applied to the weapon later on.

Once the transporter was done, I initially thought to just duplicate my object before the animation was done. This was not a good idea and I recommend you make the final product (without attaching the script) before you duplicate it. This way, your animations stay the same and you’re able to just relocate the second transporter pad.Capture.PNG

This is roughly what it looked like before the texture and animation was added to the warp portion.

Next was addition of textures and reshaping the terrain which I’ve covered before, so I won’t dive into details with that. You can see the final product of that work  in the Featured Image of this article.

Last up is the weapon. Upon hearing that I was going to be learning to place in a weapon the game, and be able to use it made me ecstatic! I know this may seem like a small thing to some of you, but seeing as this is my first game, I’ve not done this and it gives me great joy to know that I can now implement this with other items later on.

To start, the tutorial instructed to simply use a cylinder to shape the weapon (a texture will be added at a later time). Then, that object is to be housed within the FirstPersonCharacter in order to have it move with the player and not remain stationary. Yes, this weapon is already equipped and cannot be dropped at this point…but who cares? You can smash and slash things!

Capture6.PNGAnyways…as mentioned before, an animation was added to the weapon to allow for it to move upon execution of a ‘swing’ key and code which will be added shortly. Then, after the animations completed, a key biding is made to allow for the weapon to act out the desired animation upon activation of the chosen key. Something I did struggle with here was that an ‘error’ message kept popping up to make the animation a legacy file. This example her is the area on in the program to find that. Under the debug option in the settings panel.

I know I glossed over some of these details a bit, but if you do have any questions about anything, feel free to leave a comment and I will try to get back to you as soon as possible! For the next blog, I should have some combat mechanics to show off! See you then!

First Game Design (Part 3)

There is a lot more that goes into game design than I had originally anticipated. Textures, normal mapping, script writing and modeling were all components I knew about and understood some fundamentals to get the ball rolling. What I did not understand was the amount of time and patience to perfect each detail, placement of elements and the combination of tools and components to create the elaborate environment of each scene. This is something I’m seeing myself spend more and more time between adding new elements playing with to get the product that I want.

So, here are some new things I’ve added within my first game:

Movable objects are a big part of most games, being able to interact with the environment is vital in order to feel like you are a part of it. So, with that in mind, I wrote a quick script (using Java) to allow the player to pick up items with the script embedded in them. Here is a quick sample of what that code looks like:pickup

For those of you like me, who have not used JavaScript before, it’s object oriented and the syntax is similar to C# which is what is used to program Unity. A good place to start if you are more serious about using these programs would be to learn the in’s and out’s of these languages.

Besides the movable objects it was suggested by the tutorial series to add collectibles. These sort of items are found all over the place in RPG’s and one of the more exciting elements. This too was done with the help of JavaScript:destroycoin

spincoin

The first script is to allow the object to be ‘picked up’, in other words, once the players character enters the radius of the object, it destroys the item for that play through in order to give the appearance of collecting it. The second script is purely for effect; it’s goal is to spin the collectibles to give it some element of importance to the player.

Apart from these elements, I’ve only touched up the map a bit to add more trees and details. So, until more progress is made, this is where I’ll leave you! Capture8.PNG

 

 

First Game Design (Part 2)

Last I left off, I was designing a basic scene with a ground, building and first-person camera. Starting back from there I made a few leaps forward which I’ll go over to the best of my ability.

Initially, I did get rid of the ground plane and replaced in with the terrain model. This was not something I was expecting to do, but as I mentioned in Part 1, I am loosely following along with a YouTube tutorial series which did the same thing. I assume this was done to illustrate the skill, and the same process was done to texture the terrain.capture3

**The terrain will be much larger, much, much larger than the plane, so try to zoom out in order to center any preexisting structures if it’s not the first thing implemented into a scene.

Capture4.PNGUpon adding a terrain, you are given some new tools specific to the terrain such as manipulation and painting tools. With these you are able to create ridges, hills, mountains or valleys to your hearts desire. Along with this customization, you have the ability to choose different brush styles, set the size and opacity (how much detail to put forth per click). Be careful when you are clicking. I found that sometimes when I clicked, more and more detail was piled on than intended. Ctrl + Z will become your best friend during the terrain manipulation stages.

capture9Something else nice about the terrain is that it allows you to place multiple textures onto its surface, and allows overlapping. To add textured, click on the paintbrush option in the Terrain and go to the edit Textures, then add Texture. It will prompt 2 slots: Normal and Splat, to get a clean solid texture, drag the desired texture into both of these slots. You can mix and match to get unique looking textures.

The water drop over the mountain tab is smoothing. This will allow you to smooth out any rough edges you may not want on the hills or mountain s you’ve created. Again, keep Ctrl + Z handy.

Finally, after my terrain was manipulated to my liking and textured to satisfaction, I added water. This is done similarly to how the terrain was added in via the Assets folder. Once downloaded and working in the program, water disk can be dragged into the scene. This picture will illustrate the folders to search through to locate the model:Capture6.PNG

Once the water was in place, the only thing left to do was change the dimensions to encompass the entire area I wished the water to cover. Once that is settled, raise or lower the water to the height you wish it to be and then explore!

By play testing at this point, it allows you to see if the terrain is to your liking, if you missed any spots or have any problem bumps, shadows or holes in the map. I did have issue with some shadows being in the wrong areas and had to add extra bumps and hills then smooth them out to get it to look proper. One issue I’m sure I’ll figure out later is that the water, no matter how ‘thick’ you make the dimensions, will be a single layer and will not have water effects if you walk into and under the surface.

Well, that’s all for now! Thanks for reading!

First Game Design (Part 1)

Anytime you start a new project, challenges are sure to present themselves in unexpected ways. I’m going to be showing you my first basic game design here and explain the challenges and tips and tricks I learned along the way. I will mention that I am roughly following along with a YouTube tutorial series from Jimmy Vegas. I would highly recommend you check him out.

As you can probably tell by some of the screen shots to follow, I am working in Unity. If you have not yet opened this program…here is a first look at some simple object creation and positioning.

game-design-new-project

To start, I will creating a simple scene and expanding from there. As most scenes begin, the ground should be established with a plane then stretched using the scale option on the right side of the screen to fit the desired size. To start, I’ve found that a smaller ground area is better until the size of the scene is determined.3D Object Selection.PNG

Once that was established, I created some walls along with an empty object which was used to combined the walls into a unified object. This allows for you to move all of the walls together as a single object rather than dragging each one and having to realign them.

Once the scene is built, it’s time to establish textures in order to give the scene some life. My favorite texture site to use, which I found during my exploration with Blender is Poliigon. By registering , you get 50 free textures along with all the ones that are designated to be free.

After finding the textures I wanted to use, I set up each object with a different material. I did find however that setting up the textures and materials, Unity registered the materials as normal maps. In order to get just the color to show rather than an actual texture. I moved the textures into a new ‘texture’ folder and drug them directly onto the objects.

**Find images which are able to repeat or are ‘seamless’. This way, the textures look more natural.

capture5Once the textures are placed, it will create a new material which is automatically applied to the object. The last bit to do in order to inspect the scene fully is to add a movable character into the scene. This is done by adding in a new Asset, and importing the Character asset. This may take several minutes, but once added, you can add in a first person camera to explore the scene!

I’ll be sure to post more, just as soon as I get further along with the project.