• entries
33
37
• views
39402

Retro Game Development and Retro Case Study's!

## [Development][Intro][Hooded] Hooded revival in Python + Pygame

Hello all! It's been a while (scratch that, a long time) since I've posted, or even been active on gamedev.net! Why? Because of Computer Science Courses over Algorithms and me working on my best project yet: Hooded!

Long-time readers will remember Hooded. It was a failed 2D Platformer I programmed more than a year ago in C++. It was the game I always wanted to make. The idea was essentially:

A 2D Platformer with Fluid Movement
Semi-Smart AI
Multiple levels where you get too acquire new swords with different stats (RPG-ish)
A Smart / Reusable Interface (A pygame engine)

So, I've completed the first bullet, completed the third bullet, and completed the fourth bullet. The caveats are: I made it easy to add in new levels and swords (Swords are just a new image and two lines of code, levels are a few lines of code and actually *making* them. There aren't multiple levels because I'm just trying to get everything else done before I focus on content), and the AI just randomly does a different thing every 5 seconds. However, adding in new enemies is a piece of cake!

Before starting, I also pinpointed what it was that made my first project to fail. Canonically, it was;

Lack of Experience.
A misunderstanding of programming good and extendable interfaces.
Not having a whiteboard.
Not having two monitors.
Not having a good computer.

So, I learned Python and spent a year remaking other games. I read some new books about programming and took an algorithms course. I got a nice whiteboard behind my desk. I felt ready. I got started. I still wanted to blog about my progress, however unlike last time I wasn't going to make 8 posts where I'd done practically nothing. I programmed the game for 1-2 months before making this post. Without further ado, here is hooded (Don't mind the programmer art, or the fact that my microphone makes me sound very weird):

Video!

I just watched the video and I sound 12 years old. The joys of laptop microphones :(!

What do you think about Hooded? Do you have any ideas that I can implement. Once I add content, I'm going to be fairly content with it (See what I did there)!

## [Development] I've made Pong and Breakout in Pygame!

Well, I did it. Pong and Breakout in pygame!

I'm not putting Pong up, it was hacked together and I'm not very proud of it.

I am, however, putting up Breakout! I coded a finite-state-machine, a basic button GUI system, all of my states, the paddle, the ball, the bricks, all object-oriented with beautiful pygame! And everything is completely commented, with classes having long documentation strings. It comes in at a little over four-hundred lines, and the executable is here:

BREAKOUT !

And the source (along with the executable file and setup.py):

BREAKOUT SOURCE !

I am very proud of this code. It looks (and feels) beautiful, and I can't wait to work on some more games (I see space invaders in the future!).

I'm going to eventually write a source analysis and talk about it more, however it's pretty late and I should probably get to bed.

See you guys tomorrow !

And I'm back! That was some good sleep!

So, I made a video of the game!

And I'm really happy with how it turned out! I'm working on adding more levels as we speak !

A Few Hours Later - And I'm back!

I'm actually uploading the files in the morning, however there is now:

FOUR AWESOME LEVELS!
SOME BRICKS TAKE TWO HITS, AND IF THEY ARE HIT A DIFFERENT TEXTURE (BROKEN BLOCK) IS DISPLAYED!
MAPS ARE AWESOMELY GENERATED USING EITHER A LIST COMPREHENSIONS OR TRADITIONAL FOR LOOPS!
COLORS ARE RANDOM!
THERE IS A RANDOM MAP, A PYRAMID MAP, AND A RAINBOW MAP!
THERE IS A GAME OVER SCREEN!
ONCE YOU COMPLETE A LEVEL YOU ADVANCE TO THE NEXT LEVEL. IF THE BALL GOES OFF THE SCREEN YOU GO TO THE GAME-OVER SCREEN!

I believe it is finished! Have fun :)!

NEXT PROJECT: SPACE INVADERS, SUPERMAN3275 STYLE!

## Python List Comprehensions! (And Python / Pygame Update!)

Some news:

I finished Code Academy's Python track and most of their advanced non-track courses.

I've started hacking around with Pygame.

I'm finally making games again!

That last piece of news might be a surprise. I've spent most of the last few months furthuring myself as a programmer and trying to re-learn the basics. There's still a huge amount of information I don't know about Python, however I know enough to make games, so that's what I'm doing.

Currently I'm working on Pong, and I'll update you guys on that whenever I ask a question on gamedev.

Now on to: Python List Comprehensions.

List comprehensions are a nice little tool in Python which add syntactic sugar. Like lambdas, they aren't needed however their existence makes programmers lives a little easier. Let's start by comparing traditional Python list syntax with List Comprehension Syntax:

Traditional Python:my_list = []for index in range(1,101): if index % 2 == 0: my_list.append(index ** 2)
List comprehension:my_list = [x**2 for x in range(1,101) if x % 2 == 0]
Just look at how much less space list comprehensions take up to do the same thing as a traditional for loop.

If you can't tell, the List Comprehension says that for every number in the range from 1-101, if x can be evenly divided by two then append x squared to my_list. Although you could accomplish this with a traditional python loop, the list comprehension is easier and just looks nicer.

What is the syntax?

my_list - empty list to store values from list comprehension in
for x in range(1,101) - values to check if statement against.
if x % 2 == 0 - If statement. All values from for statement are checked here.
x ** 2 - The value of this expression (it can be any expression) is appended to my_list when the if statement is true.

Let's look at a two dimensional example:

Traditional Python:my_list = []current_list = []for first in range(10): if y % 3 == 0: for second in range(first,first + 20,2): current_list.append(second) else: my_list.append(current_list) current_list = []
List Comprehension:my_list = [[x for x in range(y, y + 20, 2)] for y in range(10) if y % 3 == 0]
As you can see, it is a lot easier to use a list comprehension.

I hope that you now have a basic understanding of Python list comprehensions. They are a very useful tool :)!

Cheers :)!

## P and NP: Algorithms Part One

I know I keep on going for two months and then saying "I'm not going to do it again!", however at least I have a legitimate reason this time. My computer broke. Completely. So, I bought the amazingly awesome, beefy, and fast Lenovo Y500 for development. I'm opening it on Monday !

Now, I'm using a temporary laptop for small development, and I'm updating you:

Firstly, my (first) software product is being released soon. I haven't told you guys about it yet, however it is PyText! (That's not the real domain name, however the normal one is currently down so yeah !)

Secondly, I've been working on Jarvis.

Before I start, let me say how much I'm enjoying Python. Everything is so easy and simple. No linker problems or weird compiler bugs. Everything is a module away (from, maybe, PyPi ). Python is so simple yet powerful, it has everything I like about a programming language. The syntax really is just beautiful to look at.

I'm working my way through Code-Academy's Python track and Learn Python The Hard Way, after which I'm reading one of the books about PyGame development, after which I'm reading a Python Data Structures book. After which I'll probably tackle a functional programming language !

Jarvis is my personal voice-assistant. I've integrated him with the Wolfram-Alpha API and he's using PySpeech (on Windows) and CMU Sphinx (on Linux) for voice recognition. He is awesome. He can do everything Siri can do (wolfram-alpha), except he's on a desktop and tailored for me.

I'm currently getting a Raspberry PI and hooking up hidden microphones around my room. The PI will just be running the script (I also am going to be interfacing my script with a set of LCD lights which I'm also hooking up to show the status of Jarvis, what he's currently doing, etc.)!

I will be able to walk into my room and this will happen (with CMU Sphinx rather than PySpeech it's even better because of CMU Sphinx's grammar):

Me: "Jarvis"
PI: "Yes sir?"
Me: "What temperature is it in Arizona? It's where my parents live"
(CMU Sphinx can filter out the "It's where my parents live part")
PI: "I'm not sure, let me check. Oh yes, here it is. It's 36 Degrees Celsius, sir"

I can't wait until it's hooked up! (I'm already testing on my temporary laptop)

Now onto P and NP.

[hr]

When discussing algorithms, we find that P and NP constantly come up. A key part of understanding algorithms is understanding both how they scale and how hard they are to solve. P and NP help us answer both of these questions.

Multiplication is considered an P problem. Computers can perform multiplication rather quickly, and it is very easy for them to solve a multiplication problem. Multiplication is a P problem because no matter how much more complex it gets, the time it takes to solve only increases by little. It is considered to be upper-bounded by a polynomial expression.

What does this mean?

It means that:

Some polynomial is greater than the running time of the algorithm.

In math:

If we have a polynomial z and an equation f(x), z upper bounds f(x) if z >= f(x) for all possible values of x.

An NP problem would be finding factors of a number. As the number gets bigger the problem gets harder and harder to solve.

Finding the factors of 20 is trivial, however finding the factors of a 100 digit behemoth? It often takes at least twenty years to solve simple factoring problems like that. In retrospect, for a computer (not considering the size of values. This is considering that this computer is equipped to store numbers with any amount of digits and that there is enough RAM) 20 * 20 relatively the same as a one-hundred digit number squared.

Now that we understand P and NP, what is NP-Complete?

Take the clique problem:

Try to find the largest "clique" in this. That is, a group of dots all connected together in a polygon:

The green highlighted groups are cliques. They form polygons.

Finding a clique in a group of, say, 5 dots seems easy, however what about 1000 dots? It's basically impossible.

The clique problem is NP, however it has another interesting characteristic pushing it beyond NP:

We can put any NP problem through a "transformer" and turn it into a clique problem. This means we can turn a factoring problem into a clique problem and so forth.

This means the clique problem is NP - Complete. If we find a way to solve it fast enough to where it becomes an P problem, then we will have turned every NP (Hard to solve) problem into a P problem. This is a huge deal.

The even more interesting thing is that scientists believe that there's no way to turn an NP-Complete problem into a P problem, or that P != NP, however they can't figure out how to prove it. So, no one really knows if P = NP or not.

Cheers :)!

## College, Stephen King, and Python!

I have three things:

Thing One:
I'm taking a online course (from Rice university :)!) called "An introduction to interactive programming in Python!".

Thing Two:
I'm reading my first Stephen King book! The running man :)!

Thing Three:
I'm learning Python!

So yeah, awesomesauce :)!

## [Intro] No, I'm not leaving C++!

Recently, when I talked of learning Java, many people believed I was quitting C++ because it was too hard or I didn't want to push forward. And this isn't true. I'm still actively developing in C++ and learning in C++, however I'm trying to get a more in-depth understanding of C++ than Java.

Not much. I've been pretty focused on Java, however I'm going to have the enemy class finished soon!

And yes, I am continuing my C++ tutorial series. I'm just spending a lot of time making sure each entry is good :)!

Sorry for such a short post, Cheers !

## [Book] CSS3: The Missing Manual Review [Undetailed]

This will be a review of CSS3: The Missing Manual, graciously provided by O'Reilly for reviewing :)!

Before I continue, let me say that this will mainly be a review of The Missing Manual format. Rather than spend many paragraphs talking about how amazing the content is, I'll cut to the chase:

This book will teach you CSS3, Good Practices, Why it's Useful, and how you can create Responsive websites with it. I didn't read very in-depth because I already know and use CSS3, however it's a great review book.

And now on to The Missing Manual.

This is a great book format. Many technical books are either too boring, too gimmicky, or they don't teach you well. The missing manual contains some classes Gimmicks, however they're scattered and formatted well. Some examples:
"Notes". They were formatted to interrupt you on purpose. Rather than be tucked away, they help reinforce information while you're reading. They were very helpful.
Sections separated smartly.

The black-on-white format of the missing manual is used to it's advantage, with simple graphics and a great layout.

If you want to learn everything about CSS3, this is a great place to start.

## Taking a step forward to Java

C++ is a great language. It really is, and can be used in a variety of ways.

Unfortunately, it is basically like someone took a handful of paradigms and shoved them together. We've got some procedural over here, some Object-Oriented over here, some Functional over here, and oh, look, some Templates! Oh boy, will my code look like someone made a cake. Except the cake will be a mix of seven randomly-chosen flavors, which are placed here and there, with some inside the others.

Even worse, I chose Object-Oriented. Or at least, the book I learned programming from was ten years old and only had C with Classes. This would be fine in 1983, however today I'm left in the dust. With a small knowledge of C++, and a gnawing hope for something new, I set out on the path to java, littered with virtual machines, byte-code and a dash of object-oriented. Wait, about that last one, I meant that someone took the bottle of object-oriented programming out of the fridge, cut a hole in it, and poured the whole thing on Java.

I want to think that I'm taking a step forward. And in reality, I am. I'm taking a step back in C++ though. My resolution is to stop C++ coding. Of course, I'm finishing Space Invaders, and I'm going to write applications in it occasionally, however for the foreseeable future I want to forget C++. Why, you ask? Well, I want to re-learn C++.

Or, more correctly, give myself a great programming language to use (Java) in a paradigm I've dipped my toes into (Object-Oriented Programming) to create beautiful applications which utilize all of Java.

So, there you go. My opinion on me learning Java. Also, you guys should buy books form O'Reilly. I had a test, and they came through:

## [Beginners] How to get better? Program your algebra homework.

Being an intermediate developer, getting better is a huge focus of mine. I read e-books, program constantly, and follow established programming rules (S.O.L.I.D.), however getting better is still hard. I've come to the conclusion that the only true way to get better is to program (following rules from books, however).

How can you program constantly? You run out of ideas, and you still aren't ready to embark on a big project. There has to be some way to get better at programming every day.

And there is.

Program your Algebra homework. Or, if you're out of Algebra, program the lesson's on Khan Academy.

"What?", you ask. "How does programming my Algebra homework help me at all?". "What does it even mean to 'Program your Algebra homework'?".

Well, it's simple. Algebra follows rules. Repetitive rules. And what are computers best at (If you don't know the answer to this question in less than a second, go read some more beginner books.)? Repetition. Procedural programming is focused on repetition. The idea that you can do the same code many times forms the base of Computer Science.

So, to get better, and learn far more about programming (Especially design), program your Algebra homework.

What do I mean? Put what you're learning to solve, or do, or simplify into a program. You'll quickly find yourself with a large library of Algebra programs.

Want an example?

The quadratic formula (and discriminates). Why did I choose this as an example? Because it's very easy, making it a great example. All you need to solve quadratic equations is to plug in a, b, and c (From standard form:)

Do this every night, and you'll be a better programmer in no time.

(To see the example, download the file below. The code is in C++, however it should be easy to understand for programmers of all languages as it only uses basic conditional / loop statements, variables, and functions.)

## [Development] DarkBASIC is Terrible, and Space Invaders!

Hello all! I have had a very long absence (Okay, it was only a month, however I still feel bad ).

If you couldn't tell from the title, the first basic game I will be creating is Space Invaders!

I love Space Invaders, and allows me to flex some new graphics programming muscles, including (but not limited too ):
Projectiles
Efficient Collision Detection (There will be 20 - 25 Space Invaders Per Level)
State Machines
And Pre-Visualization!

I'm in the process of planning, however I will start official programming tomorrow!

And now to explain my long absence:

In the time being, I have:
Learned BASIC
Learned DarkBASIC

Yes, I have learned DarkBASIC.

I have been wanting to learn DarkBASIC for some time. Originally I believed DarkBASIC was a quick way to prototype games and program graphics.

And wow, was I wrong.

Although DarkBASIC has probably helped me become a better quality, the only real redeeming quality I've seen is learning BASIC. It's a great beginner language, however it can only really achieve 2001 level graphics. It's more for learning basic graphics programming (Even then, it's procedural programming syntax is horrendous. Imagine C, however you must use:REM User-Defined typeType myType string$REM You can't have functions in objects, making them more like glorified containers.EndTypeREM For some reason, you must also use "End" to show DarkBASIC where your program ends, and you mayREM only declare functions after your program ends.EndREM A functionfunction myFunction(x#, y#) returnValue = x# + y#EndFunction returnValueREM The returnValue goes after EndFunction (God knows why) this code) I imagined it as a mix of Basic, PHP, and a bad version of C. There are so many bugs, and the people who work at "The Game Creators" don't even know how to code. They hire a new programmer to fix bugs because there sole goal is making money off new programmers who believe DarkBASIC is a good way to get into graphics. Spoiler: It Isn't. There are literally no redeeming quality's of this language. Also, when you create Sprites / Images, Three-Dimensional Objects, or almost anything important involving graphics, they don't allow you to name it (At least with variable you only have to put symbols after their names or use a terribly inefficient AS command). You give every object a number. What? A Number. How are you supposed to tell what different objects do? And this is why I hate DarkBASIC. It makes its users write terrible code (I don't believe it's possible to write good code using the "number" system), and advertises itself as a "professional game engine" that will help its users. I'm abandoning DarkBASIC for normal BASIC (From what I've seen, the Graphics Libraries for plain BASIC are even better, never-mind Visual Basic), and programming Space Invaders in C++. Also, Hooded is still on Hiatus (Sorry ) Cheers ! ## [Development][C++11] Hooded Break! I've been working on Hooded, and having trouble. I don't have a firm grasp of the C++ language. When I got the new edition of "Teach Yourself C++ in an Hour a Day", I didn't finish reading it. And that was because I wanted to read through the whole book. I got bored eight percent in, and here's why: I'm pressuring myself. I'm making myself read throughout whole specifications and books about subjects I either already know or only need to know an area about. So, today, I have a new goal: To read throughout all of the C++11 Chapters of "Teach Yourself C++ in an Hour a Day", and some of the class / template chapters. And the reason why is simple: I already know everything else, and I've already read at least two beginner books about everything else. I do not need to re-learn any basic information, and if I attempted reading the first few chapters, I would bore myself and give up. This is what I'm enjoying about my new C# book, also. The title is "A Programmers Guide To C#", and it doesn't waste any time with the basics. It goes in depth, using terminology I understand from other programming languages. Considering how many books I'm currently reading, I am taking a break from Hooded. I am also making some more basic games (Space Invaders, Tetris) using C++ before I move on. I have been having trouble with Hooded, and have concluded that many of my problems stem from an in-complete understanding of C++ and game development. I'm sorry, however at least I've made a lot of progress over the next few weeks. My next Hooded update should include a player that you can move around! Cheers ! ## [Web Development][HTML5] Aptana Studio Three File Systems As some of you know (I've been starting many of my posts with those words, I do not know why :)) I've recently started doing some freelance web development on the side. I've always used CoffeCup's amazing free HTML editor, however it's lack of support for scripting (JavaScript, Asp.Net, etc.) led me to find another choice. And thus, I came to Aptana Studio Three. Don't misunderstand me, I enjoy using Aptana Studio. It works great and is very advanced. However, it's a pain to begin using. This is mainly because of it's horrid file system. For some reason, Aptana studio caused every file you make to be saved as a windows "file". These files are useless, cannot be linked throughout code, and are pretty much pointless. However, Aptana saves your files using this system, and makes it very hard to get around the fact that they, for some reason, enjoy these windows "files" in their programs. There is a fix, however. When you go to save as, although it doesn't give you the option, type in "file_name.file_extension". The file will be automatically saved by that extension and referred to using that extension. I honestly believe this was simply overlooked. It is using templates, however, which might be why everything is saved as a "file". It still is trivial to at least provide a drop-down box (Which is a standard windows function. It's almost as if they are trying to save your files with this extension). Aptana studio is still a great IDE, however. The HTML5 support is amazing. It shows, next to every element, which browser supports it. When you use a tag, it will show you every attribute you can possibly give it, with browser support, of course. The code highlighting is top-notch. Coming from CoffeCup's minimalist design, with no syntax highlighting, it works great. However, the color scheme is very dark and makes the otherwise great-looking interface seem cluttered and dirty. Another early problem was with projects. They have amazing Pre-Built projects, however the User Interface makes it harder to understand what's in your project. With a small change to the style (Mainly the background color), I believe Aptana would be far better. Aptana is amazing and perfect for extremely powerful and productive web-site design, however if you are only designing web-sites as a hobby or are still in the beginner stage, it's best to use a minimalist editor (I recommend CoffeCup's Free HTML Editor!). I hope you enjoyed my article, even if you're not a web developer! Cheers :)! ## [Development] Hooded Development #8: Progress! Finally! I understand. You're mad at me. I effectively stopped working on Hooded. Except I did not. Life has really gotten in the way, however I have a large amount of free time over the holidays. I've spend 10-12 hours working on Hooded over the last few days. It's made so much progress. It will hopefully be done by the end of December (This Month :)!) So now, here's some screenshots. ( The reason I'm using Minecraft Art is because I currently don't have my own Tile-Art! If you know / are a pixel artist and would like to work on Hooded, please contact me! We can discuss splitting any profits that come from it! ) So, let me explain. My Map system loaded this file:20 202 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 11 1 3 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 3 11 3 1 1 3 1 1 1 3 3 1 1 1 1 3 3 1 1 1 13 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 33 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 And turned those numbers into a map! Once I finish the Player (and Collision, and Physics) I'll give you guys a game-play video! Once again, I'm extremely sorry. I tried to keep up development, however it was harder to program with my limited time! I hope you didn't leave :). ## [Book] HTML Made Easy (By Paul Browning) If you've seen some of my last few posts, you might know that I recently started learning web design. Don't worry, I'm still working on hooded. I just wanted something new and fresh, so web design it was. I started with HTML, using HTML Made Easy by Paul Browning. This is my book review. HTML made easy also covered CSS. HTML made easy by Paul Browning is great. Definitely the best book I could have bought, and it made the language fun, simple, and easy. It all started with HTML. The HTML section is great. He goes through a chapter explaining to you, with rich formatting including tables and everything the Kindle Fire has to offer. Then, at the end of the chapter, he gives you an example including everything you've learned. At the beginning he keeps everything simple. I love his writing because, unlike other programming writers, he doesn't foreshadow far more advanced topics (I'm looking at you, C++ Primer Plus). He offers a clear concise explanation without the "We'll learn more about this in Chapter 5.2". He makes sure to never get off track from the content of the book. A great example of this writing style is when he talks about forms. While talking about them, at the end he says (I'm paraphrasing) "Normally, you'd pass this information into a database. That is beyond the scope of this book, and if you'd like to learn more try to get a book on PHP.". This is great. Rather than confusing me, he offers a easy to understand explanation of what I would normally do in this situation, and then gives me the resources to find information. There's no weird code snippets that have PHP just to show an example of databases. The only time he breaks this rule is at the end of the book, when he talks about extending your knowledge with JavaScript and PHP, while giving an example of each. Another great part of the book is his great know-how of actual programming. The only thing I could frown upon from this book surrounding this topic is him only mentioning PHP as a dynamic programming language. I felt like he was a little too new to the subject to be writing a book about it, mainly because of the fact that the only dynamic programming language he mentions or gives examples of is PHP. He picked the most popular one, rather than the best. The CSS section is shorter, yet still good. You can still create good websites, however not professionally. Although he doesn't cover 's or 's, those are part of the box model and at the end of the CSS section he talks about the box model, stating that if you want to get more advanced you should do some reading on it. Overall, the book was amazing. It is a great way to learn HTML, and surprisingly cheap at$3.99. If you want to learn web programming and want a less costly beginner book, this is it. After reading, I still went and read through the HTML and CSS sections of html.net, which definitely helped me get more advanced. The CSS section especially. Although the book is HTML made easy, he covers the essentials of CSS, and nothing more.

Cheers, please tell me your thoughts on the book or web programming in general !

## [Case] Breakout!

Wow, it's been a very long time since my last case study! Well now, I'm here to give you a great one: Breakout!

You control a single paddle that can move left and right.
There is a 2D array of blocks.
The Paddle is at the bottom of the screen, the blocks are at the top.
There is a ball that bounces off your paddle, the walls, and the blocks.
If the ball hits a block, it will destroy the block, making it disappear.
If the ball goes past the players paddle and hits the bottom of the screen, you lose the game.

So, this was extremely popular back in the day. What made it so popular?

Well, it was a single player game. At this time, Pong required two players and was very simple. This simply blew people away, and it didn't require someone else.

It also had interesting game-play. Pong was relatively simple compared to this, and this was far more addictive. Failing when you were only 1-3 blocks away was common, and kept people hooked. Newer versions of breakout (Such as Arkanoid, etc.) also had power-ups and more levels, making them even more addicting. Working your way up a steady stream of harder levels, and trying to get the next power-up, still remains fun and challenging. (If you want to try, I've attached DXBall, a newer version of breakout, for you to play !)

[size=8]Polish

This game doesn't really need to be that "polished". The one "polish" aspect of it that I see being important is the GUI, however besides that, this game is fun even with bad sprites/collision detection (In this time period, of course. Back when it was an arcade game and it cost a quarter to play, having buggy collision detection would make no-one play it because you could randomly lose your quarter. Now, however, it's free and having slightly buggy collision detection isn't that big of a deal.)

[size=8]Implementation

Implementation is very important. If the ball is moving too fast, you can't survive long enough to get rid of all the blocks. If there is too many / too little blocks, your player will get bored / feel ripped off. Level design isn't that important, considering you can really do whatever you want for level design and it still is generally fun to play. The actual core values of the game is important (Like the Paddle Speed, Ball Speed, Amount of Blocks, etc.) however many of the extra things (Power-ups, special blocks, etc.) are nice extras that really help tie it together, yet aren't needed if you can make sure your player is having fun without them.

[size=8]Fin

Well, I hope you enjoyed it! Keep calm and sneak on !

## [Structure][C++11] The Auto Variable

How many C++ programmers reading this know what an auto variable is. Come on, raise your hand. I count 1... 2... 3... Almost all of you!

However for those of you that don't know the basics of the new standard yet, auto is a new variable that works like this:

Code:

// Hooded.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
auto Compiler_Determines_This_Is_An_Int = 5;
auto Compiler_Determines_This_Is_An_String = "I Am A Auto-String";
auto Compiler_Determines_This_Is_A_Float = 3.14;
auto Compiler_Determines_This_Is_A_Char = 'C';
auto Compiler_Determines_This_Is_A_Boolean = true;
std::cout std::cout std::cout std::cout std::cout system("pause");
return 0;
}

Output:

5
I Am A Auto-String
3.14
C
1
Press any key to continue . . .

I can't believe it! It's the equivalent of a "var" in other, newer programming languages! It's perfect!

So, what just happened? The compiler used the values I initialized the variables with too set their type. Essentially, an auto variable that's type can be determined by the compiler.

There are some rules, however:
Auto variables have to be initialized to a value when they're created.
Auto variables can't have their types changed after initialization.

There are many uses for this in advanced and generic programming, however I'm going to talk about it's use for the beginning C++ programmer.

First off, I believe that using this for generic programming is fine, as clarified by Aardvajk.

The problem arises when beginning programmers want to be lazy and use these for everything. That is bad programming practice, and a lazy work ethic. You should know the types of your variables in your program, and using the auto variable because you don't want to memorize the names of the basic types defeats the purpose.

Now, where can I see myself using this variable? When I don't know the type of a variable I'm receiving. This generally doesn't happen very often unless you're dealing with generic programming, in which using this value is perfectly fine.

I also believe auto variables could be very confusing. If someone defines all their variables as auto variables, than I'll have no idea what the type of each variable is. This is especially noticeable in classes with an auto variable in them. If the variable is initialized in the constructor of the class, then I'd have to hunt through your code to find the type. This can be overcome by leaving a comment telling me what type the auto variable is, however that seem to defeat the purpose.

I hope you enjoyed my (now corrected) blog post. Cheers !

## [Development] SCREENSHOT (Hooded Development #7)

It's a Screenshot!

Of Grass.

That looks like crap.

What you're seeing right there is an image of grass that my Tile System loaded from a file.

The Tile System is currently in the process of getting scrapped and rewritten, so there you go. Isn't it amazing!

I hope to load more tiles, and show you a big array of different tiles, soon. However, on Black Friday I got a new monitor (Which I'm using right now). It was hooked up today. I'm going to be gone on the weekend too, ! I feel terrible, I want to stay and program, get some work done, however life keeps on getting in the way. So enjoy the screenshot. Also, as of now, I am looking for an artist that would like to do some Tile / Sprites. I'll put your name on the credits, etc., yet the game won't be sold, so there will be no profit. No pressure, however just look at that crappy grass!

Sorry about the crappy screenshot. I'll hopefully have some new code to show you next week, that's shiny and fun !

## [Development] Hooded Development #6

I know, I know, you want screenshots. However very unfortunately I am away from the computer all of thanksgiving week, so you'll have to wait.

I haven't been very active recently, and I'm very sorry. I've had many things to do recently, however I've freed up a lot more time this coming month. I hope to have a fun game (albeit not a finished one) within this month. To keep my mind thinking (And to learn C++11, the only book I've ever used was published 15 years ago (I'm not kidding)) I just bought on my kindle "Learn C++ In An Hour A Day". I was very sad when I found out the new edition was the first one not co-authored by Jesse Liberty, because I enjoy his writing and was kind of scared this wouldn't be as good. I'll probably end up giving you guys a review soon, however it's looking good so far.

Also, Here's how I'm handling everything:

structs / enums

For example, I'm going to have a "Tile" struct. That will mean my vector of blocks I'm using for the board will be made of Tiles. Each Tile has a TileType (Enum), a position on the board (In X / Y, mainly to simplify collision and movement.)

The reason I'm doing this is because, well, it's simpler. I realized It's going to take many frames to play my animations (spritesheets), so I should have an Enum that holds the players current action. For instance, if the player is currently in a "Jumping" state, I'm not going to let them "jump" until they are in a "Standing" or "Walking State". This will make it so much easier to handle the players movement than the system I was originally going to use, so I'm happy that I thought of doing this. There's many more examples than the two above, however so far I believe this strategy will pay off.

Overall, I'm extremely sorry about no screenshots. I'll get you them, I promise.

Also; I just finished Portal 2 yesterday. Lots of fun was had, and I loved the characters. Now I'll get back to being productive !

## [Development] Hooded Development #5

Hello guys! This is another Hooded development post, so here it goes:

I haven't started refactoring yet. This weekend I was away from the computer, however this week I'm officially starting refactoring. Here's my official project scope (For you people who want to know how far along I am!)

SCOPE:
+Swords
+4 Enemies
+Platformer Elements
+RPG Elements
+Tile Based

I'm making all my code centered around this feature set, however I'm also trying to make it more expansive in case I want to add Bows or More Enemies.

Expect the first screenshot in 1-2 weeks!

## [Intro] It's Halloween! What are you dressing up as?

Hello everybody! Here in the U.S., It's Halloween! So, what are you dressing up as? I'm going as a nudist on strike (Look it up !)

## [Development] Hooded Development #4: Refactoring!

We are refactoring my code. More correctly, I am refactoring my code for Hooded. It is honestly terrible. What do I mean? Examine:

I didn't Pre-Visualize. My previous article stemmed from this, because I didn't pre-visualize and thus have scrapped all of my code. Literally all of it. I now am ten pages into my development journal (For every project I start, I pre-visualize by getting a 100 page journal and writing down the framework. I also jot down any solutions to problems I come up with at random.), and may I say it's coming along nicely. A lot of the things I've "put off" in the first development I have though extensively about, and thus this time I hope to throw away zero lines of code. Also, I never told you guys what Hooded *was*. So, here it is:

Hooded is a 2D tile-based platformer. Your character is in a hood the whole game, and you do not know who he is, however you see his life under a veil. You will navigate largely puzzle / maze based maps with combat mixed in. The combat will consist of swords and, in a update after release, *maybe* bows. The game will be made by me, Thomas Hobohm.

There it is. That is really the premise of Hooded. There is more, however that should be enough, for now...

## [Beginners] Pre-Visualization Is Important!

Hello everyone. This post should be pretty long (and heavy). I feel that this mistake is being caused largely by the more seasoned developers on here (Also known as, not me) using the wrong words to describe how the pre-visualize. This led to me making a large amount of mistakes in software development and has made me scrap so much code. So, without further ado, I present to you: The Importance Of Pre-Visualization

Many a beginner on gamedev.net (including me) has trouble with their software in the beginning. I had no idea how to plan for projects or what was even included in projects. I would look for posts about how to plan out projects. Generally when these questions get ask the seasoned developers on here (Also known as people who have worked on many finished projects) answer with responses like:
[quote]
I have a really iterative design[/quote][quote]
I don't really pre-visualize, I try to sort out more details at implementation[/quote]

Now, that's not to say these developers are in the wrong at all. For a beginner however, these terms can be very daunting and confusing. For me, I thought I shouldn't really pre-visualize at all and that everything would sort itself out eventually (Boy how wrong was I ). In this article I plan to explain to you how I pre-visualize my projects, how much you should really be pre-visualizing, and why it's important. So let's jump right in with the third one: Why Pre-Visualizing Important?

Pre-Visualizing allows you to plan how your classes interact. Imagine this: In many projects, your Collision and Physics interact, and almost all of your classes have to access a singular Map for the level you're on. How they will interact and how the map will be handled must be thought out so that the code you write at the beginning will be prepared for how the other classes use the Map. This must be sorted out in pre-visualization because you write certain code (classes) at different times, which means if you don't think about this you'll end up re-writing enormous amounts of code.

Pre-Visualization also defines project scope. Knowing what you plan to accomplish and what accomplishing that includes helps with development (For one thing, you will be able to gauge your progress and define what needs to be done next). When making a Side-Scroller, understanding the scope of the enemies A.I. is important so you'll know the work involved. If you make simple A.I., you can compensate with adding bows to a Side-Scroller that was originally only going to have swords. Now that I've made that analogy however, let us move on to another important topic involving why pre-visualizing is important: Understanding the Mechanics of your game.

This ties into project scope. The mechanics are part of project scope because the more complex the mechanics the more time it will take to implement them. Imagine this: Having a Bow involves a lot more coding (Handling projectiles shot, their collision, how fast they move, animation for them, etc.). So at project scope, you define if you'll have a bow or if you'll only have swords. This lets you only plan for swords. The first part of planning should always be defining your scope.

Now on to the second part: How much you should be pre-visualizing. My general rule is figuring out your hierarchy and how your classes will interact, however I leave out the actual coding details. I know how to code, and a large part of my actual software-design is figuring out how to solve problems or thinking about the best way to solve a problem. Figuring out what those problems are and how you'll solve them is pre-visualization. Actually planning out my code, what my functions will pass in, etc. shouldn't be defined in pre-visualization (Except for small, single-task programs like converting one form of a linear equation to another form.). Solving these problems before you start coding make sure that all the code you right already had that problem in mind (So when a problem turns up or when you are implementing something, you don't have to scrap existing code).

Some problems are bound to be encountered while coding, and trying to write down and fix every minute detail of your program is an example of bad pre-visualization. You can't anticipate everything, however anticipating what you can (AKA the bigger problems and ideas) will help exponentially.

Now, what you've all been waiting for: How do I pre-visualize? It's simple really. I get a notebook, write down the name of my project. I define the scope, the mechanics, and then take one or two pages in the notebook I label "Classes". I figure out the basic classes and write down their responsibility (Defining responsibility make sure you understand what all of your classes are actually supposed to be doing). Then, I take maybe a page for each class or important mechanic and think about it hard. I think about how it'll handle it's responsibilities and how it will interact with other classes. The key word here is interaction. Interaction is a huge part of software design (Especially video game software design.). This allows me to anticipate the basic structure of my code and the problems I'll run into. Then for a day or two I'll read over what I have and reflect. After I do this, I take my journal to the computer and start coding. This whole process is one to two weeks.

The main point of this article was to stress how important pre-visualization is to beginners. Now, it might just be tic-tac-toe, however still get in the habit of pre-visualizing. It'll pay off in the long run.

If you enjoyed this article, please post down below. If you have any recommendation about how you plan or any corrections, feel free to share them with everyone. Cheers !

## [Development] Hooded Development #3

Hello everyone! Welcome to the third Hooded Development update! What has been added today, I wonder? Well, right now this is what's happened since last time:

+Refactored some lazy code

I'll start off with first one. I have added a Graphics manager that is responsible for containing the current Tiles for the screen's "board". (In SFML, Sprites and Images are divided. So for display purposes, I need an array of sprites whose images change depending on the position of the player. Thus, the map is updated every time the player moves.) There's a struct called Tile who contains a Tile's image, a Tile's Sprite, and a Tile's Type (labeled terrain). So the idea is that my Graphics Manager class has a 2 dimensional vector of Tiles which I change whenever the player moves.

I'm taking an approach where the player has 2 hit-boxes making it possible for him to go between tiles (No slopes for the win (Maybe next time (This is getting really nested ))). My Collision class will handle collision, and if it finds collision it'll pass a set of points and a type of collision to my Physics class, which is responsible for determining the physics (Where the player should end up when they collide with a block / Figuring out Velocity and doing Algebra problems, the general stuff). Physics will determine where the Player should be. For pure ease of use, readability, and expansiveness purposes, there is a separate class that handles movement which the Physics class calls. Then, my Graphics Manager's Map will be set and it'll render everything where it should be.

Now to move on to the elephant in the room, the second one. My code for the Graphics Manager and the Map manager was pretty bad, so I'm still refactoring (I really didn't think through my Map ). Overall, I believe that development is coming along (albeit pretty slowly, I keep on browsing the web trying to figure things out.)

I believe these development posts are really helping me get my thoughts together and continue development. Any recommendations for handling things and / or corrections are welcome in the comments below. cheers !

## [Structure] Stop The Catch All's!

How do you write your classes? Are they neatly divided into different member functions, each one handling a small responsibility that plays into the larger responsibility of the class? If they are, good for you! You're following one of the main Principles of clean code, the single responsibility principle. However you're taking it a step further. Instead of only applying it to your class, you're applying it to your functions too.

Wait, do you have the common Update() function? Or how about the Logic() function? You might have your classes neatly divided up, however this will ruin your whole class. The point of the single responsibility principle is to make your code easy to read and to make it easy to understand why you're doing what you're doing. Calling Collision.Physics().CheckCollision(Collision.GetNextTile(), Collision.GetNextTile()) would be almost impossible to understand, that's why you divide you Tile Manager, Physics Manager, and Collision Manager into separate classes. So calling Collision.Logic() or Collision.Update() ruins the harmony. What does Logic() do, what does Update() do? Wouldn't it be far easier to read if your code was calling if it was structured like this:

for (int CurrentTile = 0; CurrentTile {
Collision.CheckTile(CurrentTile);
}
if (Collision.ThereWasCollision())
{
Physics.AcceptCollisionPoints(Collision.GetCollisionPoints);
}

It would be. That's why calling an Update() or Logic() function is bad. No-one will have any idea the sum of what that function does. Imagine going back to your code in a month (Wait, do I still have to give my Physics object the collision points, no Update() does that, what about testing Collision on slopes?....). You'll have no idea what functions you need to call, and it would probably result in you searching through your Physics and Collision classes trying to figure out what's doing what.

This often becomes and issue of coding the right way or going the lazy path. A lot of times you just want to write the "catch-all" Logic() or Update() function because you're lazy or don't want to write down the extra code. Now, if you're going to be doing what I did in the code above many times, then it would make sense to create a function that does it for you. You just need to give it a proper name (Collision.CheckCollisionandSendPoints(Physics)). Now, there is probably a better name for it, however I just couldn't think of one (Stupid Me !).

Even if it's more code, coding the right way will pay out in the long run. Resulting in adding features extremely easy. For example, when I made breakout my code was filled with these functions, all kinds of extremely specific properties, and a code-base that resulted in needing fifty classes passing to each other, making adding power-ups a futile attempt. You often need to strike a balance. My code-base would have been more expansive and readable had I been more lenient on the principles I was using. You can never "always" apply a principle, however when it applies, it applies (When using it strictly makes sense, it really helps your code).

I hope you enjoyed this article, and please comment below with how you handle your functions. If you disagreed with it or have a correction, feel free to criticize me and mock how amateur I am !

## [Intro] Instant Gratification (And Why It's Important)

Many people start an endless amount of projects to no avail, finishing a small amount of them because they get bored halfway through development and/or have an onslaught of new ideas. They don't see the idea of instant gratification, and they don't apply it.

What do I mean by instant gratification? Think about this: How much more happy would you be to work on your game if every time you programmed something new you saw the effects? The idea behind instant gratification is to develop small things that snowball together, meaning that you won't stop development because every step of the way you'll see the effect it has on your program. Wouldn't it be far easier to work on the coding for your game if you knew at the end of a few hours of work the new feature would be something that you could see or hear.

Now that we know what instant gratification is, how do we apply it? If you don't apply the idea of instant gratification right, then your code will either become a mess or you'll end up with half-done features that would be better left out. You have to apply instant gratification correctly for it to work for you. How I generally apply it is by testing these out in small interactive ways. I just wrote a new Input Manager, so I make an extremely small game using it (A pickin' sticks clone with two squares). With instant gratification, instead of bending features to see their effect (Coding a graphics library with unnecessary things so that you can see the effect all the time), you need to take the code you need and utilize it for something to keep you going. It would be dumb to code in special functions into my Input Manager so that as soon as I start coding I'll see the effects.

Now, using the technique above you may find there are still things you need to hard code before the gratification, however that's software design. The idea behind instant gratification is that with every new feature you make, you'll see the effect. So, that means you have to actually make the feature before you apply it. Now, what I mean is once I've actually made a feature to catch mouse clicks and see if the position of the mouse is inside a box can I write a mock up main menu.

This effect can also be considered as the SnowBall effect we'll talk about in another article. The snowball effect is where you start with expandable basic features and then expand, making sure you can see the changes for every expansion. The instant gratification effect works in tangent with that, and it's smart to make them work together.

Now, why is it important to apply this technique? It's important because as a developer, you need to be motivated. Once you're out of the learning stage and you're making games that you honestly want to see being made and love, it'll be harder to get motivated to continue on projects. Applying this will make it so that you're always happy to continue coding and developing your games.

If you liked this post, please comment down below about what you do to stay motivated, and if you didn't like it or have corrections, post them down below. Cheers !