Jump to content

  • Log In with Google      Sign In   
  • Create Account


yenal

Member Since 16 May 2007
Offline Last Active Jan 30 2013 11:56 PM
-----

Posts I've Made

In Topic: Help in regards to the design patterns commonly used for putting a game toget...

05 October 2008 - 03:33 AM

One more question... How do you decouple the rendering from the game logic? e.g. You have Entity instances you use in Ogre for rendering. Would your game object have some renderable object as a member? Is a regular game loop something like this?

while(gameIsRunning)
{
ProcessInput();
ExecuteGameLogic(); // here the input is applied to game objects and their properties like direction, speed is updated
UpdateScene(); // here the renderable objects are updated with correct positions and such
RenderScene(); // render the whole scene
}

In Topic: Help in regards to the design patterns commonly used for putting a game toget...

05 October 2008 - 03:27 AM

I totally agree with you. I have used SDL in my master's project and it was so simplified. I have heard about Lua scripting. How is the game logic implemented via the Lua scripting? Can you give me a simple example (pseude code)?

In Topic: Help in regards to the design patterns commonly used for putting a game toget...

04 October 2008 - 07:31 PM

Even though Tetris is simple, I would like to create some base library that I can use in my games. Actually I have used SDL before and it was not object oriented at all if I remember correctly.

In Topic: Pathfinding problem. Need help

17 November 2007 - 01:04 PM

I will check all of them. I may ask more questions after reading the articles though. Thank you so much.

In Topic: Pathfinding problem. Need help

17 November 2007 - 09:36 AM

The issue is I cannot represent this problem with nodes (Or maybe I did not understand this concept well enough). Here is how the car's position change at any time T.
if going straight:
mPosition += ( mDirection * float( elapsedTime ) * mCurrentSpeed );
if turning left or right:

// Calculate the angular velocity
float angularVelocity = CalculateAngularVelocity( mCurrentSpeed, elapsedTime, turningAngle );

// Get the 360 modulus of the angle
if ( angularVelocity >360.0f )
angularVelocity -= 360.0f * ( int( angularVelocity ) / 360 );

// Update the car's direction
mDirection = mDirection.rotateAboutGlobalZ( DEG2RAD( angularVelocity ) );

// Calculate the rotation angle based on the direction vector
mRotationAngle = RAD2DEG(atan2f( -mDirection.y, mDirection.x ));

if ( mRotationAngle < 0.0f )
{
mRotationAngle *= -1.0f;
mRotationAngle += 90.0f;
}
else
mRotationAngle = 90.0f - mRotationAngle;


// Calculate the new position
mPosition = GetNewPositionAfterRotation( mRotationCenter, mPosition, angularVelocity );


Basically calculate the angular velocity based on the time elapsed between the frames. Update the direction vector. Calculate the new position.

By the way you exactly understood the problem.

PARTNERS