Wednesday, October 29, 2014

Updates!

Wow!  It's been a busy few months! I've had to scrap a few projects, but have started on a lot of new, more practical ones.

The first major announcement is that I'm back in school as a Computer Science major.  I started in a program that similar, but it just didn't cover what I wanted it to, so I changed my major, and I'm glad I did.  I took Computer Science I this semester.  I knew it would cover a lot of stuff that I knew but I was hoping I'd get something out of it.  To GameInstitute's credit, so far in class I've only learned a few things about C++ that I didn't know already.  I probably should have inquired about a placement test.

One project permanently scrapped is the game I had decided to write on my own.  With what I've learned, I should be able to make a graphical version of it that would be a lot more interesting.  It may take a while, because there's still a lot to learn, but it will come.  I've also decided to put off the 3D modeling for a while.  I've learned some stuff I'll get into shortly, but I've decided that 3D is going to wait while I work on what I'm doing now and become more proficient.

I am still chugging along on GameInstitute's courses, and I've learned a TON!  I've learned some Windows API stuff, so I can now write programs in Windows!  That's extremely fun, because I'm no longer limited to text-only programs.  It surprised me how much code goes into making a simple window that doesn't even do anything except show up, but there are a lot of options that a window can have that you don't really notice when you're using Windows unless you're looking for it.

I've also started to learn how to draw things to a window, and even move them across the screen in animation!  It's pretty cool the way things are coming together.  I've learned how to draw some primitive objects like rectangles, ellipses, and lines by using the Windows API code, but what's even more exiting is that I've learned to draw sprites.  In other words, I can take an image of something and integrate it into my program.  That means I can use custom images to represent objects in the program, rather than relying on basic objects that can be drawn by the API I'm using.  I'll be writing a post on sprites in the near future, because I think the concept behind them is fascinating.

So, using all the stuff that I've learned about Windows and graphics, this last chapter has been really cool.  The homework is challenging, but I'm making a lot of progress and learning a lot on the way.  The one program I've finished is where I had to make a ball travel across the screen and bounce when it hits the edge of the window.  It reminds me of something that would have been an early screensaver.  I decided to take it a step further and use random numbers to give the ball a new direction and speed every time you hit the space bar.

The latest project I'm working on is a version of Pong.  This is more difficult because I really haven't learned anything about collision yet.  I've got the graphics displaying, and some of the game working.  At the moment, the ball will be served from the center of the screen at a random angle when you hit the space bar, and the play stops when the ball hits one of the sides of the window.  The ball bounces if it hits the top or bottom.  Also, depending on which side the ball hits, the other player gets the ball served to them next time the space bar is pressed.  The player's paddle moves, but there is no code yet to handle the ball hitting the paddles.

Here's the list of things I still need or want to implement. Please comment if you have any other ideas! :)

/*

    To do list:



    Work on collision system

        -Paddle collision

        -Paddle position affects ball velocity

        -Paddle collision for top and bottom of window

        -Finalize ball speed

        

    Mouse support

        -Set paddle to use mouse for movement

        -Make sure the game continues to use mouse 

            input even when mouse is outside window



    AI

        -Set the AI paddle to try to move up when ball is above it

            and down when below.



    Score system

        -Display score for player and AI on screen

        -Set game to end and restart when one side

            reaches 10 points



    Themes

        -Have menu selections load new sprites into

            the global objects

*/

Monday, May 26, 2014

Woohoo!

I've been very busy.  Here's the latest on my progress:


















I've completed the first module of C++ programming, and will be moving on to the second, where I'll be learning Windows programming.

I've also started another course on the site.  I'm learning 3D modeling and animation.  At the end of the course, I should have a fully modeled tank with animated treads.

For now, I've made an apple.

















Can't wait to learn more so I can make more objects, and texture them!

Tuesday, May 6, 2014

Speed Bumps

It's been a while since I've posted.  I was in a car accident a few weeks ago and was really stressed out about things.  Things still haven't settled, and may not for a while, but for a while I was so stressed I couldn't concentrate on anything.  Since then I've calmed down and I've been able to work on learning programming a lot more again.

I have been a little confused with references and pointers, so recently I've taken a break from my course and have gone back to relearn some more of the fundamentals of using these.  I realized that I was really getting confused when I was learning about inheritance and polymorphism.  I can make a general class that has certain traits, and then make other subclasses that "inherit" those traits, as well as having additional traits of their own.  What was getting confusing was when I created a pointer to a class type and then changed it to point to another class type.  At this point things were getting really over my head, so I decided to stop and relearn things.

One thing that's been helping me is the set of tutorial videos made by Mr. Adam Huntley on his site http://www.programminghelp.org/.  On his site, he has tutorials for not only C++, but also C# and Visual Basic.  He also has a set of tutorials for coding on the web--specifically HTML/CSS and JavaScript.  If you're interested in learning any of these, this is a pretty good place to start.  I've learned a few things from them that the course I'm taking hasn't taught me. 

When learning, I'm finding a broad source of resources is great to have, because there are different techniques and tools that one person prefers to use that the next person doesn't.  There are so many of these techniques and tools available that it's very difficult for one tutorial to cover everything.

The exciting news is that I've decided to design a new game, entirely on my own, outside of my course.  I've been trying to decide on a topic for the game.  I've decided to try a text based game of a topic I've always wanted covered.  It will take place in the Age of Sail during the time of the Napoleonic Wars.  I've set a very ambitious goal for this one, and I'm hoping I'm able to meet it.

I already know that the polymorphism will certainly help program this game, so I'm very anxious to get over this hump so I can get working on this game.

I'm so excited!

Tuesday, April 1, 2014

Design Dilemma

I'd previously posted about integrating a store into an RPG game for a homework assignment.  I had programmed the store into the game and given the player the ability to "enter" the store.

I ran into a small problem when getting to the next step.  How did I want to set up the menu, and did I want to limit the choices of armor and weapons between the classes?  For instance, should a wizard be able to buy steel armor meant for a fighter?  The wizard class has little health and armor, but has access to a lot of magic points to be able to cast healing spells and powerful damage dealing fireballs.  I decided that heavy armor was just too much to allow them.

I decided to go with a different kind of method for solving this problem.  I could have made everything visible to every class, but only allowed them to buy certain things, but I decided this wasn't necessary.

I am going to hard code the inventory into the store in the background, and display the correct items to each class.  When the player picks their class at the beginning of the game, the program will be told to load those items into the store's displayed inventory.

That means that when you pick a wizard, and visit the store, you will be presented with an array of staves and robes, and when you pick a fighter, you will be able to choose from metal breastplates and swords.  :D

Monday, March 24, 2014

Operator Overloading

I've  been learning something really cool.

Basically, C++ has some built in operators.  These can manipulate the data in the program.  For instance, there are mathematical operators.  For instance, if I tell my program:

5 + 5

It will return 10.

But what if I create my own class? 

Take, for instance, a class for vectors.  Vectors have direction and magnitude.  What they are and how they work can be read here.  Vectors can be simulated with a set of 3 coordinates, similar to a point on a 3D graph, which shows where the vector terminates and from which its magnitude can be calculated.

So, if the vector has three coordinates, how can I tell the program to add two together?  I would have to write a function telling the program to add the corresponding coordinates from each vector (AX + BX, AY + BY, AZ + BZ).  This works alright, but the syntax behind it can be confusing, or at best, hard to read.  Perhaps I write a method called "add" to add vectorA and vectorB together.  To implement this into the program, I might have to write something like this:

vectorC = vectorA.add(vectorB);

Using operator overloading, I can now make my vector class work just like built in data types in C++.  If I overload the + operator, I can tell the program that when I use + with two vectors, it means to add each corresponding coordinate.  Now, to have the program do what I want it to do, all I have to do is type:

vectorC = vectorA + vectorB;

It seems trivial, but it makes things a lot easier to read and understand when I'm creating my own data types.

Thursday, March 20, 2014

I'm still here!

Just wanted to say that I'm still around.  Things got a little crazy for a while.  I was pretty sick for a while and out of commission.

I've been feeling a lot better and getting back into the swing of things.

In the course that I am taking, one of my homework assignments was to add features to a text based RPG game, where the source of the base game was pretty much given as an introduction to classes.

The basic RPG asks you to pick a class, and gives you the option to move in four directions (it keeps track of your position using coordinates), rest, view your character's stats, or quit the game.  If you move, There is a chance you will be attacked by one of several types of enemies, from weak goblins to very strong orc lords.

Some of the features I was asked to implement were easy.  I had to add character classes and races into the game, and give bonuses and different stats to each.  One other thing they had me to was to add a chance of being attacked while resting.  This one was especially easy, but for some reason I was stumped for a while.  It turned out I was making things a lot more complicated than they really were, and when I figured out what I was doing wrong it took about 2 minutes to implement this.

I was pretty confused about passing pointers and references into functions, which was covered in the previous chapter, and while working on the assignments I had some ideas about things I could add in, but was having trouble doing what I wanted, and got a little frustrated.  Eventually I gave up on the assignments and moved on to the next chapter..  Progress was slow, though, because I felt bad about not finishing the assignments.

So finally, I've begun working on that game again.  So far, I've added a store, that will be randomly assigned to a set of coordinates from ([-5 - 5], [ -5, 5]), so that every game the store will be located in a different place, but won't be super hard to get to.  In addition, I've added a "check map" option to the main game menu, so it's easy to figure out where the store is.

I've also added a message and a new menu that comes up when you enter the store, and disabled the ability to be attacked when you're on the coordinate the store occupies.

The next step is to add inventory to the store in the form of weapons, armor, and potions.  Then I'll need to add the methods that will allow you to purchase and use the items in the store.  I think I'm going to hard code items into the store that will be available, but I'm also considering upgrades for weapons and armor instead of actual new items.  I feel like that will make it easier to keep progressing in the game after a few levels.

After I'm done with that, the last assignment I have is to make it possible to be attacked by more than one enemy at a time.  This one sounds tricky, and I'm sure I'm going to have to work at getting that one right.  I'm looking forward to getting this project out of the way.  Once it's done and working, I'll have something to be proud of.  It'll be a real morale booster!

I'll update this blog after a little more progress.

Saturday, January 11, 2014

The Secret Life of Bloggers Blog Party: Post 1

My lovely Stephanie Ann at World Turn'd Upside Down is hosting The Secret Life of Bloggers blog party.  The premise for this is that every day you keep a short log of something you did, and take a picture of it.  Every week you share the pictures and a .  It was difficult to get started this week..I found it hard to get into the routine of carrying my camera or getting my iPod when there was something worthy of a story, but I did my best, and here's what I came up with.

1-3-14

 

Shoveled snow.  Had a good bit of snow the previous night into the next morning.  I did the neighbors' sidewalk as well because if we're all at work they normally help us out.


1-5-14


 Created a work space for myself.  I have my main computer on another desk, but it doesn't really facilitate spreading out my work, so I reallocated this space.

1-10-14

 Hung out with my oldest friend.  My iPod wasn't handy, so I asked him to take a picture on his phone and send it to me.  I think he forgot. :)

1-11-14

 Took two pictures to make up for the lack of during the rest of the week.  It was really cold last night, and Coal cuddled all night.  He was still cold so I covered him up while I was getting ready for work.


It rained all day.  This is the last of the snow from the last storm.  I thought the stream of water in the gutter was really cool going under the little bridge of ice.


It may be a little while until my next post.  My current homework assignment requires a bit of trigonometric knowledge, and I've long since forgotten what I learned in high school years ago.  I've been trying to rapidly relearn what I need to complete the program, but I'm going to continue learning, because it seems like it'd be good to know, and I have been feeling really good about learning things again.