Since I last week wrote about most of the assignments for this week, I'll talk about one assignment which took more time than the others. Making a game of Tic Tac Toe.
Tic Tac Toe is played on a 3x3 grid in which one player is represented by across and the other player is represented by a circle. The players take turns putting their symbol into the grid and if three of the same symbol align vertically, horizontally or diagonally then the represented played wins.
The assignment was to make Tic Tac Toe with classes.
Firstly I made a Board class. Since the board has a physical representation in the game. I made a function to draw the board which consist of asterisk (*) and underscores (_). They form boxes which becomes the game board.
[TO BE CONTINUED]
Nov 30, 2014
Nov 24, 2014
Second Week of Programming: Making Pong and Doing extra work with Classes
Since I'm going back to Stockholm during week 3's classes, I asked for the assignments in advance so I could brush up on my old C++ knowledge.
Firstly though, we made pong with SDL(Simple Directmedia Library). A programming library is a set of predefined functions and classes which can aid you in different ways. If I want to make a game, I don't necessarily need to know how to program the graphics card, but SDL do and helps me with that process. The back end takes care of the hard stuff and I can just write
Window win = CreateWindow();
Now, with the library in place and our instructors initial program, we made pong. The process was mostly figuring out how the objects in the game should act and then define that behavior in code.
Paddles move by pixels when the player press up or down, that is easy. But the paddle cannot move outside the screen! If it does we send it back before redrawing it on the screen. Also if we move the paddle every frame, slower computers will have slower movement. We don't want that! So if we base the movement around time we can have a global measure to go after.
And for the ball we need to define movement in two directions, vertical and horizontal. And to make the ball bounce, we need to define that when touching the upper and lower screen, the vertical speed is reversed, and when touching a paddle the horizontal speed is reversed. And when touching the left and right border the score count for the correct player should go up.
One more thing to add is game states. This game of pong is either running or paused. To start the game from pause you need to press enter. To pause the game a player needs to score. Game states are good for enabling a certain behavior at a certain time. You should not be able to move during pause and neither should the ball.
I also went through classes again and there were several new things I ran into. Classes are good for several reasons. In a class we define what an object of this type of class looks like so we can use that for the purposes we define. Bullets in shooters are objects defined by a bullet class and every time someone shoots, bullet objects are created.
It sounds easy as a concept, but defining exactly what you want can be pretty hard. I made a card class which can hold suit and number. Then I made a deck class which creates 52 cards in a array to mirror a real deck of cards. Then I made a class which holds a hand of 5 cards and can do things like discard a card and draw a new card.
The process isn't too easy for a beginner and I do feel like I'm learning a lot of new stuff every week. I'm glad that I'm ahead in this course so I can reinforce my knowledge even further. The next step in the program above should be something like making a game of poker, but that is for another update.
Firstly though, we made pong with SDL(Simple Directmedia Library). A programming library is a set of predefined functions and classes which can aid you in different ways. If I want to make a game, I don't necessarily need to know how to program the graphics card, but SDL do and helps me with that process. The back end takes care of the hard stuff and I can just write
Window win = CreateWindow();
Now, with the library in place and our instructors initial program, we made pong. The process was mostly figuring out how the objects in the game should act and then define that behavior in code.
Paddles move by pixels when the player press up or down, that is easy. But the paddle cannot move outside the screen! If it does we send it back before redrawing it on the screen. Also if we move the paddle every frame, slower computers will have slower movement. We don't want that! So if we base the movement around time we can have a global measure to go after.
And for the ball we need to define movement in two directions, vertical and horizontal. And to make the ball bounce, we need to define that when touching the upper and lower screen, the vertical speed is reversed, and when touching a paddle the horizontal speed is reversed. And when touching the left and right border the score count for the correct player should go up.
One more thing to add is game states. This game of pong is either running or paused. To start the game from pause you need to press enter. To pause the game a player needs to score. Game states are good for enabling a certain behavior at a certain time. You should not be able to move during pause and neither should the ball.
I also went through classes again and there were several new things I ran into. Classes are good for several reasons. In a class we define what an object of this type of class looks like so we can use that for the purposes we define. Bullets in shooters are objects defined by a bullet class and every time someone shoots, bullet objects are created.
It sounds easy as a concept, but defining exactly what you want can be pretty hard. I made a card class which can hold suit and number. Then I made a deck class which creates 52 cards in a array to mirror a real deck of cards. Then I made a class which holds a hand of 5 cards and can do things like discard a card and draw a new card.
The process isn't too easy for a beginner and I do feel like I'm learning a lot of new stuff every week. I'm glad that I'm ahead in this course so I can reinforce my knowledge even further. The next step in the program above should be something like making a game of poker, but that is for another update.
Nov 14, 2014
First week of programming: Making a text adventure game
The programming course has begun. Since I already know most things taught in class, I decide to brush up on the subject in my own way.
The lectures we've had this week mainly consisted of learning control statements like the for statement which loops and the if statement which checks for certain conditions. This is basic stuff I learned in high-school, so I did a little exercise of my own.
This is my text adventure game. It doesn't have a name and is still a work in progress, but it works! The main features I use in the game is switch statements, which looks at where the player wants to go and sends him/her on their way to that part.
EXAMPLE: "Where do you want to go?" "1. Left, 2. Right" input=1, goto left.
The second feature I use is the if statements, which triggers at certain choices if the player has visited other locations.
EXAMPLE: if(Player_has_visited_left) then he goes right.
It's a simple game with simple code. It's not the most optimized and there are a lot of manual edge cases. But that's where the next part comes in. I'll keep this going throughout the weeks, adding new things every week.
See you next week!
The lectures we've had this week mainly consisted of learning control statements like the for statement which loops and the if statement which checks for certain conditions. This is basic stuff I learned in high-school, so I did a little exercise of my own.
EXAMPLE: "Where do you want to go?" "1. Left, 2. Right" input=1, goto left.
The second feature I use is the if statements, which triggers at certain choices if the player has visited other locations.
EXAMPLE: if(Player_has_visited_left) then he goes right.
It's a simple game with simple code. It's not the most optimized and there are a lot of manual edge cases. But that's where the next part comes in. I'll keep this going throughout the weeks, adding new things every week.
See you next week!
Nov 9, 2014
Game design introduction course completed. A quick look on the experience gained.
Now we're finally done with the concept document for the space shooter. Hard times were had and lessons were learnt to make it easier in the future.
I was the producer for the game concept called Desert of Tombs, and it was not an easy task. We had our good times and bad times throughout the project, but I think the most important thing of all were the experience of begin thrown into the lion's den. I do think this project is too hard, we are new to game development, we do not know how to pitch and this is the first time we're doing anything like this. But it is well motivated by everything I've learnt, not only what we did wrong as a group, but what I did wrong as well.
A game about a detective who must defeat mafia bosses in order to pass on
I was the producer for the game concept called Desert of Tombs, and it was not an easy task. We had our good times and bad times throughout the project, but I think the most important thing of all were the experience of begin thrown into the lion's den. I do think this project is too hard, we are new to game development, we do not know how to pitch and this is the first time we're doing anything like this. But it is well motivated by everything I've learnt, not only what we did wrong as a group, but what I did wrong as well.
A mockup of Desert of Tombs
It is hard to work on a game concept when everyone on your team has visions of different games, and this is the main reason why our project want astray. Firstly, we did not have clear aesthetic goals. We wanted to have something with challenge and discovery, but those are from the types of fun category. This made designing hard because everyone chimed in with their interpretations of the game. Since we also didn't have roles to divide different work areas in, everyone decided on everything which made it a work of very different ideas which did not work in harmony.
Example of a boss fight
On of the most important lessons for me though is that I need to stop trying to have control over everything. Since we had discussions on everything, I voiced my opinions over the others almost every time. I was like a cynical producer who wanted to double check every decisions made by the team.
But this is something to be learned from. Through this project I have learnt that I should not take control over everything. Other people have ideas as well, and they can do good work if I just give them the chance. For the next project I will make sure the team's vision is clear. Then everyone will have their area where they are the ones making decisions. I will not be telling everyone what to do and I will not make the final decision on everything.
Now it is time to move onward with new-found experience!
Now it is time to move onward with new-found experience!
Subscribe to:
Posts (Atom)