Sunday 25 October 2009

Biosphere - Personal project


This entry might not be very relevant to any of our university work, however, I though it would be a good idea to show what I was up to during my spare time, and maybe get some feedback.

As the title states it, this post is about my ongoing personal project (one of the many unachieved-projects I have been working on for the past few years), which I have called "Biosphere". Initially, the idea came from the 1st year Game Design module, when we had to design a cooperative game, and start brainstorming for a couple of ideas. Although this particular one did not get through, I kept it aside in my mind for the following weeks, until the holidays came.

From there, and with plenty of free time on my hands (although not so much when I started working on the side), I decided to start working on it, with the idea of making it both a good exercise (improving my programming/design skills, writing various documents, etc), as well as having something not necessarily related to uni, which I could put in my port folio, and demonstrate my motivation in working in the games industry.

Biosphere is a 2D space colonization game, made in C++, which I am designing with an emphasis on architecture, modularity (having modular renderers, input systems, etc...) and reusability (the game is just a demonstration product for my engine).

Considering the small amount of uni work we are getting right now ( although some people might feel different about it), I am able to move on with my project pretty quickly, and I am quite happy with the result I am having for the moment. I do not know how it will go from there, priority being for uni work, but I will try and keep working on it as much as possible.

Anyway, for those of you who are still interested, here is the link to a blog I have set up especially for this project a couple of months ago. The blog depicts the game, contains hand-made artwork, and also has development diaries describing my progress, and the features to come. Feel free to leave comments, questions, and/or critics, that is what it is there for!!

Tuesday 13 October 2009

Console Dev - Week 2 - Machine Cycle

The original Xbox's ISA

Because the Xbox uses an Intel Pentium III processor, its ISA is not very different from what is generally found in computers. The CPU uses the x86 instruction set, which is described in detail in the following link :

x86 instruction listing (Wiki)

The corresponding disassembly code can be obtained using the free software IDA Pro Freeware v4.3 or Ollydbg. However, not having managed to read an original Xbox cd successfully with a computer dvd-rom (Xbox cds are read from the outside->in, whereas normal dvd-rom read from the inside->out), here is a sample code of a strlen function written in x86 assembly code, found on the internet, with added comments to explain what I believe is going on, based on the code, the registers and the instruction set:


section .text
global my_strlen
my_strlen:
push ebp
//pushes the data onto the ebp register ( stack base pointer for current frame )

mov ebp, esp //moves the data from esp (stack base pointer for top frame) into ebp
push ebx //pushes the data onto the base register
push ecx //pushes the data onto the counter register

mov ebx, [ebp+8] //moves the data in the ebp register at location 8 (8 bits?) onto the base register
mov ecx, 0 //sets the counter to zero

.L1:
mov eax, [ebx]
//put the adress of the base register into the accumulator
cmp byte [ebx], 0 //compares the single byte in ebx with zero (checks whether the character is empty or not?)
jz .L2 //"jump on zero", meaning if the comparison is false, go to L2...

inc ebx //otherwise, increment the base register by 1 (go to next character ?)
inc ecx //increment the counter by 1 (one more character in the string)
jmp .L1 //go back to L1 and repeat
.L2:
dec ecx
//decrements the counter by one (correction)
mov eax, ecx //put the result into the accumulator

pop ecx //pop data from the counter (reset it ?)

leave
ret

The code above is not perfect, but it allows us to see how the x86 instructions work, and how the various registers are used. The same principle is also applied, in a much larger scale that is, with the Xbox, with the added compiled C/C++ files on top of the low level assembly code, which then makes it able to run games...

Other sources :

http://www.geocities.com/thestarman3/asm/ - Additional resources for x86 code

http://www.linuxforums.org/forum/linux-programming-scripting/76566-x86-assembly-strlen-implementation.html - Original strlen x86 code

http://en.wikipedia.org/wiki/X86 - more information on x86 concerning registers, etc.