Squish (Prototype)

Just thought I'd post up a link to a little prototype I've put together with Box2D. Purely a work in progress at the moment.

http://members.gamedev.net/easilyconfus ... shdemo.zip

It's an experiment to see if it was possible to create a soft-body character that propels itself around with a retractable elastic grapple.

readme.txt has control instructions and some notes on changing the resolution.

More details in my GameDev journal: http://www.gamedev.net/community/forums ... ?jn=408620
Looks very cool : D.

Only two things; it feels like the horizontal forces should be dampened a bit while squishy is airborne or lifted by his arm.
Also, the raytracer (?) behaves a bit weird when the sling is fired over an edge, it feels like it should stick on the other side but it pops up on the side squishy is facing.

I am also interested in how you solved where the mouse was clicking since I am looking for a nice solution for that in a game i'm currently working on.
udoprog wrote:
Looks very cool : D.

Only two things; it feels like the horizontal forces should be dampened a bit while squishy is airborne or lifted by his arm.


Thanks for the comments. I do need to tweak the movement a bit.

udoprog wrote:
Also, the raytracer (?) behaves a bit weird when the sling is fired over an edge, it feels like it should stick on the other side but it pops up on the side squishy is facing.


It's not actually a raytrace - while the grapple is being fired, the blob on the end is actually a rigid circle. I listen for a contact with the map then destroy the body and create a distance joint from the contact position to the centre of squishy so it is a bit hard to change. The distance joint doesn't actually exist until the grapple locks - the line drawn between the blob and squishy is literally just that until it locks.

udoprog wrote:
I am also interested in how you solved where the mouse was clicking since I am looking for a nice solution for that in a game i'm currently working on.


Sure.

This is a D3D app being rendered with an ortho projection so I don't know if this will apply to your application, but given the previously computed view matrix View (based on squishy position and map extremities) and projection matrix Proj, the following fills in a D3DXVECTOR3 representing the mouse world position:

Code:
void ComputeMousePos()
{
   POINT Pt; GetCursorPos(&Pt);

   D3DVIEWPORT9 Vp;
   Graphics.GetDevice()->GetViewport(&Vp);
   
   MousePos.x=(((2.0f*float(Pt.x))/Vp.Width)-1.0f)/Proj(0,0);
   MousePos.y=(((-2.0f*float(Pt.y))/Vp.Height)+1.0f)/Proj(1,1);
   MousePos.z=0;
   
   D3DXMATRIX ViewInv;
   D3DXMatrixInverse(&ViewInv,0,&View);

   D3DXVec3TransformCoord(&MousePos,&MousePos,&ViewInv);
}


I basically transform the screen pos back into view space based on the viewport and projection matrix, then transform the view space position back into world space by transforming by the inverse of the view matrix. It is based on some code in Frank Luna's 3D Game Programming with DirectX in the chapter on picking with rays.
Thank you for your interesting and helpful reply!
Don't mean to bump the thread but just wanted to post to say that there has been some quite significant progress on this project. There are some proper graphics now, two extendible elastic arms and objects you can throw around the map.

Details and a playable in my GD journal: http://www.gamedev.net/community/forums ... ?jn=408620

Comments and feedback always welcome there or here.
I'm interested in your game, but it doesn't work.

Says:
Error: Unable to create Direct3D device.
A fatal error has been encountered causing the application to terminate. If reinstalling the application does not resolve the problem, please consult your vendor.

Bla-bla-bla, I have directX 9.0c
Neosano wrote:
I'm interested in your game, but it doesn't work.

Says:
Error: Unable to create Direct3D device.
A fatal error has been encountered causing the application to terminate. If reinstalling the application does not resolve the problem, please consult your vendor.

Bla-bla-bla, I have directX 9.0c


Hmm. That's quite odd. The only thing that I can think of is that your hardware doesn't support hardware vertex processing, which seems unlikely in this day and age.

I'll update the demo to fall back on software processing if the request fails - I really can't think what else would cause the actual device creation to fail.

If you'd care to post your specs, I can investigate.

Thanks for your interest and your feedback - it is invaluable.

Paul

Original thread: https://box2d.org/forum/viewtopic.php?t=2449