Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


bglanzer

Member Since 04 Apr 2012
Offline Last Active Aug 18 2014 09:15 PM

Topics I've Started

New Tanuk Gameplay featured

27 December 2013 - 06:13 PM

Checkout the latest gameplay video and let me know what you think.

 


Tanuk

07 December 2013 - 05:59 PM

TANUK

 

 

Tanuk is a game in development for mobile platforms in which you control a tanuki (Japanese racoon dog) by firing barrel to barrel while avoiding various obstacles. The game will feature 3 different environments with 10 levels each. Feature physics controlled objects to either avoid or aid in your journey through the level.

 

 

Scheduled release is Spring 2014!

 


Planning - What do you use?

23 June 2012 - 12:50 PM

I'm interested to see what other's use when planning a big project such as a game or game engine.

I've used StarUML and find it somewhat cumbersome. Going through each class writing variable and method names all of which I will actually be doing when writing code. Often times I will decide to make changes while writing my code and have to go back into it to make changes to the diagram.

I've heard some people recommend XMind which I have used as well but I find that as more of just a way to map ideas for a game and doesn't seem to help when planning the actual code structure and design of your game.

My tried and true method though somewhat unorganized is a notebook. I usually buy a new notepad when I start a new project and just start drawing my classes with arrows write some method/variable names. I have arrows pointing everywhere and notes on the edges of my paper.

Does anyone use any methods that are more organized than a notebook yet less cumbersome than an actual UML diagram?

Does this camera look correct? (SOLVED)

13 May 2012 - 06:55 AM

I've been putting this bug off for a while now but it is finally starting to get to me. For some reason my camera always targets the -z axis even if I call my SetViewLookAt method to set it to point down the +z axis. The rendering is all done in DX11 with an idendity world matrix. The model I test it with is placed at Vector zero and is not offset in anyway.

Below is my camera.cpp which I'm thinking where the bug is . Does anyone notice anything wrong with it?

/*
====================================================================
camera.cpp
Brendon S. Glanzer
01/03/2012
====================================================================
*/
#include"dirtyLib.h"
const TypeInfo Camera::TYPE( "Camera", &Object::TYPE );
const TypeInfo& Camera::GetType( void ) const { return TYPE; }
/*
===============================================================================
  Camera::Camera() - Constructor
===============================================================================
*/
Camera::Camera( void ) : m_eye(), m_xAxis( Vector3d::RIGHT() ), m_yAxis( Vector3d::UP() ), m_zAxis( 0.0f, 0.0f, 1.0f ) ,
  m_target( 0.0f, 0.0f, 0.0f ){
m_orientation = Quat::Identity();
m_viewMatrix = Matrix4::Identity();
m_projMatrix = Matrix4::Identity();
}
/*
===============================================================================
  Camera::Camera() - Copy Constructor
===============================================================================
*/
Camera::Camera( const Camera& other )
: m_eye( other.m_eye ), m_xAxis( other.m_xAxis ), m_yAxis( other.m_yAxis ), m_zAxis( other.m_zAxis ), m_target( other.m_target ),
m_viewMatrix( other.m_viewMatrix ), m_projMatrix( other.m_projMatrix ), m_orientation() {
}
/*
===============================================================================
  Camera::~Camera()
===============================================================================
*/
Camera::~Camera() {
}
/*
===============================================================================
  Camera::SetViewLookAt() - Create view matrix
===============================================================================
*/
void Camera::SetViewLookAt( const Vector3d& position, const Vector3d& target, const Vector3d& up ) {
m_eye = position;
m_target = target;
m_zAxis =  target - m_eye;
m_zAxis.Normalize();
m_xAxis = up.Cross( m_zAxis );
m_xAxis.Normalize();
m_yAxis = m_zAxis.Cross( m_xAxis );
m_viewMatrix[0][0] = m_xAxis.x;
m_viewMatrix[1][0] = m_xAxis.y;
m_viewMatrix[2][0] = m_xAxis.z;
m_viewMatrix[3][0] = -m_xAxis.Dot( m_eye );

m_viewMatrix[0][1] = m_yAxis.x;
m_viewMatrix[1][1] = m_yAxis.y;
m_viewMatrix[2][1] = m_yAxis.z;
m_viewMatrix[3][1] = -m_yAxis.Dot( m_eye );

m_viewMatrix[0][2] = m_zAxis.x;
m_viewMatrix[1][2] = m_zAxis.y;
m_viewMatrix[2][2] = m_zAxis.z;
m_viewMatrix[3][2] = -m_zAxis.Dot( m_eye );
m_viewMatrix[0][3] = 0;
m_viewMatrix[1][3] = 0;
m_viewMatrix[2][3] = 0;
m_viewMatrix[3][3] = 1.0f;
}
/*
===============================================================================
  Camera::SetPerspectiveProjection() - Set Projection matrix
===============================================================================
*/
void Camera::SetPerspectiveProjection( const float fov, const float aspect, const float zNear, const float zFar ) {
MatrixPerspectiveFovLH( m_projMatrix, fov, aspect, zNear, zFar );
}
/*
===============================================================================
  Camera::Move() - Move camera position
===============================================================================
*/
void Camera::Move( float x, float y, float z ) {
Vector3d forward;
forward = m_xAxis.Cross( m_yAxis );
m_eye += m_xAxis * x;
m_eye += m_yAxis * y;
m_eye += forward * z;
m_bUpdate = true;
}
/*
===============================================================================
  Camera::Rotate() - Rotate Camera
===============================================================================
*/
void Camera::Rotate( float heading, float pitch, float roll ) {
Quat rotation;
//Add heading rotation
if( heading != 0.0f ) {
  rotation.FromAxis( Vector3d( 0.0f, 1.0f, 0.0f ), heading );
  m_orientation = m_orientation * rotation;
  m_bUpdate = true;
}
//Add pitch rotation
if( pitch != 0.0f ) {
  rotation.FromAxis( Vector3d( 1.0f, 0.0f, 0.0f ), pitch );
  m_orientation =  m_orientation * rotation;
  m_bUpdate = true;
}
//Add roll rotation
if( roll != 0.0f ) {
  rotation.FromAxis( Vector3d( 0.0f, 0.0f, 1.0f ), roll );
  m_orientation = rotation * m_orientation;
  m_bUpdate = true;
}
}
/*
===============================================================================
  Camera::Update() - Update view matrix when needed
===============================================================================
*/
void Camera::Update() {
if( m_bUpdate ) {
  //Create view matrix from orientation
  m_orientation.Normalize();
  m_viewMatrix = m_orientation.ToMatrix4();
  m_xAxis = Vector3d( m_viewMatrix[0][0], m_viewMatrix[1][0], m_viewMatrix[2][0] );
  m_yAxis = Vector3d( m_viewMatrix[0][1], m_viewMatrix[1][1], m_viewMatrix[2][1] );
  m_zAxis = Vector3d( m_viewMatrix[0][2], m_viewMatrix[1][2], m_viewMatrix[2][2] );
  m_viewMatrix[3][0] = -m_xAxis.Dot( m_eye );
  m_viewMatrix[3][1] = -m_yAxis.Dot( m_eye );
  m_viewMatrix[3][2] = -m_zAxis.Dot( m_eye );
  m_bUpdate = false;
}
}

My dot and cross products work like such

/*
===============================================================================
Vector3d::Dot() - Returns dot product to other vector
===============================================================================
*/
inline float Vector3d::Dot( const Vector3d &a ) const {
return ( x * a.x + y * a.y + z * a.z );
}
/*
===============================================================================
Vector3d::Cross() const - Calculates cross product from passed vector3d
===============================================================================
*/
inline Vector3d Vector3d::Cross( const Vector3d &a ) const {
return Vector3d( y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x );
}
I'd be grateful of any help

PARTNERS