• ### Blog Entries

• entries
4
2
• views
4309

The development journal of the 'Pixelante' Quinn...

## Update

Sorry, for the lack of posts lately, I've been putting together a development team of friends, to start working on a small scale single player RPG, and we're in the design phase, for the moment.

Also, on the side, I'm working on two projects:

1) Updating my Web Page.
2) Simple Poker Game.

I'll get some pictures posted before long.

Thanks.
[Pixelante]

## Map Editor (2D)

I'm in the midst of working on a 2D Tile Editor, for use in creating some old school games I'm going to be working on, in the future. Basically, going to make some old classic recreations like Digdug, Pacman, Super Mario Bros, as just a way to enhance my ability as a gameplay and tools programmer, while delving into the old school abyss of old time favorites. Of course, none of these applications are for profit or anything, just educational purposes.

I'll be sure to post some screen shots when I'm done, but it'll still be another week or two. I've got the drawing and such all done, resizable grid and map size, but I still need to work on getting my file loading and saving down pat, and optimize what I've got thrown together.

I'll keep everyone updated.

Side Note: Tile set not being used, just showing example of map editor. I have some tile sets in production for my own works.

Quinn

[Pixelante]

## Overlap Tests(Mesh)

These are snippets of the source code, they can be placed and broken up to be more efficient then they are currently laid out to be.
D3DXVECTOR3 vCenter;// Lock the Vertex Bufferif(SUCCEEDED(pMesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&Ptr))){     // Computer Bounding Sphere RadiusD3DXComputeBoundingSphere((void*)Ptr, pMesh->GetNumVertices(), pMesh->GetNumBytesPerVertex(), &vCenter, &fObjectRadius);fObjectRadius = D3DXVec3Length(&vCenter) + fObjectRadius;     // Unlock the Vertex Buffer     pMesh->UnlockVertexBuffer();}
D3DXVECTOR3 vObjectPosVS, vPlayerPosVS;D3DXVec3TransformCoord( &vObjectPosVS, &matView, &vObjectPosWS );D3DXVec3TransformCoord( &vPlayerPosVS, &matView, &vPlayerPosWS );
Basically, at this point, we're transforming the coordinates from World-space to View-space, and then if object obstructs player, apply transparency:
if ( ( vObjectPosVS.z + fObjectRadius > 0 ) && ( vObjectPosVS.z - fObjectRadius < vPlayerPosVS.z ) ){	D3DXVECTOR3 vPositionsVS [4];	D3DXVECTOR3 vPositionsSS [4];	D3DXVECTOR2 vObjectMaxSS;	D3DXVECTOR2 vObjectMinSS;	D3DXVECTOR2 vPlayerMaxSS;	D3DXVECTOR2 vPlayerMinSS;	// Calculate the area the object bounding volume takes up in view space	vPositionsVS[0] = D3DXVECTOR3( vObjectPosVS.x + fObjectRadius, vObjectPosVS.y, vObjectPosVS.z );	vPositionsVS[1] = D3DXVECTOR3( vObjectPosVS.x - fObjectRadius, vObjectPosVS.y, vObjectPosVS.z );	vPositionsVS[2] = D3DXVECTOR3( vObjectPosVS.x, vObjectPosVS.y + fObjectRadius, vObjectPosVS.z );	vPositionsVS[3] = D3DXVECTOR3( vObjectPosVS.x, vObjectPosVS.y - fObjectRadius, vObjectPosVS.z );	// Calculate the area the object bounding volume takes up in screen space	D3DXVec3TransformCoordArray( vPositionsSS, sizeof(D3DXVECTOR3), vPositionsVS, sizeof(D3DXVECTOR3), &matProjection, 4 ); 	vObjectMaxSS.x = vPositionsSS[0].x;	vObjectMinSS.x = vPositionsSS[1].x;	vObjectMaxSS.y = vPositionsSS[2].y;	vObjectMinSS.y = vPositionsSS[3].y;	// Calculate the area the player bounding volume takes up in view space	vPositionsVS[0] = D3DXVECTOR3( vPlayerPosVS.x + fPlayerRadius, vPlayerPosVS.y, vPlayerPosVS.z );	vPositionsVS[1] = D3DXVECTOR3( vPlayerPosVS.x - fPlayerRadius, vPlayerPosVS.y, vPlayerPosVS.z );	vPositionsVS[2] = D3DXVECTOR3( vPlayerPosVS.x, vPlayerPosVS.y + fPlayerRadius, vPlayerPosVS.z );	vPositionsVS[3] = D3DXVECTOR3( vPlayerPosVS.x, vPlayerPosVS.y - fPlayerRadius, vPlayerPosVS.z );	// Calculate the area the player bounding volume takes up in screen space	D3DXVec3TransformCoordArray( vPositionsSS, sizeof(D3DXVECTOR3), vPositionsVS, sizeof(D3DXVECTOR3), &matProjection, 4 ); 	vPlayerMaxSS.x = vPositionsSS[0].x;	vPlayerMinSS.x = vPositionsSS[1].x;	vPlayerMaxSS.y = vPositionsSS[2].y;	vPlayerMinSS.y = vPositionsSS[3].y;	// Check for overlap	if ( vObjectMaxSS.x < vPlayerMinSS.x )		return;	if ( vObjectMaxSS.y < vPlayerMinSS.y )		return;	if ( vObjectMinSS.x > vPlayerMaxSS.x )		return;	if ( vObjectMinSS.y < vPlayerMaxSS.y )		return;	// If we got here, the object is obstructing and should be made transparent}
There we have it. The code can be manipulated however you want, I'm currently handling it during any sort of updates, to handle manipulation of the location of the volume. Many thanks to MJP for helping guide me, each step of the process. Hopefully, this helps someone out in the future, be sure and rate up MJP after reading this please. Hehe.

## Overlap Tests (Mesh)

So, I am in the midst of putting together a screen-space overlap snippet, to handle mesh transparency, if the view of a player is being obstructed by another mesh or multiple meshes.

A snippet is fourthcoming, when I finish it. I want to thank MJP, for all the help he's given me in learning such a concept.

Quinn
[Pixelante]