Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


Game From Scratch C++ Edition The Introduction

 

I have decided to take a quick detour from my primary game development, to illustrate how to create a more simplistic 2D game using C++. I am going to cover it over a number of posts, each building on the last and if you follow along, hopefully at the end you will be well on the road to creating your own games.

 

 

Why in C++, I thought you hated C++?

 

 

That is a good question with a bad answer. I am writing it in C++ because regardless to all the people say “DON’T DO THAT IN C++!” the vast majority of people still do. The problem is so many of these people follow outdated or just downright bad examples and establish a horrific coding style right from day one.

 

 

So often questions come up like “how do I split my code up into multiple files” or people state things like “I hate OOP, I’ll just use functions”. Both of these statements illustrate the failing of many tutorials. Using C++ without objects is like using a hammer only as a nail extraction tool; while functional you are entirely missing the point of the tool. One last thing that many new developers get hung up on… we are writing a game, not a game engine! Don’t overwhelm yourself with unneeded complexity when you are just starting out.

 

 

This tutorial is going to span a number of posts so that I can go into the detail necessary. I am going to make some decisions for the sake of readability, but for the most part this should be code that you can take away and develop a success game upon. Along the way I will try to explain things to the best of my ability. With each post I will include a download link with the project, source code, etc. I have this nack for going off topic or into detail and frankly that is part of what I enjoy about writing.  That said, it can be confusing or distracting for people that just want the facts.  In this case I will box such comments into “Optional Information” sections that you can freely skip and still keep up. 

 

 

One last thing, this post will not teach you to program. I am going to make certain assumptions about my audience, the biggest of which is that you have a few weeks of learning under your belt. I assume you know the very basics in one language like how to declare a variable or how to use an if statement. If you have absolutely no exposure to programming I suggest you head over here for some getting started advice.

 

 

 

What game are we going to create?

 

We are going to create a downright amazing game about two intrepid paddles in space, called PANG!

 

 

Yeah yeah, we are going to create a Pong clone. Frankly every first game should be something simple and fairly easy to complete. That said, if things in this post go according to plan, Pang should provide us a few interesting opportunities, as with each additional post we can add a few more features like 2 player hot-seat, AI, nuclear missiles, networking, etc.

 

 

Doing most of the heavy lifting will be the excellent SFML libraries. They are well designed and do a very good job of keeping you away from a lot of the harmful aspects of C++.

 

 

 

Stuff you need to follow along

 

 

Before we begin, there are a few things you need to download and install.

 

 

This tutorial is going to work entirely with Microsoft C++ Express 2010. If you have another version or different IDE, you can still follow along, but directions will be explicitly for Visual C++ Express. So if you haven’t already head over here and click the Install Now button.

 

*** One word of warning, if you already have a Visual Studio 2010 product installed and patched to SP1, you will have to reapply the SP1 after you install Visual C++ Express. It takes a long time, and yes, it’s very annoying ***

 

 

 

Next head on over to SFML and download the SFML Windows - Visual C++ 2008 headers / libraries / external libraries package. This link is a zip file, just save it somewhere on your computer, we will address it again shortly.

 

 

One last catch ( explained here ) is that the SFML Visual C++ DLLs simply do not work with Visual Studio 2010. I have compiled them for you and you can download them here. Again, simply save that zip file somewhere and we will use it shortly.

 

 

Finally you are going to need a paint program of some form. MSPaint will work in a pinch, but I would recommend Paint.NET or the GIMP instead. Download links for both can be found here.

 

 

Ok, now that we have everything we need lets move on to Part 1.

 

 

  Forward to Part 1




blog comments powered by Disqus


Month List

Popular Comments

Adobe releases updated cloud based game developer tools
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


Home > News >

4. December 2012

 

OK, I will start off by saying “cloud” is one of those massively abused terms and beyond Adobe wanting to catch some buzzword hype, this suite has very little to nothing to do with the cloud.  Do you consider 7zip a cloud based solution because you download it from the internet?  Didn’t think so…  Anyways, let me continue pet peeve aside.

 

So, what exactly have they released?  Well, we have:

 

Adobe Scout

 

Adobe Scout

Adobe Scout is a Flash based profiler.  In pure, unadultarated marketing speak, it is:

Adobe Scout is the next-generation profiling tool for Adobe Flash Player and AIR. It revolutionizes ActionScript development by showing you what's going on inside your content, in mouth-watering detail. Scout is simple and intuitive to use, freeing your mind to create sleek and immersive games! Try it today, for FREE!

So, yeah, it’s a profiler for ActionScript applications..

 

Plus it is free, which is of course nice.

 

 

 

 

Adobe Gaming SDK

 

Let’s starting with the marketing description:

The Adobe Gaming SDK provides the essential building blocks you need to create and monetize incredible ActionScript 3 games across devices, available in a single package from the Adobe Creative Cloud

In reality its the Adobe AIR SDK with a few open source frameworks ( Starling, Feathers, Away3D ) bundled in, plus a few iOS plus a native 3D file format and documentation. 

 

Flash C++ Compiler

 

Again, starting with the marketing speak:

Combine the power, familiarity, and high-performance of C/C++ with the unparalleled reach of the web.

With the Flash C++ Compiler (FlasCC) you can bring your native C/C++ from consoles and PCs to over a billion people on the web—across browsers, with no additional install.

Stunning native games, welcome to the stunning reach of the web.

This of course isn’t a new product, it used to be a product named Alchemy, but it is a new release.  Essentially it is a C++ to FlashVM compiler.  Think Google NaCL, just targeting the Flash player instead of Chrome.  If your game is written in C++, or if C++ is your weapon of choice, it is worth checking out.  The Flash VM may be a dying platform, but its a dying platform with one hell of an install base!

 

 

So what the hell does this have to do with the cloud?

 

Nothing, not a damned thing.  Well, that’s not completely true.  If you sign up ( free tier ) you can get 2GB of web based file storage and 1 private PhoneGap builds.  They are also bundling all of the above with their “cloud” based subscription offerings, but considering every single thing I just mentioned is free, that seems fairly pointless.  For an idea of what you get and what you have to pay for:

 

image

 

So, if you are interested in Flash based game development, be sure to check it out.

News ,

blog comments powered by Disqus

Month List

Popular Comments