• entries
    743
  • comments
    1924
  • views
    580406

Distance Joints (continued)

Sign in to follow this  

232 views



Off work with a knackered back today so managed to get a bit of work done already. The distance joints are now being rendered in the game, just as coloured strips for the time being.

">HERE'S THE NOW OBLIGATORY YOUTUBE VIDEO for your viewing pleasure.

It's a bit fiddly manually typing in the IDs of the objects they attach to, but that is a concern for a future editor when the game is finished.

As I said in the YouTube notes, the above is a bit too much like World of Goo to be used in an actual game so is just showing off the facility.

I might look into being able to texture the ropes later on but this is not a major priority. They can currently have their colour and width set per joint in the editor which might turn out to be sufficient.

I think I might add in arbitrary revolute joints next, so that I can start to create some more interesting levels without having to do any additional programming.

------------------------------



Right, revolute joints are now working in the editor and in the game. The large globe above is attached to the bit of the map by a revolute so can spin around, pulling around the smaller globe that is attached to it's edge by a distance joint.

I'm allowing Box2D to prevent bodies joined by revolute joints from colliding since they need to intersect. I'm overriding this with distance joints since they need to collide with each other in my game.

Editor code is all going to hell at the moment. I think I've pretty much given up on it ever being a stable, releasable editor as I really don't have the patience to design new features into the editor properly as I need them.

The actual game codebase is as good as I get in terms of design (about six out of ten) but I'll write a better editor when all the features are more stable.

Next thing I need to address is an editor issue though - this typing in of IDs when attaching joints is a pain - to attach a joint between the map and an actor you have to go into map mode, double-click the shape, remember its ID, go into actor mode, double-click the actor and remember its ID then finally go into joint mode, place the joint, double-click it and enter the two IDs.

Rubbish. Need to think about a better system that is not too complicated to implement for now.

[EDIT] Sorted. Now, when you create the joint, Squed checks through all the actors and mapshapes and if the joint point intersects their shape(s), it adds their ID to a vector.

For a distance joint, if there is one or more, it sets the ID to the first one. If there is more than one, it then warns that the assignment might be incorrect and asks you (very politely) to double-check manually. It does this for each end of the joint.

For a revolute joint a similar thing except it looks for two IDs, one for each shape and assigns them, warning if the point intersects three or more entities.

The vast majority of the time, the warnings don't come up and it is now a breeze to create complex chains based on joints.

------------------------------



Just a quick example of the kind of thing I can do without having to touch the source code now - I created the windmill above as a composite shape in the editor, attached it to an invisible, hollow static shape with a revolute and placed some globes in it.

Bingo - physics cliche #1, the windmill. It was that or a seesaw [smile].

------------------------------

Just for rip-off, another addition [grin].



">THE CRAZY MACHINE IN ACTION ON YOUTUBE.

The above took a few moments to put together with the new joint attaching system described (somewhere) above. It is starting to show how dynamic the game is going to be and how flexible the level editor is becoming.

The machine above uses a buzzsaw, connected to the windmill by a distance joint to drive the machine's movement. This is just a hacky thing - eventually I guess the revolute joints will have configurable motors.

------------------------------

Still heard nothing on the job I interviewed for last week, despite chasing. I did just get an email in inviting me for another interview somewhere else though so the escape plan continues well - at least if I get another job I can stop working on that bloody tunnel.
Sign in to follow this  


7 Comments


Recommended Comments

Quote:
Original post by Drilian
As usual, this looks fantastic :)


Cheers, Drillian. [smile]

Share this comment


Link to comment
As usual, I have to refresh your journal a couple of times to get all the news.

Still, looks like some good progress [smile]

Share this comment


Link to comment
Quote:
Original post by rip-off
As usual, I have to refresh your journal a couple of times to get all the news.


Yeah, sorry. I do like to post as I go. [grin]

Share this comment


Link to comment
Quote:
Original post by rip-off
That last one looks like many of my fantastic contraptions.


Like World of Goo, that is another game I have to avoid apeing too much. FC uses the Flash version of Box2D.

Share this comment


Link to comment

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