### Archive

Archive for the ‘XNA’ Category

## Genetic Algorithms Lab

So a few years ago I did a project for the Genetic Algorithms assignment at college. My idea was to have tiny multi-cell organisms that have a simple goal: travel as far as possible! maybe to find new resources or escape from predators, you pick one ๐
So the fitness of a creature is measured by how far it can go during its life span.

The creatures will start with random moving cells and evolve to more organized creatures with organized movements.

Please watch the video before reading. If the video failed to make you interested then I doubt that the text would succeed. You can also download the executable and the source code available at the end of this post.

## Simple Spring Physics

A few weeks ago (during exams period ๐ ) I was playing with spring physics, it turned out to be easy to implement and the results were cool enough for me to write a demo in Android, Microsoft XNA, and Javascript :D.

Before I talk too much, here see the results for yourself, this is the web version :ย  SpringLab Web Version.

Reminds you of World of Goo ๐ ?

I came across this tutorial, from which I learned this lovely vector equation:

``` F = -k(|x|-d)(x/|x|) - bv
```

I applied it to 2D springs and it gave amazing results especially when Read more…

## Hex Screen

#### Intro:

Hello, it’s been more than three months since my last post, it’s also been more than three months since I last opened Visual Studio :(. A few days ago I decided that I should write something with XNA, that’s when I decided to write Hex Screen :D.

#### Hex Screen?

Hex screen is a 3D screen made up from hexagons, the cool thing about this screen is that hexagons can be animated to give nice effects, hexagons can be rotated, moved and scaled.

A screen made up of 42*20 Hexagons

Another screenshot ๐ :

## FuchsGUI Update

Hello there, sorry for being inactive lately but I don’t feel like programming or learning something new :(.

Anyway, I fixed the issue in FuchsGUI where some text was blurry, the reason was that the text was being rendered with floating point values for position, something like (20.3f,29.4), this meant that spriteBatch should split physical pixels :(.

Anyway, thanks to a guy named Fab who told me how to fix this, the solution was something like this:

```position.X = (int)Position.X;
position.Y = (int)Position.Y;
// Render here
```

So, here’s the fixed version (XNA4 only):

ย ย  FuchsGUI v1.1 Source Bin XNA4 (Blurry Text Fixed)

I hope to see you later :)…

## RobotWarz Alpha Release

#### Introduction (a boring one maybe ๐ ?)

Good morning\evening or whatever suites your timezone :).
I’ve been waiting for this :D!, I’ve finished programming the alpha release of the game.
The reason I’m publishing it right now is because It might take me some time to have a full game, so by publishing an alpha release I can get opinions & suggestions from people which will encourage me to complete the game.

This release isn’t meant for end-users but rather for fellow programmers.

Unfortunately my laptop doesn’t have a graphics card so Read more…

## RobotWarz Demos

Hello there :D, Sorry for the delay but I’m having some really serious internet problems :(.

Here are three videos of my XNA game RobotWarz uploaded on YouTube.

#### 1- RobotWarz Demo:

just me playing against AI robots, I destroy them, they destroy me, it’s full of action :D.

#### 2-RobotWarz Features:

this video demonstrates most of the techniques I used in the game such as Read more…

## Stay tuned :P

Three videos of my game RobotWarz are coming soon…
One week after that I will publish the game here on the blog ๐

Here are two screen shots ๐

AI opponent attacking the player

AI robots are fighting each other, player is in Spectator Mode.

## Busy busy busy busy :@

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

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.

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

#### Introduction:

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…