Friday 30 November 2007

Gunturrets work

Just finished implementing the gun turrets, we now have enemies in the map. Although work is a big word the render thats all for today.
Ow and I fixed a nasty memory leak in my particle system today without having to redesign it all.

On the laptop front of things they haven't come by my place today sadly enough hope they will deliver it tomorrow. Other wise i got more waiting on it to do and i don't want to wait.

Wednesday 28 November 2007

Particle Systems Continued

I changed the particle system slightly it now more resembles the nebula devices one. Although mine still does the interpolation on particle level instead of on emitter level. If we do it on particle level it looks a lot nicer than on emitter level. Here is a screen dump of a fire effect:

If the particle size isn't set you get a nice effect as well, this happens because particles are then spawned with a infinite size. Here is an example of that:

Side note on the laptop I got a mail today that they got it and are sending it to me today. Yay I am really happy to get this one no more dinners at 23:00. I can eat at normal times again and still do some work.

Tuesday 27 November 2007

Laptop Confirmation

Today I got the confirmation for my laptop, it will arrive at Laptops4u tomorrow or Thursday and then they will ship it to me. Next week I'll have my new laptop, finally i can work at home on my ACW. Too bad it's due in two and a half weeks, still might enable me to get shaders to work in the 2 weeks remaining. As of now I have texturing and point lights working through vertex and pixel shaders. Spot lights are hard to implement in shaders. The problem with shaders is they are not debug-able which makes it kinda hard to write them. Although the result is a lot nicer than the fixed function pipeline behavior. Planes can now consist of 4 vertices's and still light will look good on em instead of the hundreds of points I am using now.
Here is another particle system effect:

Monday 26 November 2007

Long overdue post

Ok this post is long overdue and it's about all the crazy stuff thats going on on Fridays over here.
This story starts on halloween when we got invited for a party that on the last minute didn't happen. Lucky for us there was another party going on somewhere else. When we walked in to this party, of course we weren't invited but who cares, there were only girls there so we felt well this is gonna be a good night. After we were in for 5 minutes this girls comes up to use and starts yelling at us we we weren't dressed up, and what we were doing there. This lasted for a bout 10 minutes and afterwards we actually had a good laugh with her. This night ended a bit weird though.

The next party was that friday at asylum the night lub an campus it was an ISA party, you know the society that signed me up by having a party, good way to get members though. This was a weird night as well as i couldn't get drunk that night and I was drinking double vodka shots. In retrospect though i might have switch to hard liquor to early that night.
To continue the next week we crashed a party again, he sounds like we are getting good a this thing here. This party turned out to be a birthday party, we a group of about 20 people just walked in and started drinking. Here one of my friends try to climb a wall, more accurately what happened was he walked into the wall. He ran up to it and jumped but couldn't get high enough so he sacked into the wall.
This is also the night the legend of the giraffe was born. See picture blow the guy eating the leaves.

Then finally we come to two weeks ago this was a crazy night as well, also the most expensive one I have been on here. 7 quid 50 for 2 shots of brain hemorrhage. This was just basicly a pub crawl that ended up at some friends house were I saw the greats pile of dishes ever.

As you can tell i don't really remember everything that happens on Friday nights here but thats just because we start to early.

Sunday 25 November 2007

Particle Systems


Today i got the particle system for the end sequence of the game done. Although done is a big word as it still massively memory leaks, but we brush that aside for the moment. The particle system also serves another purpose in the game, as lasers hit a wall there will also be a particle explosion. The only things left to do for the ACW now are:
  • Recording and play back functions
  • gun turrets
  • Alternate 3d person view
  • and HUD
Need to pitch a game idea tomorrow, and it has to do with the environment. During Christmas I need to make an A1 poster for this idea. The idea is to have an adventure game to build a bio diesel gas producer and a car to run it on. Then the end of the game is to race it as environment friendly as possible. It's not a grand and great idea but it will have to do.

Friday 23 November 2007

Multi texturing

Finally I got multi texturing working!!!!!!!!!!!!!!!!
The problem was that I was calling the wrong function to set up the texture stage, instead of calling glActiveTexture is was calling glClientActiveTexture. The last one you use when you tell GL where to find the texture coordinates. Well enough tech talk here is how it looks.

Wednesday 21 November 2007

Lasers and Scorchmarks

In the last two days I revised the switches they now look a lot sharper, added lasers and their scorch marks. While doing the scorch marks I also figured out why multi texturing wasn't working, OpenGL demands two vectors or arrays of texture coordinates. So we can't reuse the texture coordinates from one stage to use in the next stage, which is a pain. Or if some one knows how to please let me know because that would make things look so much nicer. As for now the only place I use multi texturing is in the scorch marks, they have a color and an alpha map. There is still something wrong with them as the are effected by the material of a laser, although before I start drawing them I reset the material.

On a side note I ordered a shiny new laptop last week a ASUS g1s. It still hasn't arrived but it should do in the end of this week or beginning of next. This machine is the most money I have ever spend on a PC or Laptop. It's gonna be sweet to have it though means I can go home earlier in the day and work at home instead of being in the labs all the time.

Monday 19 November 2007

On the ACW

I didn't really do that much last week I implemented the lasers and switches although they do not really work with collision detection yet. I also saw today that I have to redo the geometry for the switch because they look like shit. Here is a screenshot of it.

Just saw I need to increase the size of the lasers because they are really small.

First Shader

We had a lab on shaders this morning, although only vertex shaders. They are nice to work with if you use version 2 or higher, the assembler ones are horrible. They do give nice effects but to program in assembler is just not nice especially if you compare them with GLSL or HLSL. It's like comparing asm to C++, I like the higher ones more. Here is an example of a vertex shader and it's output.
//c0 = matrix
//c4 = colour
//c5 = lightpos
//c6 = another color
//c7 = lightpos
//c9 = scalar constants

vs.1.1 // version instruction

dcl_position v0 // declare register data
dcl_normal v4 // v0 is position, v4 is normal
dcl_texcoord0 v8 // v8 is texture coordinates

mov oD0, c4
//mov oPos, v0


m3x3 r0, v4, c0 //transform normal

mul r6, v4, c7.x
add r6, v0, r6
m4x4 oPos, r6, c0

//m3x3 r1, c5, c0 //transform light pos
dp3 r1, r0, -c5 //dot product
mul r2, r1, c4 //multiply dot product with lightcolor

dp3 r3, r0, -c7
mul r4, r3, c4
mul r5, r2, r4
mov oD1, r5 //move to output

m4x4 r7, v0, c0
mul r7, r7, c9
mov oT0, r7

As you can see they are not nice to look at although the outcome does look nice. This shader transforms and lights and does a texture map for the skull mesh.

Monday 12 November 2007

Again bursary

Just found out that I have to go to Bradford on Thursday to comply with this bursary thing. Next week I will finally get my money :), that means the next day or so I'll probably buy my macbook pro. Finally got a pc that works here lol.

Friday 9 November 2007

First Version

Here is the first installer. Remember I am not sure what the hardware requirements are at the moment. You need to have a joypad connected to fly through the application. The main.exe is located in the install dir and then the bin folder. There is only one .exe and you should double click on it to get it to work. Please download both files. If you have a rapidshare account you can download it, at the moment i can't find anyplace on the web I can place it so people can download it. If you now of a place place tell me in a comment.

http://rapidshare.com/files/68564643/InstallSpaceSim.msi.html

http://rapidshare.com/files/68564644/setup.exe.html

YES it has collision detection

The axis aligned Bounding Boxes now do correct collision detection. The problem I had was that i was calling the wrong function, instead of calling intersectMovingBboxes, which checks if a moving boxes collides with a stationary, I was calling intersectBboxes. The later just checks if two boxes collide and if you do that for every box in a map it collides. This happens because the camera is a moving entity and it moves beyond a max value in a BBox and the function just checks for that. The new function takes into account in which direction you are moving. Just need to fix the camera to return it's up vector and collision detection works as expected. If I get it working I will put a installer up for you to test. Remember it's still a work in progress. Tests have only been done on game labs pc's so i don't know if it will work on others. The specs of these are: AMD X2 5600+ dual core, 2GB Ram, NVIDIA 8600GT. But 32MB of Ram should be enough to run the program, don't know about the Video Memory though so to be save go for a machine with at least 64MB

A piece of Code

As asked for in a comment by Walter here is a piece of code, it's the draw code for the forcefield which is sown in the previous post. The forcefields is a class that has a draw method and this is the code for it.
[code]
void ForceField::draw(float elapsedtime)
{
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
if (m_texturespeed < 1.0f)
{
m_texturespeed += 0.01f;
}
else
{
m_texturespeed = 0.0f;
}
Matrix44 m;
translate(m, m_texturespeed, 0.0f, 0.0f);
glLoadMatrixf(m.transposed().m());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
TextureManager& tm = TextureManager::getInstance();
tm.activateTexture("..\\Textures\\ForceField.bmp");
//glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glDisable(GL_CULL_FACE);

glMatrixMode(GL_MODELVIEW);

glPushMatrix();
glTranslatef(m_position.x(), m_position.y(), m_position.z());
//translated.writeM();
m_forcefield.draw(elapsedtime);
glPopMatrix();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
}
[\code]

Forcefields, sliding doors and rotating blades

Two days ago I implemented moving objects in the map. I needed them to react with a material especially the forcefields as they need to seem to glow. The problems I had were that my vector that stores them wouldn't accept a change in the data if I gave it. Today I made the forcefields have a moving texture it looks like this.On a side note I also fixed the placement of the bounding boxes. As I fixed my matrix class to work with OpenGL I can now make my own transform matrices and use them. This enabled me to pre-transform my plane vertices and then calculate the bounding box on them. So I don't have to transform the existing Bounding Boxes and as this is done at load time it saves me a multiply in the render state.

Friday 2 November 2007

Spot lights make it look sweet

Finally I got the spotlight to work as it worked out there was another error in my light class :(. Hate these sneaky bugs hitting me. I finally got the outside of the space station done, we can now fly in to the space station from the outside. Here's the latest screen shot:
I changed the textures because they didn't look as good as they do now. The light you see is from a spotlight in front of the spaceship.

Thursday 1 November 2007

Let there be light

He said and there was. I made a mistake in my light class that made my light behave in an unexpected manner. Besides the normals of my Right, Floor and Back faces were inverted, by fixing it all it now looks like this:
I now also output the amount of vertices's that the whole scene contains, and back face culling is working. To get that to work I needed to change the way a front face is detected in GL. I had to change it because my faces are created by one function and then just rotated and translated into place.