Archive for the ‘Games Programming’ Category

Busy busy busy busy :@

29/05/2011 2 comments

It’s been more than a month since my last post, I didn’t run out of ideas yet! but I’m really busy with college & its projects :(.

One of the projects I’m working on is a game for a Graphics project. it’s a third person shooter game, you can watch this short video to get an idea about the game 😀

Stuff to share later when I get the time to:

1-XNA Glow effect (post processing) : how to make your models glow!


Glowing Effect : Look how the red parts of the object are glowing, the glow extends towards the out side of the mesh

2-Third Person Shooter aiming :aiming in third person shooter is Read more…

D.I.C XNA 3 Week Challenge

22/04/2011 Leave a comment

My Game Space Defender has just won the second place in the Dream In Code XNA 3 Week Challenge.

Well, I didn’t finish my game in three weeks but I participated anyway :), Actually my game was already done when the challenge was announced, What a coincidence haha :D.

Here are the results:

Robin19 – The Saga: Honorable Mention

LanceJZ – Space Zomie: Bronze Winner

Gray Fox – Space Defender: Silver Winner (and yes my nickname was Gray Fox before moving permanently to Fuchs 😀 )

Vmpwje – Block Invaders: Gold Winner

XNA Fuchs InputHandler

22/03/2011 2 comments


Each XNA “Game” I program I have to take input, something like the following

KeyboardState prevKeyboardState;

protected override void Update(GameTime gameTime)
    KeyboardState keyboardState = Keyboard.GetState();

    if (keyboardState.IsKeyDown(Keys.Left) && prevKeyboardState.IsKeyUp(Keys.Left))
        // Do stuff

    prevKeyboardState = keyboardState;

I have to create two KeyboardStates, one for this frame & the other is for the previous frame. Then in most cases I check that some button is pressed only in a frame not in its predecessor…( because even if you press a button and remove your finger quickly the, button will be considered pressed in more than one frame )

Same issue goes for the mouse.

So I thought I should create my own input handler, Read more…

Fuchs Navi Wheel – A Creative way of steering a car in a game

01/03/2011 Leave a comment


One day while I was studying for an exam then an idea came to my mind!
Wouldn’t it be cooler to use the touchpad to steer a moving car (instead of the boring Left\Right keys)?

I’m not a big fan of racing games but I liked the idea…
To simulate rotating a real steering wheel the player should create circles on the touchpad, counter-clockwise (ccw) to steer left, clockwise (cw) to steer right.


Steering left using the touchpad

Moving the finger in such a way should continuously steer left

Read more…

XNA FuchsGUI part V

16/02/2011 6 comments


1-Introduction to the GUI.
2-Hello control :D.
3-Hello form.
4-Exporting forms easily from Microsoft Visual Studio Designer to FuchsGUI :D.
5-The future of FuchsGUI & some notes.


This part of the tutorial is the last part of the series..

I don’t know how to organize this post since it’s not a tutorial 😉 so I’ll start with some notes on FuchsGUI.


A post without an image is a dull post 🙂

Textures & Fonts:

As you saw each control takes a Texture2D parameter in the constructor, well… having many textures might have a bad impact on performance, because if you first draw a Button and then a TextBox the GPU will have to change textures.

A better solution is Read more…

XNA FuchsGUI Part IV

15/02/2011 4 comments


1-Introduction to the GUI.
2-Hello control :D.
3-Hello form.
4-Exporting forms easily from Microsoft Visual Studio Designer to FuchsGUI :D.
5-The future of FuchsGUI & some notes.


Okay, if you’ve been following the tutorials, you should have noticed how creating controls is somehow uncomfortable :(…
The first place where I used my gui was an artillery simulation project in XNA.
I had to make lots & lots of modifications to the forms of the simulation, If I wrote the code for every form manually I might have lost my mind and started screaming something like “Damn! this button should be 3 pixels lower”, “ops! this textbox should be wider :(“

But before getting deep inside the gui of the simulation an idea came to my mind :D.
Why troubling myself with writing 1** lines of code for a single form while I can generate the code from Microsoft Visual Studio??

I’ll have to admit it’s a little lame to use the Visual Studio designer but I found it better than wasting time programming a designer :).

The main idea of the code generator is:
-Running a pre-made Visual Studio project (windows forms application) with a reference to the dll  FuchsGUICodeGenerator ( Looooooooong name :D).
-Creating a new Windows.Forms.Form in the project.
-In the file Program.cs choose the form you created (more details later).
-Compile & run the project.
-A pre-made form will show and ask for generation options.
-You click a button and a complete class code is generated & copied to clipboard on demand :D.

We’ll recreate the calculator from Part III.

That ends the headlines :), let’s get to the details. Read more…


14/02/2011 6 comments


1-Introduction to the GUI.
2-Hello control :D.
3-Hello form.
4-Exporting forms easily from Microsoft Visual Studio Designer to FuchsGUI :D.
5-The future of FuchsGUI & some notes.


In part 2, I demonstrated how to create two types of FuchsGUI controls : Button & TextBox.

Well, most FuchsGUI controls have similar constructors, this lesson should be quite simple, what we will do is a simple calculator that adds\subtracts two numbers, the reason for this is to show you how to get values from TextBoxes & how to use Forms.

So create a new XNA 4.0 game , add a reference to FuchsGUI.dll (you might wanna go back and read step a in Part II)

Add the using directive first

using FuchsGUI;

Add these fields to Read more…

XNA FuchsGUI Part I

11/02/2011 21 comments


1-Introduction to the GUI.
2-Hello control :D.
3-Hello form.
4-Exporting forms easily from Microsoft Visual Studio Designer to FuchsGUI :D.
5-The future of FuchsGUI & some notes.


Disclaimer :

-Please before reading note that this gui is for PC only, with some changes it might become runnable at the XBOX360

-The tutorials are for the XNA4.0 version, it’s just a matter of default parameters ( which are not -AFAIK- permitted in .NET3 c# ) , if you’re still using XNA3.1 maybe it’s time to move on :).

-This post doesn’t contain the FuchsGUI dll, please wait for the next post, but I really recommend reading this post if you’re willing to use my gui :).


An important thing any game or simulation needs is a good, reliable & simple graphical user interface (GUI), of course you can use System.Windows.Forms to create a gui for your XNA game but to me I prefer a gui from within the game, XNA code only :D, with this you can place the gui controls anywhere in the game window (I don’t know if it’s possible with Windows forms).

-ALRIGHT get to the the point already!!!
The point is that I’ve recently programmed a simple yet powerful gui library for both XNA3.1 and XNA4.0, The project started with XNA3.1 then was completed in XNA4.0

Here’s a teaser screenshot where I used my gui for an artillery simulation I programmed with two of my colleagues 😀


Please note that blurry text issue is now fixed, check the last part of the tutorial to download the fixed version

might not be that eye-catching cuz I created the textures in a hurry & using only mspaint

The beginning of the project started with Read more…

Some unpublished projects…published

24/12/2010 1 comment

Well… I have a bunch of old projects that weren’t published for some reasons…It’s time for them to finally see the light 🙂
Just a few notes:
-These are old, so many things are less professional than I would write now, many things have nothing to do with OOP…

-You’ll need the SFML dlls to run any SFML game.

Labyrinth Maze:

SFML, OpenGL, C++ (VisualStudoi2008)

Labyrinth Maze

Click on image to view animated full size version

A path finding application that finds a path in a 3D maze from one corner to the other..
The maze is generated randomly, can be moved, rotated, zoomed in/out with keyboard…
The console window contains more information..

Actually this application was Read more…

XNA Picking Tutorial Part III

16/12/2010 7 comments

Welcome to the third picking tutorial! 😀
1- Ray picking.
2- RTS style selection box (two approaches).
3- Projection and why you need it.


This tutorial is really short..It’s not actually about picking but somehow related to it, I wanted to write this in the same post as Part II but Part II was already long enough.. 🙂

Another use for Viewport.Project:

In part II we used Viewport.Project to get the positions of 3D objects on the 2D screen, well.. that was useful for picking…Another excellent use of Viewport.Project is displaying 2D elements over 3D objects such as units names in a game or the health bar for example…

Generals Contruction Dozer

Read more…