Google Talk Chat-back

Uncategorized No Comments

I’ve added the Google Talk chatback to my website, and it’s pretty cool that even non-Google users can use it to chat with me right on my website. Just click on my name to check it out.

New Look

Uncategorized No Comments

I’ve been meaning to do this for a while now, and I’m pretty happy with the way it turned out. So much of this theme is now my own work that I was considering removing the design credits at the bottom of the page, but there are still a few things that aren’t mine, so for now they will stay. Anyway, the header was made with the Gimp, Paint.net, and Microsoft Paint; and the code was of course done with PHP and CSS.

Inheriting From a Sprite Class with XNA

Software, XNA 3 Comments

Say you have a Sprite class with properties and behaviors that you know many of your game objects (such as monsters, buildings, your hero, etc.) will be using. You could make objects of the Sprite class from another class like this:    Sprite monster = new Sprite(); and you could adjust the properties, like “position” or “source rectangle”, by using accessor methods in your Sprite class like this:

public Vector2 Position
{
get { return position; }
set { position = value; }
}
 

This is a pretty common practice. However, here is another way to do the same type of thing using inheritance. I’ll first show you a complete (but very simple) Sprite class: Read the rest…

AJAXGOLD: Building a Custom Search Engine

AJAX, Search Engine, Software No Comments

A friend of mine introduced me to AJAX awhile ago and showed me this Search Engine application he had built using it. I loved the idea of building a custom search engine that I could host on my site and I’ve been studying up on my javascript and Ajax for a while now so that I can play around with it. As it is right now, it will scrape a webpage for any links within it, listing the results in the same page without ever having to refresh. Pretty awesome!

In the future, I plan to upgrade the engine so that you’ll be able to enter keywords and select how many levels of searching will be performed. For instance, you’d be able to enter “andersongaming.com”, along with a keyword like ”games” and click the “send request” button to see which pages contain the keyword “games”. It would check each webpage linked to from “andersongaming.com”, check for the keyword, and return the link if the keyword was found. Additionally, if the keyword was found say…5 or more times on a page, then the engine could be programmed to crawl the outgoing links from that page as well. The possibilities with Ajax and Javascript are endless, so let me know if you have any suggestions.  

 Why would you use this over Google? Well, this definately would never replace Google, but for a certain types of searches it would be perfect. For instance, if you were searching for a review on computer hardware components, you could start your search somewhere you trusted, like “tomshardware.com”, and know that your results have stemmed from a reliable source. 

When I’m finished with this (or at least have more functionality built in), I will publish a tutorial on how everything works.

Check out The Engine now right here!!! 

2D Sprite Animation Using XNA

Software, XNA 3 Comments

Spritesheet animation is one of the most common ways to produce realistic animation in 2D games. Multiple frames of an animation sequence are stored on a single image as shown below and these frames are sequentially displayed on the screen over a period of time to produce an animated graphic .

spritesheet

To use this effect in XNA we first need a Texture variable to store the complete 256 x 256 image.

//declare the variable with the rest of your class declarations
//The 2D textured to be rendered
Texture2D texture;
SpriteBatch spriteBatch;

//**load the image in the LoadGraphicsContent method**
 //Initialze the sprite batch object. This will be used to draw the animation
spriteBatch = new SpriteBatch(this.graphics.GraphicsDevice);

//The object to draw the animation
ContentManager aLoader = new ContentManager(Services);
texture = aLoader.Load<Texture2D>(“spritesheet”) as Texture2D;

Next we’ll need some variables to control how fast the images change. 

//for animation timing
float frameLength = 1f / 15f;
float timer = 0f;

When we Draw the animation, we’ll be using this method:

spriteBatch.Draw(Texture2D, Rectangle destination, Rectangle source, Color)
//destination rectangle is where the animation will show up on screen
//source rectangle is which part of the “spritesheet” texture will get displayed

Each “frame” of our animation is 64px wide and 64px tall. So we need 2 more variables to keep track of which frame we currently want to display.

//The texture start position for the rectangle will be frame 1
int currentFrameX = 0;
int currentFrameY = 0;

So now our Draw method will look like this:

spriteBatch.Draw(texture, new Rectangle( 0, 0, 64, 64), new Rectangle(currentFrameX, currentFrameY, 64, 64), Color.White);
Read the rest…

ALU Design on an FPGA Board

FPGA, Hardware No Comments

Field Programmable Gate Array

Field Programmable Gate Arrays (FPGA) are small hardware chips that can be programmed similarly to how software is programmed. They are useful when designing prototypes for microprocessors and microcontrollers since you don’t have to throw away the board after every revision of your design. The testing stage can be repeated as often as necessary without costing a fortune.

In this design, a 4-bit Arithmetic Logic Unit was programmed to do the following tasks:

  •  ADD
  • SUBTRACT
  • AND
  • OR
  • SET ON LESS THAN (SLT)
  • SET ON EQUAL (SEQ)  

The project was programmed using the free Xilinx software from their website. Just a warning, the download is quite large and the program is very buggy with Vista (Works great on XP though). Here are the pictures of the complete design:

4-Bit ALU Picture Here
ALU Picture Here
Counter Picture Here
T Flip Flop Picture Here
Zero Generator Picture Here
One Generator Picture Here

Basically, on the FPGA board we have 8 switches (4 for each of the two numbers), 4 seven segment displays, 3 LED’s, and 3 pushbuttons. The default function of the board is ADDITION, with SUBTRACTION being activated by pressing button 1, AND’ing activated by button 2, and OR’ing activated by button 3. Since the ALU is binary, the seven-segment displays will output 1’s and 0’s as the binary solution to the the computation, and the 3 LED’s will light up for overflow (since we only have four bits), SEQ (if the 2 four-bit numbers are the same), and SLT (if the first four-bit number is less than the second).

The tricky part of this circuit is that each of the seven-segment displays needs to be able to show different values at any given time, yet the cathodes on all four segments are tied together in one node. To solve this problem, the FPGA clock was used (set at 25MHz) to sequentially drive each of the four anodes in turn. Of course, a 40 nanosecond refresh rate would not be on long enough to light the led’s, so a counter circuit made up of T Flip-Flops was used to divide the signal.

This is not a very exhaustive explanation of how the design works, but if you have questions, let me know.

Computer Performance…More Than Just Clock Speed.

Hardware No Comments

If I were to ask you which processor had better performance: a 2.4GHz Intel Celeron processor or a 1.8 GHz Core 2 Duo, most of you have heard enough about the popular dual-core wonders from Intel to know that this was a trick question. Furthermore, many of you would even know the reasons behind why the dual core architecture is a better performer and be able to explain that the Core 2 Duo is able to work on multiple tasks at a time. However, if that is the limit of your microprocessor knowledge, than this article is for you. There are four main hardware concepts to take into account when assessing the performance of a Computer Processing Unit (CPU). They are:

  • Cache Memory
  • Clock Speed 
  • Pipelining
  • Parallelism

Before getting into these topics however, it is important to understand the basics of how a CPU works. Most computers  have 32-bit processors, and “32-bit” is probably a term you”ve heard thrown around alot. This basically means that the computer only understands instructions which are 32 bits long. In a typical instruction, the first six bits tell the CPU what type of task to perform and how to handle the remaining 26 bits of the instruction. For example, if the instruction was to perform addition on two numbers and store the result in a memory location, the instruction might look like this:


Read the rest…