Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


DjMaSh

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;
ioctlsocket(Socket,FIONBIO,&iMode);

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:

http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog-development-part-2/


For simplicity, I want to focus on:

Objects:
- Ball
- Paddle
- Blocks
- Powerups
- Bullet

Behaviours:
- 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

Hey,

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

Hey

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);
d3ddev->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);

My vertex shader is very simple:


// Vertex declaration (in the cpp)
const D3DVERTEXELEMENT9 vertex_declaration_elements[4] =
{
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION,0},
{0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,0},
{0, 24, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,0},
D3DDECL_END()
};

// 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;
};

//MAIN
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++ )
{
d3ddev->SetMaterial(&mesh_materials[i]);
d3ddev->SetTexture(0,mesh_textures[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
to
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() );
    glutReshapeFunc(Resize);
    glutDisplayFunc(Display);
    glutIdleFunc(Idle);
    glutKeyboardFunc(KeyDown);
    glutKeyboardUpFunc(KeyUp);	
    glutMouseFunc(MouseClick);
    glutPassiveMotionFunc(MouseMotion);

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

void Display(void)
{ 
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glLoadIdentity();

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

        // Draw box()

        glutSwapBuffers();
}


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 );
	}
	glutPostRedisplay();
}


;

PARTNERS