• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
thestien

Error when program terminates

4 posts in this topic

Hi guys i have just posted another thread a min ago but i didnt want to put to many subjects in one thread so i started this one [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

i am getting an error when my program shuts down [code]HEAP[classfull.exe]: Invalid address specified to RtlValidateHeap( 006D0000, 00593710 )
Windows has triggered a breakpoint in classfull.exe.

This may be due to a corruption of the heap, which indicates a bug in classfull.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while classfull.exe has focus.

The output window may have more diagnostic information.

[/code]

i think this is happening when i add objects or frames to a parent frame( or to a child or any frame lol)
i had this error when loading only one frame with one mesh and when i commented out the addobject() i didnt get the error anymore.

[code]
class CZenFrame;
typedef int (*FRAME_MOVEMENT_CALLBACK)( CZenFrame* pFrame, void* Parameter);


class CZenFrame
{
public:
CZenFrame();
~CZenFrame();

void* m_pParameter;

// Variables

protected:
D3DXMATRIX m_Local;
D3DXVECTOR3 m_vPosition;
D3DXVECTOR3 m_vVelocity;

float m_Yaw, m_Pitch, m_Roll;

CZenObject* m_pObjectList;
CZenFrame* m_pNext;
CZenFrame* m_pChildFrameList;
CZenFrame* m_pParentFrame;
FRAME_MOVEMENT_CALLBACK m_pfnCallback;
BOOL m_bCallback;


public:
HRESULT SetCallback( FRAME_MOVEMENT_CALLBACK pfnCallback);

void SetVelocity( float x, float y, float z);
void GetVelocity( float& x, float& y, float& z);

void SetPosition( float x, float y, float z);
void GetPosition( float& x, float& y, float& z);

void GetLocal( D3DXMATRIX& pMatrix);

void SetYaw( float Yaw){ m_Yaw = Yaw;}
void GetYaw( float& Yaw){ Yaw= m_Yaw;}

void SetPitch( float Pitch){ m_Pitch = Pitch;}
void GetPitch( float& Pitch){ Pitch = m_Pitch;}

void SetRoll( float Roll){ m_Roll = Roll;}
void GetRoll( float& Roll){ Roll = m_Roll;}

void Update();

HRESULT AddObject( CZenObject* pNewObject);
HRESULT Render();

void SetNext( CZenFrame* pNext){ m_pNext = pNext;}
CZenFrame* GetNext(){ return m_pNext;}
HRESULT AddFrame( CZenFrame* pNewFrame);

protected:
void SetParent( CZenFrame* pParent){ m_pParentFrame = pParent;}
CZenFrame* GetParent(){ return m_pParentFrame;}

};


HRESULT CZenFrame::AddFrame( CZenFrame* pNewFrame)
{
if( !pNewFrame)
{
SetError( "Failed to add child frame");
return E_FAIL;
}

pNewFrame->SetParent( this);

if( !m_pChildFrameList)
{
m_pChildFrameList = pNewFrame;
}
else
{
CZenFrame* pTempFrame = m_pChildFrameList;

while( pTempFrame->GetNext())
pTempFrame = pTempFrame->GetNext();

pTempFrame->SetNext( pNewFrame);
}

return S_OK;
}


HRESULT CZenFrame::AddObject( CZenObject* pNewObject)
{

if( !pNewObject)
return E_FAIL;

pNewObject->SetParentFrame( this);

if( !m_pObjectList)
{
m_pObjectList = pNewObject;
}
else
{
CZenObject* pObject = m_pObjectList;

while( pObject->GetNext())
pObject = (CZenObject*)pObject->GetNext();

pObject->SetNext( pNewObject);
}

return S_OK;
}


CZenFrame::~CZenFrame()
{

CZenObject* pObject = m_pObjectList;
CZenObject* pTemp = 0;

while( pObject)
{

pTemp = (CZenObject*)pObject->GetNext();
free( pObject);
pObject = pTemp;

}

}
[/code]


can you see any obvious causes for this error?

many thanks in advance [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
0

Share this post


Link to post
Share on other sites
this code is from a book i will look into std::list today and try to convert this code to use it. there is only one place in my program where i make NEW thats in the object class when i load materials and textures from the Xfile but they are delete[] in the mesh destructor.

will delete[] stuff; delete all of the things i have new-ed into that pointer?

thanks again for teh reply :)
0

Share this post


Link to post
Share on other sites
Delete[] should only be used on a pointer that was allocated with new[] otherwise you get undefined behaviour. If you create your own list and you have to walk that list and delete all the data that you have allocated with new or new[] with delete or delete[] but they have to match so if you used new use delete.

Also don't mix delete or delete[] with malloc allocations, or use free on new/new[] allocated memory. that will also lead to undefined behaviour.
0

Share this post


Link to post
Share on other sites
Hi This is how the x file is loaded and its the only place in my code with NEW
[code]HRESULT CZenMesh::LoadXFile( char* pstrPathName)
{
HRESULT r = 0;

LPD3DXBUFFER pMaterialBuffer = 0;

r = D3DXLoadMeshFromX(pstrPathName, D3DXMESH_MANAGED, g_pDevice, 0, &pMaterialBuffer,
0, (DWORD*)&m_NumMats, &m_pMesh);
if( FAILED( r))
{
SetError(" failed to load x file with filename:");
SetError(" pstrPathname");
return E_FAIL;
}
m_pTextures = new LPDIRECT3DTEXTURE9[m_NumMats];
m_pMaterials = new CZenMaterial[m_NumMats];

D3DXMATERIAL* pMaterials = (D3DXMATERIAL*)pMaterialBuffer->GetBufferPointer();

for( int i = 0; i < m_NumMats; i++)
{
m_pMaterials[i].m_Material = pMaterials[i].MatD3D;
m_pMaterials[i].m_Material.Ambient = m_pMaterials[i].m_Material.Diffuse;

if( !pMaterials[i].pTextureFilename)
{
m_pTextures[i] = g_pDefaultTexture;

continue;
}

r = D3DXCreateTextureFromFile( g_pDevice, pMaterials[i].pTextureFilename, &m_pTextures[i]);
if( FAILED( r))
{
SetError("unable to load texture for mesh with filename");
SetError( pMaterials[i].pTextureFilename);
m_pTextures[i] = g_pDefaultTexture;
}
}

pMaterialBuffer->Release();
return S_OK;
}[/code]

here is the destructor for the Frame and mesh class

[code]
CZenFrame::~CZenFrame()
{

CZenObject* pObject = m_pObjectList;
CZenObject* pTemp = 0;

while( pObject)
{

pTemp = (CZenObject*)pObject->GetNext();
free( pObject);
pObject = pTemp;

}

}

CZenMesh::~CZenMesh()
{

delete [] m_pMaterials;
delete [] m_pTextures;


}[/code]

i wrote the mesh destructor because there isnt one in the book. is that the right way to delete those news?
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0