Aug 23

Ludum Dare Game Jam August 2011!

As a lot of game developers know, this weekend was the Ludum Dare game jam/competition! Competitors had 2 days to enter a game they wrote from scratch in this hectic jam.

I made my entry in about 1 and a half days, but I still think it turned out pretty well! I wrote it in straight C using the SDL game library for rendering & input, and compiled it in Windows under VS2010.

If you want to check it out, you can find the Ludum Dare entry here, or just download the game straight here. Just extract the zip and run ryanslabrynth.exe and enjoy!

If you’re on linux, massive thanks to vede for compiling this Linux version of Ryan’s Labrynth!

Someone on the Ludum Dare IRC completed it and got a screenshot, hehe http://nfd.dyndns.org/misc/winnar.png

-Ryan

Posted in My Project Showcase | 3 Comments
Aug 17

BulletSpree – My first released Flash game in a LONG time

Hey, long time no writing in this blog. For anyone who read the blog before, you may have noticed I bought a domain name for it. This is mainly so I don’t have to use the wordpress.com site anymore; it had a lot of restrictions and I didn’t think the price for removing them was fair, considering I could get full hosting & add WordPress to it myself so cheaply.

I’ve recently been working a lot in Flash, and just released a game I worked on for a month or so. The game is called BulletSpree! It’s basically a top down machine gun defense game; totally caters to all your machine gun mowing needs. And it has blood too. If you wanna play it, it’s currently only on Bubblebox.com so here’s the link to that;

BulletSpree by Ryan Pridgeon

Click Here To Play BulletSpree by Ryan Pridgeon

The game was programmed by me, and the art was done by Chaz Carter, who you can find at his site, FlashChaz.com. I wrote it all in object oriented Actionscript 3, using Flash CS5. The game idea was rather simple, so the only challenges I met were really integrating it with high scores, but it was a hell of a lot of fun to make.

However, using Flash to compile the game was a pain in the ass, and its IDE is far from ideal. Now I’ve started using Flashdevelop for the code & the Flex AS3 compiler to compile. The art gets made in Flash an exported to asset “component” files that can be used in my code and compiled into the final app. This seems to be a much nicer way to work (at least from a coding point of view) so I’ll probably continue this way.

In other news, I’ve started working on a little something in C. It’s been a while, but I’ll post more when I’ve made more progress. Enjoy the game :)

-Ryan

Posted in My Project Showcase | 1 Comment
Jan 06

Tetris Remake C++/SDL

Over the last couple of days I’ve been working on a little Tetris type game in C++. I once saw a website that said every game developer should start out with Tetris, and although I’ve been doing this for a while now, I thought it would still be worth it for the practise and fun.

So yeah, here’s the final product. Written in C++, using the SDL & SDL_Mixer libraries for sound/video output. Follow the link below for a zip containing Windows executable, the source code, and makefiles. It will compile on all platforms supporting SDL.

Windows users do not have to compile to play, just download, extract and run tetris.exe.

Click here to download the Tetris game! (502kb ZIP compressed)

Thankyou to Kroki for the linux makefile and README!

-Ryan

Posted in My Project Showcase | Leave a comment
Dec 02

Multi-User Graphical Chat in C/SDL/Winsock

Long time, no post.

So anyway, recently I finished a simple TCP/IP multi-client chat program. It’s a pretty nifty, fun little app where you can run the client which will connect to the server and you can chat with other clients on the server. I wrote it using C.  For libraries, I used SDL for window management, rendering and threading, and I used the Windows Socket library to handle the networking.

You can find the source and Windows binaries here

Click here to download the ZIP

Unblock port 666 to allow people to connect to your server.

This project actually came out of a small, simple SDL command line which I wrote. It allows me to poll for string input, at the same time as printing to the console and displaying the whole thing.

(I even drew out the damn font using the pencil tool in Ms Paint)

This was awesome for me, because I used alot of threading for the networking. So I made this multi-client chat server and a nice client. The server is the most complex part. For this, I first start a listening thread which waits for an incoming connection from a client. On connection, a new socket is created for the new client, and the server starts a new thread which listens to any data being recieved from the client. The client is added to a main list of clients, so that the server can easily send messages to all the clients.

When a message is received from a client, the receiving thread calls a function to send the data to every other connected client on the server. This allows the multi-user chat which can become so fun.

As far as the client is concerned, It’s pretty simple. The user inputs the server IP into the console, this then sends a connection to the server. On accept, a thread is started to listen to the data recieved by the server, and a listener function is set to send all data which the user types in.

So basically, you type -> sends to server -> your thread in the server triggers a send -> the data is sent to all connected clients -> connected clients see your message in their command line.

I’m well proud :)

Posted in My Project Showcase | 1 Comment
Nov 12

Old Abandoned Flash Game

Just thought I’d share a Flash game which I never finished for various reasons.

Here you go everyone :D

Click here to play (A to attack, S to evade, Left+Right cursor keys to run, Up to jump)

This is an old action game I made when I was 16. It was made in AS2, but I then learnt AS3 and lost motivation in the project for the dated code design. I made the code and art single handedly.

Posted in My Project Showcase | 1 Comment
Nov 08

Perspective 3d Rendering in Flash


I decided to post on here I cool project I made a couple of months ago to test my understanding of 3d rendering and, well, maybe test my maths a little too :)

This is a 3d rendering app and pipeline which I made myself using nothing but Flash and Actionscript 3.0. I used no other pre made code or libraries.

Click here to see it in action, rendering some simple shapes. (There’s more at the end of this post)

The FPS counter shows the number of frames per second. The max is 125, and the higher the better. As you can see, it’s very fast, and looks perfectly accurate. This is because I made this while learning OpenGL. The dudes on Elysian Shadows IRC were an awesome help on  this project.

What I did was make a simple API for those using the 3d renderer, in which you pass 3d points to functions I make such as drawTriangle.

My drawTriangle then takes these 3d points, and passes them through a function which converts from 3d space into 2d screenspace. I do this using some heavy matrix multiplication; first, the 3d points are passed through the world transformation matrix; this basically controls the camera position and allows easy translation and rotation of objects for the developer. Next, it is passed through the projection matrix. This is a matrix which converts it into a nice proportioned point. With this, I then divide the x and y coordinates by the Z for perspective.

By now I have a 2d point for each point in 3d space, between -1 and 1. So I simply multiply and translate these to fit between the width and height of the flash, which gives me the final 2d point on the screen.

Then I use the Flash API to draw a shape between the 3 points of the triangle, and add the triangle to my display list.

At the end of each frame, the developer calls the update function, which sorts each triangle in the display list by the depth, using my sorting algorithm. This means that triangles further away will be drawn BEHIND triangles that are closer.

This results in the nice system which you can see :)

However, I didn’t stop there. In order to make this more useful, I then opened up my C environment to produce a .MD2 model file loader. This is a program I made which parses a Quake 2 format file, and produces a .as (actionscript) file with the commands to draw the Quake 2 model in my Flash application. This means that anyone can use a standard 3d modelling package such as Blender or 3DS Max, and render their models inside my 3d rendering API.

This is pretty awesome, and I show you the following example below, in which I used my C program to render the Berserker enemy from Quake 2. Beware that this will run alot slower, as there are a good few hundred triangles being rendered;

Click here to see it rendering a Quake 2 Model using my C++ app.

I might release the source code in the near future, but if I do, I want to make something myself with it first. So stay tuned.

Thanks for reading!

Posted in My Project Showcase | 3 Comments
Nov 07

Absence, Assembly and A Quick Update

Hello.

I’m alive and I have an excuse for no updates! I’ve spent a holiday in Egypt (amazing country), but now I’m back and going to keep updating here.

Well, I love learning. Especially learning new things in computing, programming and game development, so recently I’ve been learning some assembly language. After a good week of learning I’ve managed to make some cool x86 apps.

I’ve been doing x86 from the comfort of FASM (a great assembler) and the msvcrt.dll linked library which I’m using for simple calls to printf, scanf and puts :)

The first was a recursive Fibonacci converter; basically the way I did this was to create a base label/function of fib(x), which inside will keep returning (eax) the value of fib(x-1)+fib(x-2) until x is smaller than 3 (in which case it will return 1). Alright, it sounds simple from a high level perspective. However this was a great exercise for someone like me (new to asm) as I had to deal with the stack, all the standard registers, and some arithmetic aswell.

Code for those interested; http://pastebin.com/f66ee467

Now I’m back to C/C++ and playing with some more general development and fun.

Keep on developing!

Posted in General | Leave a comment
Oct 25

Part 2: Basic Variables

Hello, and welcome to the 2nd tutorial.
Last time, we learnt how to make a project and print some text onto the screen. In
this tutorial, we are going to learn about variables.
Like in maths, a variable is a value that can change. We use these all the time in
programming to store numbers and data in our programs.
For example, say we were making a game, and we wanted to store how many points the
player has.
We would make a variable, lets call it ‘x’.
At the start of the game, the player would have no points. So we would set x to 0
x = 0
When a player shoots an enemy, we would want him to gain a point. For this we would
have to increase x by one.
x = x + 1
Hopefully this explains the importance and use of variables to you.
In C, we have to declare the variable by name to tell the computer it’s there. We
declare a variable like so;
type name;
Where type is the type of the variable stored. Common types are int (integer
number), float (floating point, can store up to 7 significant figures), char (a
character) and double (a float with twice the precision).
The name is what we want to call the variable. In maths, we commonly name a variable
‘x’, so let’s use that as an example.
This is how you would declare a integer called x
int x;
Now, to set x to a value, we use the ‘=’ assignment operator. If we wanted x to
contain 5, we would do this;
x = 5;
To write an integer onto the screen, we use printf like so;
printf(“%i”, x);
Where %i says we’re printing an integer, and x is the name of the variable we’re
printing.
Consider the following program;

#include <stdio.h>
int main(){
int alpha;
int beta;
int gamma;
alpha = 3;
beta = 2;
gamma = alpha + beta;
printf(“%i”, gamma);
return 0;
}
Can you guess what is printed onto the screen? The answer is 5. Let’s go over this
code in more detail.
At the beginning of our main function, we declare 3 variables
int alpha;
int beta;
int gamma;
Their names are alpha, beta, and gamma, and they are all integers. This declaration
allows them to be used to hold integer numbers in our program.
Next, we assign numbers to alpha and beta.
alpha = 3;
beta = 2;
This puts the number 3 into alpha, and the number 2 into beta. Now alpha holds the
number 3 in memory, and beta holds the number 2.
Our next line does something more interesting. We now use the + operator to assign a
value to gamma.
gamma = alpha + beta;
This line tells gamma to hold the value held by alpha, ADDED TO the value held by
beta.
In our program, alpha holds 2 and beta holds 3. 2 + 3 = 5, so now gamma holds the
number 5.
printf(“%i”, gamma);
This prints the value held by gamma onto the screen. Gamma is holding 5, therefore,
our program prints the number 5 onto the screen.
You can experiment with this to try subtracting, multiplying, dividing or
combinations of all 4 using the +, -, * and / operators.
Once you are confident with the concepts in this tutorial, the next tutorial will go
into more depth about variables.

<< CLICK HERE TO GO BACK TO PART 1: GETTING STARTED WITH C PROGRAMMING <<

Hello, and welcome to the 2nd tutorial.

Last time, we learnt how to make a project and print some text onto the screen. In this tutorial, we are going to learn about variables.

Like in maths, a variable is a value that can change. We use these all the time in programming to store numbers and data in our programs.

For example, say we were making a game, and we wanted to store how many points the player has.

We would make a variable, lets call it ‘x‘.

At the start of the game, the player would have no points. So we would set x to 0

x = 0

When a player shoots an enemy, we would want him to gain a point. For this we would have to increase x by one.

x = x + 1

Hopefully this explains the importance and use of variables to you.

In C, we have to declare the variable by name to tell the computer it’s there. We declare a variable like so;

type name;

Where type is the type of the variable stored. Common types are int (integer number), float (floating point, can store up to 7 significant figures), char (a character) and double (a float with twice the precision).

The name is what we want to call the variable. In maths, we commonly name a variable ’x', so let’s use that as an example.

This is how you would declare a integer called x

int x;

Now we have a space in memory, named x, which can hold an integer number value.

Now, to set x to a value, we use the ‘=’ assignment operator. If we wanted x to contain 5, we would do this;

x = 5;

To write an integer onto the screen, we use printf like so;

printf(“%i”, x);

Where %i says we’re printing an integer, and x is the name of the variable we’re printing.

Consider the following program;

#include <stdio.h>

int main(){

int alpha;

int beta;

int gamma;

alpha = 3;

beta = 2;

gamma = alpha + beta;

printf(“%i”, gamma);

return 0;

}

Can you guess what is printed onto the screen? The answer is 5. Let’s go over this code in more detail.

At the beginning of our main function, we declare 3 variables

int alpha;

int beta;

int gamma;

Their names are alpha, beta, and gamma, and they are all integers. This declaration allows them to be used to hold integer numbers in our program.

01

Next, we assign numbers to alpha and beta.

alpha = 3;

beta = 2;

This puts the number 3 into alpha, and the number 2 into beta. Now alpha holds the number 3 in memory, and beta holds the number 2.

02

Our next line does something more interesting. We now use the + operator to assign a value to gamma.

gamma = alpha + beta;

This line tells gamma to hold the value held by alpha, ADDED TO the value held by beta.

In our program, alpha holds 2 and beta holds 3. 2 + 3 = 5, so now gamma holds the number 5.

03

printf(“%i”, gamma);

This prints the value held by gamma onto the screen. Gamma is holding 5, therefore, our program prints the number 5 onto the screen. You can experiment with this to try subtracting, multiplying, dividing or combinations of all 4 using the +, -, * and / operators.

Once you are confident with the concepts in this tutorial, the next tutorial will go into more depth about variables.

Thankyou for reading.

-Ryan

<< CLICK HERE TO GO BACK TO PART 1: GETTING STARTED WITH C PROGRAMMING <<

Posted in Tutorials | 1 Comment
Oct 24

Part 1: Getting Started With C Programming

>> CLICK HERE TO GO TO PART 2: BASIC VARIABLES >>

Hello, and welcome to my first tutorial. In this tutorial, I will help you set up a programming environment, and guide you through to writing and running your first C program.

The program we will be using to write and compile our programs in this tutorial is called Code::Blocks. It’s a very lightweight, easy to use IDE ( Integrated Development Environment ) and will be perfect to set you on your way into C programming.

Step 1: Installing & Setting Up the Program

First, you will need to download the Code::Blocks IDE. Follow this link to download the installer;

http://downloads.sourceforge.net/codeblocks/codeblocks-8.02mingw-setup.exe

When you have downloaded the installer, start it up and follow the steps. I recommend you install it to C:/Codeblocks, rather than in Program Files, because this makes life easier when you become better at programming. However it is totally your choice.

Follow the install through until you’ve succesfully installed the program. Now that it is installed, open it up and you should be presented with a screen that looks something like this;

Make sure you select GCC as your default compiler.

Click “GNU GCC Compiler” (usually right at the top of the list) , and click Set as Default. Be warned that you do not click any of the other GCC compilers (such as GNU GCC Compiler for MSP430).

Now that you’ve set a default compiler, let me tell you what a compiler does.

When we write programming code, all we’re doing is writing into a text file. As it is, the code cannot be run by our computers. This is why we use a Compiler, which takes our code, and turns it into an executable (.exe) file, which our computer can run.

Step 2: Creating a New Project

Now that you should be able to run Codeblocks, you are ready to start a new project.

When we work with C, we use ‘projects’ to manage our files. Each project makes a program from the code in the project.

Because we want to make a new program today, we’re going to click Create New Project.

Click on New Project in the Codeblocks start screen.

Click on New Project in the Codeblocks start screen.

Now we are presented with a choice of project templates to help us get started.

However we only want to make a basic starting program. So we choose Empty Project, and click Go!

emptyproject

After clicking Go, we are presented with a setup guide. Click Next and you will be asked to enter a project name and directory.

For the directory, choose somewhere on your computer where you want to save your programming projects. I’ve use My Documents / Projects as a folder to store all my projects.

Next we enter a name for the project. For mine, I’ve called it ‘First’. You can choose whatever name you want.

(You do not have to change Resulting Filename and Project Filename fields, so leave those as they are.)

filenames

Now click next and make sure your screen looks like this;

config

Now click Finish and you will have created your first Codeblocks Project!

Congratulations.

Now we’re going to add a source file for our project. This will contain our code. To do this, we first click File -> New -> Empty File.

newfile

Then Codeblocks will ask us if we want to add the file to our project. Click YES.

Now save the file as “main.c”   . It is important you give it this name, so that the compiler knows this is the main code.

Make sure we are adding the file to the right compile targets and click OK.

targets

Now we finally get to write some C!

The first thing we are going to write in our new file is

#include <stdio.h>

This first line of code is basically saying “Allow us to use the Standard Input/Output methods.”

This allows us to write to the screen, and also allow the user to type values into our program.

Our next line of code will be

int main(){

This signals the start of our program (our ‘main’ procedure). The code after this will be what the computer runs when we start our program.

The int stands for integer. You do not need to know much about this yet, but it mainly allows us to give error numbers if something goes wrong.

In this program, we will write the words “Hello, World!” onto the screen. To do this we use “printf”. This is our next line of code

printf(“Hello, World!”);

‘printf’ is what we call a ‘function’ which prints a string onto the screen. A string is basically text – a string of seperate characters (letters) next to each other. What printf does is basically put a string (some text) onto our screen.

After writing onto the screen, we want to end our program. We now write the line

return 0;

This gives the error code 0. 0 means there have been no errors during our program. This basically tells the computer that the program has finished without any problems.

Our final line will contain

}

This closes our “main” function. This tells the computer to stop running our code here.

Now your code is complete! Your final code should look like this;

#include <stdio.h>

int main(){

printf(“Hello, World!”);

return 0;

}

#include <stdio.h>
int main(){
puts(“Hello, World!”);
return 0;

When you’re done, press F9 to compile and run your program!

You should be presented with the following screen;

run

Congratulations! You’ve created your first C program.

I hope this leads you on a long, fun, and interesting journey in C programming.

Thankyou for reading this tutorial.

>> CLICK HERE TO GO TO PART 2: BASIC VARIABLES >>

-Ryan

Posted in Tutorials | 3 Comments
Oct 24

Hello and Welcome.

Hello, my name is Ryan Pridgeon. I am 17 years old as of writing, and a keen game designer, programmer, musician and skateboarder.

I’ve been developing games since I was 8 years old, using tools such as Flash and eventually working up to using C and C++, where I normally use the SDL library with OpenGL. I’m also competent in VB.net, PHP, C#, and I’m currently learning x86-64 assembly aswell as some Java.

This is a new blog I’ve made to hopefully share some knowledge and interesting things with you. I plan on having some useful references, tutorials, programming exercises and maybe showcase some of my own work.

The programming will be mostly C/C++ and Actionscript 3 as these are my favourite languages. Hopefully you will find this blog interesting.

Thanks for reading.

Posted in General | 1 Comment