Introduction .com



Unity 5.x Video GameCodie MartinCIST Capstone Spring 2016Table of Contents TOC \o "1-3" \h \z \u HYPERLINK \l "_Toc449656604" Introduction PAGEREF _Toc449656604 \h 3Goals PAGEREF _Toc449656605 \h 5Research PAGEREF _Toc449656606 \h 6Progress – Starting Out PAGEREF _Toc449656607 \h 8Progress - Middle PAGEREF _Toc449656608 \h 12Progress – Final Stretch PAGEREF _Toc449656609 \h 17What Changed PAGEREF _Toc449656610 \h 21What Could Be Changed PAGEREF _Toc449656611 \h 22What’s Next? PAGEREF _Toc449656612 \h 24Conclusion PAGEREF _Toc449656613 \h 26Glossary PAGEREF _Toc449656614 \h 27Raycasts vs. Colliders PAGEREF _Toc449656615 \h 28Figures PAGEREF _Toc449656616 \h 29References PAGEREF _Toc449656617 \h 32IntroductionI’ve been playing video games since the original Nintendo, and my lifelong dream was to make my own. This dream petered out somewhat in recent years, as I learned how exploitative the game industry can be; crunch periods towards the end of development where employees have to work 12 hour shifts for months straight to get the game out in time, the recent shift to mobile and free-to-play games designed to trick children into spending hundreds of their parents’ dollars on digital vegetables, and control of development being given to businessmen who let focus testing and market trends decide their games. Even disregarding that, before my time at Pitt Bradford I had little confidence in my programming abilities, as past attempts to program resulted mostly in headaches and failures to compile. I’ve only ever had success with HTML, which isn’t actually a programming language. Plus, I worried that getting a job in video games, particularly big budget, high stress games with the aforementioned crunch periods, would be a great way to make me hate video games. So it seemed like game development was out of the question. While game development was incredibly prohibitive in the past, where any developer had to either code the game from scratch with a low-level language like Assembly or pay a steep fee to license another developer’s engine, in modern times there are many game engines available for small studios and even solo developers to use, including Unity, Unreal, Crytek, ClickTeam Fusion, GameMaker Studio, and Axis Game Factory. The most popular of these engines right now is Unity (if not, it’s a close second behind Unreal). Unity is a flexible engine, and comes with a store where developers can purchase and download game assets other developers made to use as groundwork for their own game, and it’s free until the developer makes enough money in a year, at which point they either have to buy a full Enterprise Edition or pay for a monthly subscription. Unity is meant for 3D games, but late into Unity 4 2D support was added. Unfortunately, Unity’s advantages have been somewhat of a drawback for it, as its ease of use and asset store allow inexperienced developers to throw together buggy, generic games and try to sell them for upwards of $20. This has left Unity with an undeserved reputation as a garbage engine. But it’s hardly the tool’s fault when people try to use it as a get rich quick scheme.I chose to develop a video game because I felt it would be ideal to combine my previous Art Studio degree and my in-progress CIS&T degree. I chose Unity specifically because it’s what I worked with in my Game Development class and is the engine I’m most familiar with, though that’s not saying much. Unity has the most learning resources available of any engine, ranging from print books, to Lynda courses and YouTube videos, to Unity’s own community where developers can ask for help. Also, Unity is programmed with C# and Java while some other engines like GameMaker Studio use their own proprietary languages. So if nothing else, it’s a way to practice coding in in C#.In my Game Development class I created a prototype mascot platformer featuring a cartoon cat looking for treasure. It was functional for what it was, but also clearly unfinished. The levels were hastily drawn in MS Paint, and had no enemies and barely any hazards. Two bosses did nothing but move around, one boss was just a pencil sketch on a white background, and the fourth boss shot projectiles that shot harmless through the cat. At least that boss had to be stomped on to kill it, while the others had their treasures lying on the ground to run up and take.But at least game development was starting to look feasible.GoalsWhen I first planned this project, I promised myself the world. My initial goal was to have a prototype with three selectable characters with different abilities, an item dropped by the boss to grant each of them a new ability, an area where the characters could talk to non-player characters, and I even proposed a second level and boss to do if I had time left over. Then maybe I could train one of my cats to bring me chips so I wouldn’t have to get up from my work.A more realistic goal was to learn to program enemy AI. As I said earlier, my Game Development class prototype had bosses that did nothing but wiggle around; there weren’t even any lesser enemies populating the stages. Even if I had to strip the game down to one boss that walked back and forth across the screen, that’s at least the groundwork to building more complex patterns.I also wanted to make the cat attack. The one active boss in the original prototype did react to the cat jumping on his head, Super Mario Bros. style, but I also wanted the cat to have a scratch attack. This would require creating a collision area, a way for the game to know when she’s attacking, and how the enemy should react to a scratch.And if nothing else, at least I can build up my confidence that I can program with the correct amount of time.ResearchMy research was primarily focused on tutorial videos with a little help from print books. However, because Unity is constantly updating most of books written for it are out of date by the time they hit the stores, and YouTube is full of videos for older versions. Unity 5.x is good at updating code written in Unity 4.x on its own, but the program’s interface was also changed slightly in the upgrade to 5. When a tutorial tells you to click something that doesn’t exist in 5, you’re on your own.While Unity may have the most resources of any game engine, that means it also has the most bad resources of any game engine. Too many times have I tried to find a tutorial on how to program something, such as a character select menu, only to find countless videos showing how to use a tool downloaded from the asset store. The worst so far has been creating character dialogue from an XML file; I have yet to find a video showing how to do this with straight code instead of Dialoger, XML Importer, or something else bought off Unity’s store. Even one of my print books featured a segment on dialogue, only for it to be a quick walkthrough on a free tool called Fungus. I realize I’m already using a tool to create a game so it seems weird that I’d object to using a tool for dialogue, but I’d like to know how to code dialogue trees the hard way even if it’s just for curiosity’s sake. And all too often, when I finally do find a video on what I want, the video maker mumbles and/or has an indecipherable accent, and recorded the video at an illegible resolution.Through the assignment, the most helpful videos came from , which is to be expected. Anyone can throw up a YouTube video, while videos are professionally recorded with industry professionals tutoring you. Many of the books I found were either out of date or designed for 3D games, and No Starch Press was supposed to have released a book on 2D Unity development at the beginning of the year, but it kept getting delayed and is currently slated for July 2016. One particular publisher, Packt Publishing, has loads of books on Unity (as well as everything from JavaScript to R programming) but the ones I’ve looked through have been poorly written, and the others have mediocre to low scores on Amazon. It’s like Packt specializes in the book equivalent of shovelware.Progress – Starting OutMy first step was to draw the cat I was going to use in the game, and the time it took me to decide on a style should have been a warning of the problems to I’d have later. First I tried a cartoon-like hand-drawn look. Then I redrew her in pixels to save time and keep myself from spending hours on hand-painted scenery, when programming was the main goal of the project. Later on I’d have to draw the cat a third time when I realized she was at a different resolution from the scenery and enemies.For the main code, I started with a tutorial on the 3DBuzz channel of YouTube. This tutorial differed from the one I followed while creating the Game Development prototype, as it used raycasts to detect when the cat was colliding with a wall or the ground. Raycasts are invisible lines that fire out of an object, and depending on what they hit they react differently. In the case of using them on the player, they tell the character to stop moving when they hit an object assigned to a specified layer, such as “Ground”. I thought raycasts would be a good thing to work with, because raycasts can also be used to tell an enemy what direction the player is in and subsequently what direction they need to fire in, where a bullet is going if the game is a first person shooter, and many more important things. Also raycasts that only fire out the bottom of the character would make jumping through platforms more consistent; using trigger zones to disable the colliders on a platform occasionally didn’t work in my Game Development prototype.A few weeks into the project, I felt my foundation in programming wasn’t solid enough; I didn’t even understand what Dictionaries and Keys were, having only seen them once in a spaceship shooter tutorial in Introduction to Game Development, Design, and Prototyping by Jeremy Gibson that I was blindly following. For a few weeks I worked through Python for Kids on the side of my Capstone, which was neither Unity nor C# (the only other language Unity supports is Java), but much of what it teaches can be applied back to C#, or really any other language with a different syntax. Although I don’t know if I should be ashamed or happy that my college-aged self finally understood inheritance when a children’s book explained it with “giraffe” inheriting from “mammal” which in turn inherits from “animal.”One tutorial I found on showed how to create a tile map to use in a pixel game, so that instead of meticulously laying down each tile, you could choose a tile and paint it into a grid. Or at least that’s what it was supposed to do. When I was done with the course, it had a glitch where the painter would place a new tile into a cell of the map instead of replacing the current one. Lightly tapping the key to lay down a tile would lay down ten tiles (see Figure 1); hold it, and one cell could have hundreds of copies of the same tile. Yet when I loaded up the exercise files that accompanied the tutorial, the tile map worked as it was supposed to. I didn’t have the time to go through and bug check every line, but at least I was able to reuse the background tiles I drew for use in the course (the video creator provided sample tiles, but they were of a boring gray hallway).Unity can be unintentionally daunting because there’s so many different ways to achieve the same result. For example, before you can allow a character to jump you need to make sure they’re standing on the ground. One tutorial shows you how to calculate their Y velocity, and says they’re standing if it’s less than .01. One tutorial shoots a series of very short raycasts out the bottom of the character and says they’re standing if those rays are hitting ground. One tutorial programs an invisible circle at the character’s feet which flips a Boolean based on whether or not the circle is overlapping the ground. One tutorial puts a row of empty game objects along the player’s feet and says they’re standing if those empty objects are touching ground. This also highlights why it’s hard to go into the middle of a tutorial and get the single thing you’re looking for, since the code it’s build on almost always differs from what you’re currently working with, necessitating that you follow the tutorial from the beginning. This leads to a recurring problem I had through this project; if I don’t work through the entire tutorial, I can’t gather the bits and pieces needed to create my own game. But if I spend all my time working through tutorials, I’ll have a bunch of learning assignments, but no personal project to show. It’s a balancing act.Another, more beneficial tutorial was based around developing a game with an astronaut exploring an alien cave. This tutorial taught things like hitting switches to activate doors, enemies that attack when you enter their personal space, and using the Unity animator to call functions at a given point in an animation. That last one will be especially useful in programming a boss, particularly calling the function to fire a projectile after telegraphing its attack. But this astronaut game used colliders instead of raycasts for the character and enemies, and I wasn’t sure how well I’d be able to integrate it with the first tutorial’s code given what I knew at the time. I chose to abandon the raycasts and go back to colliders, uprooting a couple weeks’ worth of code.Which brings me to another trap in Unity, game design, and maybe even coding in general; there may be faster or more efficient ways to do something, but if you keep scrapping your work to test the hundred different ways to do the same thing looking for the “best” way, you’ll have nothing at the end of the project. I know of two professional video game that were ruined by this mentality. One was Daikatana, which kept getting delayed and at one point had to be restarted when the creators changed game engines midway through development and broke the game. The other was Duke Nukem Forever, which spent 13 years in development because the creators kept starting it over, until it was finally released in 2011 to poor reviews. It’s like that story where a farmer and his son walk into town with their donkey, and everybody they pass says they’re supposed to be doing something different with the donkey and they blindly do it, until one person’s terrible advice ends with the donkey falling into a river. I was also concerned following the raycast-based tutorial was simply regurgitating somebody else’s code without understanding what was really going on. Maybe that’s how all learning starts, but at least I understand colliders.Removing the raycasts meant undoing some of the other things the raycast tutorial showed, like how to make the cat climb a slope (she’ll just stop at the base of the slope with colliders), ride a moving platform, and swim. Which led me to question if going back to colliders was the right choice. Not helping was around this game I came down with a nasty cold that robbed me of the week I was off school for spring break, not to mention all the other things I could have been doing instead of sleeping and coughing with a throat that felt like it was on fire, which further confused me on the direction to take my project. Finally, I had to buckle down, decide to stick with the colliders, and see what I could make with them. I can learn to program the character with raycasts later.See the page “Raycasts vs. Colliders” for more details.Progress - MiddleAfter working through my cold, I needed to completely redo the cat’s motions. She needed to have walking, running, and jumping implemented, but I set aside hills, moving platforms, and swimming for now. I wanted the cat to have a trigger collider by her feet that could detect both the ground and what enemy she’s landing on. A trigger collider is different from a normal collider in that it has no mass and doesn’t hit against other objects with a collider, but it still reacts when another object touches it. As an example, in the final game, the cat walks through an invisible wall that’s actually a trigger collider to initiate the boss fight.After that, she needed to be able to double-jump, take damage from hazards, and faint. Unfortunately, implementing the cat’s double jump was a mess of “if” statements and Booleans to determine what she can do and what animation state she needs to be in, and a button timer to keep her from activating her normal and double jump at the same time. /*The cat’s first jump. jumpKey is the variable assigned to the jump button. >0 means it’s being pressed. keyHold is a timer that counts how long the jump key has been held*/ if (jumpKey>0 && isGrounded == true && keyHold==0) { Jump(); keyHold += Time.deltaTime; //Debug.Log(keyHold); }/*The cat’s mid-air jump*/if (jumpKey>0 && isGrounded == false && canDoubleJump == true && keyHold == 0) { injured = false; DoubleJump(); keyHold += Time.deltaTime; }/*Resets the key held timer when the jump key is released*/ if (jumpKey == 0) { keyHold = 0; }After the cat could run and jump, I developed three enemies with different properties. The first enemy was a harmless snake the cat could knock off the screen by landing on its head. The second was a turtle that walked along the ground, turned around if it came to either a wall or a gap, and would bounce the cat off its shell if she landed on it. The third was a thorny devil that mostly worked like the turtle but moved faster and would hurt the cat if she landed on it. I would have liked for the snake to fire a projectile at the cat, but time didn’t allow for that. Figure 2 shows how the turtle and thorny devil check for gaps. An empty game object by their feet checks to make sure it’s overlapping an area tagged “ground”, and tells the reptile to turn around if it returns false. This is different from a raycast, because the line isn’t actually firing out of the reptile. This is a DrawLine(), and is used to show a relationship between two objects. As well as keeping moving aliens on a ledge, the astronaut game tutorial used this to help the player identify which switch activates which door when pressed.void Update () {/*sightStart and sightEnd assigned in Unity editor. Draws a line connecting the two*/seeGround = Physics2D.Linecast(sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer("Solid"));/*Sets the line’s color to green*/ Debug.DrawLine(sightStart.position, sightEnd.position, Color.green); if (!seeGround) {/*Flips enemy when collision with “Solid” is lost*/ enemy.Flip(); }}Because I never got around to making the cat scratch, the snake is the only common enemy the cat can defeat by jumping on. And because the code is sloppy, the code to knock out the snake is split between the cat’s feet, the snake, and the snake’s CommonEnemies script. The code used to detect what the cat is standing on is: void OnTriggerEnter2D(Collider2D stomping) { Debug.Log(stomping);/*Checks to see what the cat’s feet are hitting*/ if (stomping.tag == "StompableEnemy") {/*Calls the stomping function and bounces cat if enemy is */ StompEnemy(stomping); ckMain.Bounce(); } else if (stomping.tag == "ArmoredEnemy") {/*Simply bounces cat if she lands on armored enemy*/ ckMain.Bounce(); } else if (stomping.tag == "HazardousEnemy") {/*Calls damage function if she lands on a spiked enemy*/ ckMain.TakeDamage(); } else if (stomping.tag == "Fatal") {/*Instantly Kos cat. Only used when she falls into water*/ ckMain.KO(); }} public void StompEnemy(Collider2D stomping) { Debug.Log(stomping + "go smash!");/*Get reference to the CommonEnemies script attached to target*/ var attacked = stomping.GetComponent<CommonEnemies>();/*Removes a health point*/ attacked.health--; } The code to make the snake fall is attached to CommonEnemies (with the intent that multiple enemies could use it): public void KO() { Debug.Log("Hiss");/*Disables collider on this enemy */ enemyCollider.enabled = false; }Then the Snake script deletes the snake after it falls a certain height, specified in the Unity editor: void Awake() {/*Identifies the Y position of the snake when the game starts*/ startingHeight = transform.position.y;/*Calculates the snake’s Y position when it should be deleted*/ destroyDistance = (startingHeight - fallDistance); }. if (transform.position.y < destroyDistance) { Debug.Log("Hissssss");/*Deletes the snake when it hits the Y position calculated by destroyDistance*/ Destroy(gameObject); }}Surely there’s a more streamlined way to knock out the snake.There was originally a bug where the snake sometimes became unkillable. This was because KO() was originally only called when the snake’s health equaled 0, and sometimes the cat would take off two points of health with a hit, so the snake’s health was never 0. This was fixed by changing it to if(health <= 0).For the last of the game’s core elements, collectible jewels were added, and text in the upper left displays the cat’s health and the number of jewels she’s collected. If I had time I would have changed the health to hearts instead of numbers, but priorities had to be established and stuck to.Finally, the cat’s entire movement code is wrapped in an “if” statement based on her health. When her health is less than or equal to 0, the cat switches to her fainted state, the controls no longer work, and the level reloads in 2 seconds.Progress – Final StretchWith the cat and common enemies functioning, it was time to assemble everything into a working level. I sketched out a rough idea for the level on paper (Figure 3) then tried to rough out the level with quads (resizable flat squares Unity can create), except I went through too fast and made the level way too large for the cat to get through. I forgot about doing the level with quads and went straight to the tiles, which is when that tile map that didn’t work would have been helpful. I had to manually drag and connect each tile to the map. (Figure 4)Originally, the camera kept the cat directly in the middle. Every time the cat jumped the camera moved, making the game a herky jerky mess of motion sickness. This was fixed by adding an empty game object that hovers around the cat, only moving when she gets far enough away from it, as if it was tied to her by an invisible rope. Sometimes you couldn’t see what was below the cat, so pressing up and down would lower this object, and thus the camera. However, this introduced a flaw when playing a controller; the movement is tied to the analog stick, and unless the player manages to tilt the stick exactly left and right with no angle upwards, the camera would be constantly rising and lowering as the player moves.But then the camera’s target had to be programmed with limitations so it wouldn’t go past the level boundaries. Except if the game is played at the wrong resolution, the player can see past the level’s sides anyway. Could there be a better way to program the camera? Like, have the camera fire raycasts outwards, and stop when it hits the assigned layer?The last major step was creating the alligator boss. The boss starts by poking out of the water and biting a set number of times, then jumping out and charging at the cat. The number of times it bites and its running speed are increased as it loses health.The trick with the gator is that there are really two different alligators that take turns attacking the cat; when one is finished, it tells the other to activate and shuts off. For the gator that walks along the platform…if (colliding.tag == "Spikes"){/*If the gator that walks along the platform hits a collider in the water tagged “Spikes”, check its health*/ if (health > 0) {/*If health is more than 0, reposition and activate the snapping gator*/ this.gameObject.transform.position = startingPoint; bitingGator.SetActive(true); }else if (health <= 0) {/*If health is 0, drop the diamond that ends the level*/ StartCoroutine(KO()); finalJewel.SetActive(true); } this.gameObject.SetActive(false);/*Either way, turn off*/ }Then when the gator that bites out of the water is activated…void Start () {/*Calculates how many times to bite based on the walking gator’s health*/ timesToBite = 6 - mainGator.health; }… void Submerge() { timesBitten++; if(timesBitten==timesToBite) {/*Once the gator bites as many times as it’s supposed to, activate the walking gator and turn off*/ gameObject.SetActive(false); mainGator.gameObject.SetActive(true); } }Submerge() is called by an event flag in the Unity animator every time the biting gator’s bite animation finishes (Figure 5). With regards to getting the gator to come back up for another bite, a for-loop may have been better, but I couldn’t get it to work in time and had to go the inefficient route.Maybe it’s a “lie” to have two gators, but the player would never notice while playing, and maybe tricks like this are needed for games to work. A dragon boss in the video game World of Warcraft is programmed to fire at invisible bunny rabbits placed around her arena. Besides, everything’s a lie in entertainment; trickery is what magicians are all about.Finally, I added the title and ending screens. Unfortunately, these had to be done very quickly because it was the day before the project had to be turned in, and it would take the better part of a day to digitally paint one screen. The ending is particularly rushed, just being the words “Thank You For Playing!” and the creative commons license for the music.What ChangedThe final game is a far cry from the original idea, but my original intentions would have required not so much study books and time but a magic lamp to accomplish. It’s as if I expected to create the next big hit on my second attempt with Unity or something. However, the game I had at the end was alright for what it was. One playable level, gems to collect, autonomous enemies, and an active boss.As I progressed through the assignment, more and more ideas had to be scrapped or scaled back if I was going to get something presentable by the end of the semester. In project management this is called “scope creep” but sometimes gaming specifically refers to it as “feature creep”.The first thing to be removed was the choice of three player characters. It took me long enough to get the cat to work the way I wanted, so programming two more characters was out of the question. And even if I wanted to make three different colored cats for the sake of learning character select, I was wasting too much time trying to find a video on a character select screen. I know it can be done, I just have to find out how.I also abandoned the plan to have an area where the cat could talk to other, non-player cats. Partly, this was to dedicate the time I would have otherwise spent drawing and coding these cats to more important matters, and partly because I was wasting too much time trying to find a useful dialogue tutorial.I also had to scrap the plans for a lightning-shooting griffin boss, which I’m sure would have impressive to see, but probably would have taken two months by itself to draw, animate, and code. Instead, he was replaced with a simple alligator. So basically, all that remains of my original plans was the cat protagonist. What Could Be ChangedIf a more experienced programmer looked at my code, they’d have a fit. The game is a prototype, so the code is all over the place and many actions are not done efficiently. For example, the state of the cats and alligator boss use a dozen Booleans to determine their animation state when an enum would work better. And while I originally thought it strange that a tutorial made a new class for every action a character needed to do such as jumping instead of piling everything into one class for each character, now I understand it’s for organization’s sake, as well as being able to attach the same code to multiple characters. I thought inheritance would handle this, until I ran into a problem with the snake not reacting to the cat’s stomp unless the cat referenced CommonEnemies instead of Snake, even though Snake was supposed to inherit from CommonEnemies.The game is also missing several important features of a game; there are no sound effects, and there isn’t even a pause screen. I also wish I had set aside more time to give it a decent title screen and ending screen, instead of the cheap ones I gave it in an hour. It also really needs more levels; I wanted to make the level interesting both to watch and design, but it’s far too hard for a starting level.The game also has some bugs I need to solve in the future. The most persistent one was lines appearing between the tiles. This is apparently a common glitch with 2D Unity, and has something to do with the position the camera is in. Also the cat would change to her jump animation as she crossed colliders on the ground. I got around this by drawing one big collider around multiple tiles (Figure 6), but if I had to change the collider I had to go in and figure out which tile the collider was attached to. In retrospect, I could have assigned the tile with the collider a label, but the level was getting cluttered from all the labels on the turtles’ and thorny devils’ gap watching objects. Figure 7 shows the colliders on the cat, turtle, and thorny devil are a box collider with circle colliders over their feet. This is because box colliders tend to get stuck on other box colliders when moving horizontally. Also, if the cat only has a box collider attached to her, she sinks into the ground then pops back out when she lands from a jump. But a circle collider on the feet has its own problems, as if she stands on the edge of a platform she’ll slide off. Adding two circles helps, but if they’re wider than the box on the main body she can get caught on the bottom corners of ledges as her body passes them but her feet hit the ledge. And if a character’s space is made up of three circle colliders on top of each other like a snowman, things can get stuck in the pit between the circles. And finally, the cat gets stuck on walls a lot. None of this happened when I programmed the cat with raycasts, which might be another reason to learn the raycast-based collision.But that’s what a prototype is; throwing code at the wall until something sticks.What’s Next?There are many resources I wanted to look into during this project, but didn’t have the time. One such book was Game Programming Patterns by Robert Nystrom, which is supposed to be about efficient ways to code a video game (though I imagine the patterns within would help with any programming), but I haven’t dug enough into it to know much more than that. Other books include Write Great Code Vol. 1 and 2 by Randall Hyde, Think Like a Programmer by V. Anton Spraul, more Unity tutorial books, and some books on digital painting that don’t have to do with programming but apply to graphic design. I even wanted to work through some books on other programming languages like Ruby and Processing, but again, the priority for the class was on Unity and C#. I especially wanted to look into books on Processing because that language is often used to create generative art which would be great for video games, like if I wanted an enemy shot to move in a certain pattern.There were even more Lynda videos I wanted to watch. Lynda features many videos on Unity, but they also have videos for programming languages ranging from C# to Java to Python. There are also videos on graphics design and digital painting I wanted to watch. I probably could have spent the entire four months working through these resources instead of programming the game and still not gotten through them all. There’s other things I need to do outside of IT in regards to game development. I’ve been meaning to read The Hero With a Thousand Faces for years, being that it’s as much a required reading for anyone who wants to write fiction as “The Mythical Man-Month” is for anyone who wants to get into IT.One issue I’ll need to resolve is, I never learned how to compose music. If I do finally make a serious video game, do I want to learn to compose music myself, or commission a musician to do the soundtrack for me?While tutorials often use the colliders to detect collisions between characters and scenery, in the long run I think it’s better to use raycasts. Though harder to implement, there are fewer bugs once you have them. And with what I know now, I think the ideal way to program games is by hybridizing raycasts and colliders; let the raycasts stop the character against the scenery, then use trigger colliders to know how the characters should react to enemies and hazards.ConclusionFour months is hardly enough time to learn enough about game development to create a fully functional game, moreso when I have five other classes and a website development internship to worry about. But even in the four months, I learned a few things about raycasts, creating autonomous enemies, communication between scripts and game objects, learned a little bit about creating custom options in Unity through the tile map editor, and even picked up some pixel art practice. It was also a lesson in planning and time management. That Daikatana game I mentioned earlier was proposed with a seven month development, and wound up taking three years. And it was still considered a bad game.Time management also includes downtime. Obviously a lot of time needs to be put into a game, but it’s also necessary to know when to take a break. Many times I was headbutting my code for an hour until I finally got out of the chair, got a drink and some chips, maybe watched a short clip, came back, and solved the code in five minutes.And even if I don’t go into game development, this project had built up my confidence in programming for other IT-related fields. Even if I did need a book meant for seven-year-olds to get my bearings.GlossaryGame Engine – Software that handles core programming for the developer, allowing the developer to build their game over itNon-Player Characters – Characters in the game that are not controlled by the player, such as townspeopleGame Objects – An object with physical presence in the game, such as a piece of scenery or a character. An empty game object is has nothing visual in it, but still has a location and can have colliders.Generative Art – Using mathematical functions to create artwork.Shovelware – Games made quickly and cheaply, with quantity valued over quality Raycasts vs. Colliders331470012700A collider draws solid shapes around the character00A collider draws solid shapes around the character169545016510A raycast fires lines out of the character020000A raycast fires lines out of the character4591051905A raycast stops the character when it hits an object with a specified Layer.4000020000A raycast stops the character when it hits an object with a specified Layer.31832557620A collider stops the character when they hit an object with another collider.4000020000A collider stops the character when they hit an object with another collider.FiguresFig 1 – The glitched tile mapFig 2 - Thorny devil watching for a gapFig. 3 – Rough sketch of levelFig 4 – Final levelFig. 5 – Event flag in the Unity animator that calls Submerge()Fig.6 – Colliders spanning multiple tilesFig. 7 – Character collidersReferences3DBuzz. “Creating 2D Games in Unity 4.5”. . Mar 18, 2015. Mar 13, 2016. Briggs, Jason. December 2014. Python for Kids. San Francisco: No Starch Press.Freeman, Jesse. “Advanced 2D Platformer Movement”. . Jun 09, 2014. Mar 13, 2016.Freeman, Jesse. “Unity 4 2D Essential Training”. . Jun 9, 2014. Mar 28, 2016. Freeman, Jesse. “Unity 5 2D: Building a Tile Map Editor”. . Dec 7, 2015. Mar 13, 2016.Gibson, Jeremy. Feb 2015. Introduction to Game Design, Prototyping, and Development. Upper Saddle River: Pearson Educaction, Inc.Incomptech. . 1997 – 2016. April 28, 2016. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download