Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Apr 2012
Offline Last Active Jun 09 2015 07:38 AM

#4952915 why value is different?

Posted by on 26 June 2012 - 12:06 AM

I think your not stepping the debugger through that line. Make sure your break point is set on the next instruction after float vc =dd[0].x; The debugger can reflect random values in variables that are not initialized.

You can verify with

float vc = 0.0f;
vc = dd[0].x;;

vc should be zero instead of a different number if you place the breakpoint at vc = dd[0].x;

#4952911 Is it wise to check all objects in a given state for collision every cycle?

Posted by on 25 June 2012 - 11:58 PM

Infectedbrain to break down what ApochPiQ stated simply create a class called node that contains a pointer to a node, contains a defined space either 2d or 3d, and contains a container of collidable game objects. Set a max number of game objects allowed per node. Define a node in which its defined space covers the entire scene then begin checking the number of Objects within it. If the number exceeds the max then evenly split the space with two new nodes each with thier parent set as the original node it spawned from. Then repeat that process untill the number of collidable objects is less than the max allowed with the node and add those game objects to that nodes game object list.

Then test which node your bullet is in and only check the collidable objects within that node.

That is the basis of a quad tree. For an Oct tree split the nodes by 4 instead of 2. Here is a link utilizing quad trees for terrain rendering. Its pretty much the same concept just replace vertices with enemies. http://www.rastertek.com/tertut05.html The code is in c++ but you shouldn't have difficulties making the change to c#.

#4952065 Planning - What do you use?

Posted by on 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?

#4950421 Structure of classes in good Game Engine?

Posted by on 18 June 2012 - 05:22 PM

I often times see Sington's used within references. For loggers particularly. I think its used that way in the Hieroglyph Engine from the book Practical Rendering & Computation. They have thier place but like ApochPiQ said they really shouldn't be used. They have the same issues as global variables so you have to take the same precautions.

The other way I've seen loggers done is passing a pointer to your logger on creation just like you are currently doing. I think that Method is used in 3d Game Engine Architecture. This is probably the method I would recommend.

#4950394 Structure of classes in good Game Engine?

Posted by on 18 June 2012 - 03:43 PM

You can do something like this

class Log {
static Log* Get() {
	 if( !m_pInstance )
		  m_pInstance = this;
	  return m_pInstance;
	 Log* m_pInstance;

Then use the log like this within your classes
Log* pLog = Log::Get();
pLog->Write( "Me and the Cap't make it happen!" );

#4933632 Question about tile map collision

Posted by on 21 April 2012 - 05:02 PM

If your character moves one tile at a time then just check the tile ahead of the player in the direction that the player wants to move. Something like this.

bool Map::CheckCollision( int x, int y ) {

	 if( mapArray[x][y] > 0  )
		  return true;

	 return false;

if( keydown( VK_RIGHT ) ) {
	  if( !dungeon->CheckCollision( ++player.x, player.y ) )
			 player->MoveRight( 1 ); //1 would be for the number of tiles to move

if( keydown( VK_UP ) ) {
	  if( !dungeon->CheckCollision( player.x, --player.y ) )	//Assuming positive y moves down the map
			 player->MoveUp( 1 );
Hope that gives you an idea.