Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Oct 2006
Offline Last Active Feb 21 2012 03:50 AM

Topics I've Started

Network bottle neck?

08 February 2012 - 05:34 PM

Im writing my first ever client/server model, and im finding my implementation is too slow, but im not sure what the bottle neck is.

It consists of 1 client and 1 server,using BSD sockets. Both sockets are created using:

socket(AF_INET, SOCK_STREAM, 0);

The server socket is set to non blocking using:

u_long iMode=1;

My client repeatedly sends the mouse position every frame to the server using write. It does this when ever the mouse moves. Thats all it does, so its going pretty fast. It doesnt perform any reads.

My server is in a simple loop, where each frame it:

- performs a read on the connected client socket, decodes the message if there was one, then sets the position of an image to the x/y position from the message
- draws the image

data is read and written using send() and recv()

However im finding there is significant lag. I would have thought it could handle this?

Im not sure where my bottle neck is?

Breakout code design exercise

02 February 2012 - 01:19 AM

Hi all,

Id like to do an exercise to come up with a code design for the traditional game breakout game (google if unsure)
using an entity component system to see what designs you all come up
with, and to practice my designing skills =P.

I have my own ideas how to design it, but im more interested in the way other people think, and hopefully I might learn a thing or 2.

Im particularly interested in designs engineered towards a data-driven entity
system such as Artemis, where data and behaviour are split into components, and systems processing those components:


For simplicity, I want to focus on:

- Ball
- Paddle
- Blocks
- Powerups
- Bullet

- Ball travels with linear velocity, initially at a random upward angle.
- Ball bounces off left, top, and right boundaries
- Ball bounces of blocks
- Ball bounces off paddle

- Paddle can move left and right

- Blocks disappear when a ball touches them
- Blocks disappear when a bullet touches them

- Powerups have a chance of spawning when a block disappears
- Powerups travel down the screen until they hit the bottom boundary, at which point they are destroyed.
- A powerup is engaged when it collides with the paddle
- Powerups do not collide with blocks
- Powerup 1 - Ball sticks to paddle instead of rebounding
- Powerup 2 - Paddle is elongated in size
- Powerup 3 - Paddle can shoot bullets when fire is pressed for x seconds

- Bullets travel up the screen
- Bullets are destroyed when they collide with a block
- Bullets are destroyed when they hit the top boundary

- 3 lives
- loose life when ball touches bottom boundary
- game over at 0 lives
- game win when blocks == 0

So yeah, if you could list the components you would use to build those 5 objects, and what systems you would use to implement those behaviours, and how those systems would process your chosen components.

This is all about the details!
Hopefully someone is actually keen to give this a crack lol.

There are so many different ways this could be done. Im interested in your way

GPU Gems VS ShaderX

19 February 2011 - 06:27 PM


I am just starting out shader programming and I'm looking for a book that can advance my shader programming skills. The two main gpu programming book series seem to be GPU Gems and ShaderX.

What is the main difference between these series? What would you guys recommend I buy?

Vertex colour is always black when passed to shader

17 September 2010 - 03:32 PM


I am just beginning to learn about vertex and pixel shaders.

I have come across a problem where the colour for each vertex passed to the shader is always 0,0,0!

As far as i know, directx should set the vertex colour for each vertex, by taking the diffuse component of the material if i set:

d3ddev->SetRenderState(D3DRS_COLORVERTEX, TRUE);

My vertex shader is very simple:

// Vertex declaration (in the cpp)
const D3DVERTEXELEMENT9 vertex_declaration_elements[4] =

// Shader code
struct VS_INPUT
float4 Position : POSITION;
float4 Normal : NORMAL; //Note this is ignored right now
float4 Colour : COLOR;
struct VS_OUTPUT
float4 Position : POSITION;
float4 Colour : COLOR;

Out.Position = mul(In.Position, WorldViewProj); //apply vertex transformation
Out.Colour = In.Colour;

Heres how i render my mesh:

for ( unsigned int i = 0; i < num_materials; i++ )
mesh->DrawSubset( i );

I have inspected mesh_materials[i] to make sure its getting exported properly, and it looks 100% correct.

I have also tried changing :
Out.Colour = In.Colour
Out.Colour = In.Normal

To make sure my normals are getting through fine and things aren't getting mixed up.

So, what could be causing my vertex colour to always be (0,0,0)?

Any help you can give me would be awesome! Thanks!

GLUT - Scene jitters when rotating camera

18 September 2009 - 07:42 PM

Hi, I have implemented free fly style camera using glut. However, when I rotate the camera, the object in the scene seems to jitter like the object is moving in steps. Translating the camera works smoothly. I have been stuck on this for agess and have searched all through the forums and on the web and not found anything. Is this a limitation of glut? or am I doing something stupid. I have a pointer lightsource lighting the scene. Any help/ideas would be much appreciated! heres some code:
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow( application-&gt;GetName() );

void Idle(void)
	application-&gt;Update( 0.1f );

void Display(void)

        glRotatef( cam.pitch, 1, 0, 0 );
	glRotatef( cam.yaw, 0, 1, 0 );
	glTranslatef( -camx, -camy, -camz );

        // Draw box()


void OnMouseMotion( int x, int y )
	int dx = x - GetWidth()/2 ;
	int dy = y - GetHeight()/2 ;

	if( dx != 0 || dy != 0 )
		camera.Rotate( dx * 0.2, dy * 0.2 );
		glutWarpPointer( GetWidth()/2, GetHeight()/2 );