Thursday, May 8, 2014

Capture the Flag

Learning about states and decision trees

To make capture the flag, computer players need to be able to make decision of what to do and when. I learned how to implement a decision tree for my NPC bears, so that they could play capture the flag with each other. Writing out a decision tree on paper was easy; the hard part was implementing it in code. I spent hours trying to make sure that the states were getting updated properly through their decision trees. I ended up changing my decision tree to make the game work.

Now I have a fully functional computer capture the flag game. The game is made with a level editor that I created. I load in Maya obj files to a binary converter first. Then those binary files are used in my level editor to make a map where I can place nodes to path to. Then I load the saved level file out to binary. Finally the binary level file is loaded into my game where the game automatically starts playing.

Each bear has its own "pather", and depending on their state they do different things. Bears can either fetch the flag, randomly search for the next spawn, return to the base, or run after the current flag carrier.  If bears collide, they are reset to their home base. If bears with a flag collide, the bears reset to base and the flag is set to a new random position. If a bear turns the flag into it's base, the flag resets to a new position as well.

You can view the demo of the game on Youtube. Or press play on the video below:


Pictures of the Game Area:






Picture of Flag turn in:





Old Decision Tree:

New Decision Tree:

Tuesday, April 29, 2014

Learning AI


Currently I'm working on creating Ai/pathing in openGL. The program can load in .obj files, binary files, and level files that hold .obj information and node information. The program has a character (bear) that paths around the map through nodes that were previously place.

 To build the map, a person can click on the current plane/map to place nodes, selected a placed node by re-clicking it, and connect destination nodes to a re-clicked node. This information can be saved out to a level file. When the level file is read back in, the pathing character will randomly path to a node. The user can also click on a node to make the pathing character path to that node. In addition, clicking on empty space makes the pathing character go to the position of the mouse on the map.


This editor also has the ability to display/change how the program works. The user is able to change the speed of the pathing character through a slider. The user can change to view the pathing characters view or see the world view. The user can change to show all connections that exist on the map. The user can choose to view the current path the character is following. In addition, if pathing connections are not shown, the user can select a node to add new destination nodes or add new nodes. (These variables are editable through a debug menu that pops open when the "~" key is hit) The change to a path by adding more nodes or adding new destination nodes can then be saved out. If the nodes are edited the level must be saved and re-loaded to implement the new paths available.








Friday, February 7, 2014

OpenGL Textures


It took a lot of research online and read a couple of OpenGL books to finally render texture in my scene. Looking the back the code was pretty simple to do; it was just difficult figure how all the pieces fit together. I'm really proud of the scene I have created. I've learned with enough perseverance and dedication one can teach themselves anything. I can't wait to learn how to render more things in OpenGL.






Wednesday, February 5, 2014

OpenGL - Lighting

Game Libraries

I have now finished an application in OpenGl that  shows ambient, diffuse, and specular light on objects. All lighting equations have been run through the fragment shader to show a nice clean look. I learned the linear algebra equations of how to calculate light and used them in this program. The following pictures show different lighting situations.

Scenes with no specular lighting:





Scenes with specular lighting:




Scene with red specular lighting:




Scene with less diffuse light:





Monday, February 3, 2014

Survival Days - Game Idea


Game Ideas


I hope to be a game designer once I graduate college. This is one game that I would want to create.


Survival Days

Starting Plot

Intro:
  • A child is flying back home from a trip to see extended family in Europe. As the plane is flying back, the character receives a call from home.
    • ( During this time the character is in a restroom standing in front of a mirror) The mother will ask questions that change what the initial skills of the character are. The character will be looking at the floor until the mother says something about a physical characteristic and then the character will look into the mirror. This is where the designing of the characters physical appearance will happen.)
  • The character taps a technology looking bracelet on his/her arm. A hologram pops up with the characters mother. She asks the character how the trip was, and then asks the character to pick up groceries before heading home. In the middle of the conversation the plane shakes. Then the lights on the plane start to flick and turn off. The character tells the mother something is wrong with the plane and is talking to her when the plane begins to dive. The character stands up and leaves the restroom, we see the whole plane. A personal plane. The character rush's to the pilots cabin. Auto pilot  has failed and the pilot is somehow dead. The plane continues to fall and the call to the characters mother suddenly shuts off. The character can not control the out-of-control plane. The plane crashes to the ground and explodes.

Meeting the new world
  • The character wakes up immersed in a pool of crystal clear water. The character swims to the top of the lake and breathes in a deep breath. The character swims to the side and takes a look at their new environment. A giant forest. Behind the character is a giant cliff with a waterfall running down into a lake. The character taps their bracelet and sees that it still is partially functioning. All internet access is offline, but some of the other feature are working:
    • Inventory
    • Local initial mapping
    • Note taker
    • Couple of downloaded books
      • Mini survival guide
    • Whether analyzer
    • Liquid/food analyzer

  • The player now seeks a way to find how to get home and how to survive.


Game Mechanics

  • Player gets more plot story if they find signs of human life.
    • Camp
    • Paper
    • Flint and steel/ matches
    • Bottle
    • Old tent
    • Rifle
    • Bullets
    • Hatchet
    • Etc.
  • Mysterious places
    • Hidden caves in mountains
    • Hidden caves under water
    • Lost groves
    • Abandoned graveyard and church


  • Player must build shelter, find food, and find a way to get back home
  • The player can interact with wildlife(hunt or befriend)
  • The player can learn to climb, a certain amount at max, trees and cliffs, learn to fish, learn to make better and better shelters(cabin), learn to skin, learn to grab maple syrup from trees, cook, trap animals, log trees, find berries for eating and painting, learn to make bows and arrows, etc.

  • Secret behind the waterfall, can only be reached with high swimming skill.
  • Animals
    • Dangerous animals: Wolfs, Bears, coyotes, bobcats, raccoons
    • Other animals: bunnies, squirrels, birds, deer.
    • Different types of fish large and small.
    • Bugs not present.
    • Salamanders, frogs, snakes (frogs and salamanders can be used to make poison for arrows and such)








Wednesday, January 29, 2014

Introduction to OpenGL


Game Libraries

At my 6th quarter at Neumont University, I'm learning how to program in C++ with OpenGl. We are learning the basics of how to draw on the screen through utilizing the graphics card, and how to move a camera in a 3D environment. I recently learned how to render a 3D scene with one one buffer in OpenGl using vertex arrays. We are writing our own shader code and sending it directly to the graphics card. We are learning the graphics pipeline including how the depth buffer works. I hope to learn OpenGl quickly and be able to render objects that I make in Maya in the OpenGl environment.